type
stringclasses 7
values | content
stringlengths 4
9.55k
| repo
stringlengths 7
96
| path
stringlengths 4
178
| language
stringclasses 1
value |
|---|---|---|---|---|
ArrowFunction
|
() => {
const deviceSupport = new DeviceSupport();
deviceSupport.addDetector({name: 'foo', supported: async () => true});
assert.throws(() => deviceSupport.addDetector({
name: 'foo',
supported: async () => false
}), 'foo already added');
}
|
GoogleChromeLabs/perception-toolk
|
src/support/device-support_test.ts
|
TypeScript
|
ArrowFunction
|
() => deviceSupport.addDetector({
name: 'foo',
supported: async () => false
})
|
GoogleChromeLabs/perception-toolk
|
src/support/device-support_test.ts
|
TypeScript
|
ArrowFunction
|
async () => false
|
GoogleChromeLabs/perception-toolk
|
src/support/device-support_test.ts
|
TypeScript
|
ArrowFunction
|
(done) => {
const deviceSupport = new DeviceSupport();
deviceSupport.useEvents = true;
deviceSupport.addDetector({name: 'foo', supported: async () => true});
window.addEventListener(DeviceSupport.supportsEvent, (evt) => {
const supportEvt = evt as CustomEvent<Support>;
assert.deepEqual(supportEvt.detail, { foo: true });
done();
});
deviceSupport.detect();
}
|
GoogleChromeLabs/perception-toolk
|
src/support/device-support_test.ts
|
TypeScript
|
ArrowFunction
|
(evt) => {
const supportEvt = evt as CustomEvent<Support>;
assert.deepEqual(supportEvt.detail, { foo: true });
done();
}
|
GoogleChromeLabs/perception-toolk
|
src/support/device-support_test.ts
|
TypeScript
|
ArrowFunction
|
() => {
test("isCompleted set to false should show up on document", () => {
const markAsCompleted = jest.fn()
const handleEditTask = jest.fn()
render(
<StateProvider>
<TodoListFilter
markAsCompleted={markAsCompleted}
isCompleted={false}
editTask={handleEditTask}
/>
</StateProvider>,
)
})
test("completed todo is faded", () => {
const markAsCompleted = jest.fn()
const handleEditTask = jest.fn()
render(
<StateProvider>
<TodoListFilter
markAsCompleted={markAsCompleted}
isCompleted={true}
editTask={handleEditTask}
/>
</StateProvider>,
)
})
test("isCompleted set to true ", () => {
const markAsCompleted = jest.fn()
const handleEditTask = jest.fn()
const newTodo: Todo = {
id: "123",
todo: "Add tests",
isCompleted: false,
}
store.dispatch(addTodo(newTodo))
store.dispatch(toggleTodo(newTodo.id))
const state = store.getState().todos
render(
<StateProvider>
<TodoListFilter
markAsCompleted={markAsCompleted}
isCompleted={true}
editTask={handleEditTask}
/>
</StateProvider>,
)
expect(state.value[0].isCompleted).toBe(true)
})
}
|
cremalab/israel-todo
|
src/components/TodoListFilter/TodoListFilter.test.tsx
|
TypeScript
|
ArrowFunction
|
() => {
const markAsCompleted = jest.fn()
const handleEditTask = jest.fn()
render(
<StateProvider>
<TodoListFilter
markAsCompleted={markAsCompleted}
isCompleted={false}
editTask={handleEditTask}
/>
</StateProvider>,
)
}
|
cremalab/israel-todo
|
src/components/TodoListFilter/TodoListFilter.test.tsx
|
TypeScript
|
ArrowFunction
|
() => {
const markAsCompleted = jest.fn()
const handleEditTask = jest.fn()
render(
<StateProvider>
<TodoListFilter
markAsCompleted={markAsCompleted}
isCompleted={true}
editTask={handleEditTask}
/>
</StateProvider>,
)
}
|
cremalab/israel-todo
|
src/components/TodoListFilter/TodoListFilter.test.tsx
|
TypeScript
|
ArrowFunction
|
() => {
const markAsCompleted = jest.fn()
const handleEditTask = jest.fn()
const newTodo: Todo = {
id: "123",
todo: "Add tests",
isCompleted: false,
}
store.dispatch(addTodo(newTodo))
store.dispatch(toggleTodo(newTodo.id))
const state = store.getState().todos
render(
<StateProvider>
<TodoListFilter
markAsCompleted={markAsCompleted}
isCompleted={true}
editTask={handleEditTask}
/>
</StateProvider>,
)
expect(state.value[0].isCompleted).toBe(true)
}
|
cremalab/israel-todo
|
src/components/TodoListFilter/TodoListFilter.test.tsx
|
TypeScript
|
FunctionDeclaration
|
async function bootstrap() {
const app = await NestFactory.create(AppModule);
const options = new DocumentBuilder()
.setTitle('Star Wars')
.setDescription('YVH')
.setVersion('1.0')
.build();
const document = SwaggerModule.createDocument(app, options);
SwaggerModule.setup('api', app, document);
await app.listen(8888);
}
|
gcinc91/lignbe
|
src/main.ts
|
TypeScript
|
ArrowFunction
|
t => type.toLowerCase().includes(t.type.toLowerCase())
|
MccCareplan/providersmartapp
|
src/app/care-team/care-team.component.ts
|
TypeScript
|
ArrowFunction
|
r => role.toLowerCase().includes(r.role.toLowerCase())
|
MccCareplan/providersmartapp
|
src/app/care-team/care-team.component.ts
|
TypeScript
|
ClassDeclaration
|
@Component({
selector: 'app-care-team',
templateUrl: './care-team.component.html',
styleUrls: ['./care-team.component.css']
})
export class CareTeamComponent implements OnInit {
constructor(public dataservice: DataService) {
}
gridColumns = 4;
iconNames = {
types:
[
{ type: 'person', icon: 'person' },
{ type: 'organization', icon: 'group' }
],
roles:
[
{ role: 'patient', icon: 'sick' },
{ role: 'catering', icon: 'food_bank' },
{ role: 'physician', icon: 'medical_services' },
{ role: 'nurse', icon: 'medical_services' },
{ role: 'caregiver', icon: 'medical_services' },
{ role: 'ologist', icon: 'medical_services' },
{ role: 'dietician', icon: 'fastfood' },
{ role: 'social worker', icon: 'psychology' },
{ role: 'pharmacist', icon: 'medical_services' },
]
};
ngOnInit(): void {
}
getTypeIcon(type) {
if (!type)
return '';
const icon = this.iconNames.types.filter(t => type.toLowerCase().includes(t.type.toLowerCase()));
if (icon.length > 0) {
return icon[0].icon;
} else {
return '';
}
}
getRoleIcon(role) {
if (!role)
return '';
const icon = this.iconNames.roles.filter(r => role.toLowerCase().includes(r.role.toLowerCase()));
if (icon.length > 0) {
return icon[0].icon;
} else {
return '';
}
}
}
|
MccCareplan/providersmartapp
|
src/app/care-team/care-team.component.ts
|
TypeScript
|
MethodDeclaration
|
getTypeIcon(type) {
if (!type)
return '';
const icon = this.iconNames.types.filter(t => type.toLowerCase().includes(t.type.toLowerCase()));
if (icon.length > 0) {
return icon[0].icon;
} else {
return '';
}
}
|
MccCareplan/providersmartapp
|
src/app/care-team/care-team.component.ts
|
TypeScript
|
MethodDeclaration
|
getRoleIcon(role) {
if (!role)
return '';
const icon = this.iconNames.roles.filter(r => role.toLowerCase().includes(r.role.toLowerCase()));
if (icon.length > 0) {
return icon[0].icon;
} else {
return '';
}
}
|
MccCareplan/providersmartapp
|
src/app/care-team/care-team.component.ts
|
TypeScript
|
ArrowFunction
|
() => {
const [value, setValue] = React.useState<number>(1);
const steps = [
{
active: value === 0,
complete: value > 0,
onClick: () => setValue(0),
subTitle: 'SubOne',
title: 'One',
},
{
active: value === 1,
complete: value > 1,
onClick: () => setValue(1),
subTitle: 'SubTwo',
title: 'Two',
},
{
active: value === 2,
complete: value > 2,
onClick: () => setValue(2),
subTitle: 'SubThree',
title: 'Three',
},
{
active: value === 3,
complete: value > 3,
onClick: () => setValue(3),
subTitle: 'SubFour',
title: 'Four',
},
];
return (
<div className="sheet">
<ClayMultiStepNav>
{steps.map(
(
{active, complete, onClick, subTitle, title},
i: number
) => (
<ClayMultiStepNav.Item
active={active}
complete={complete}
expand={i + 1 !== steps.length}
key={i}
>
<ClayMultiStepNav.Title>
{title}
</ClayMultiStepNav.Title>
<ClayMultiStepNav.Divider />
<ClayMultiStepNav.Indicator
complete={complete}
label={1 + i}
onClick={onClick}
spritemap={spritemap}
subTitle={subTitle}
/>
</ClayMultiStepNav.Item>
|
victorvalle/clay
|
packages/clay-multi-step-nav/stories/index.tsx
|
TypeScript
|
ArrowFunction
|
() => setValue(0)
|
victorvalle/clay
|
packages/clay-multi-step-nav/stories/index.tsx
|
TypeScript
|
ArrowFunction
|
() => setValue(1)
|
victorvalle/clay
|
packages/clay-multi-step-nav/stories/index.tsx
|
TypeScript
|
ArrowFunction
|
() => setValue(2)
|
victorvalle/clay
|
packages/clay-multi-step-nav/stories/index.tsx
|
TypeScript
|
ArrowFunction
|
() => setValue(3)
|
victorvalle/clay
|
packages/clay-multi-step-nav/stories/index.tsx
|
TypeScript
|
ArrowFunction
|
(
{active, complete, onClick, subTitle, title},
i: number
) => (
<ClayMultiStepNav.Item
active={active}
|
victorvalle/clay
|
packages/clay-multi-step-nav/stories/index.tsx
|
TypeScript
|
ArrowFunction
|
() => {
const [active, setActive] = React.useState(0);
const steps = [
{
subTitle: 'SubOne',
title: 'One',
},
{
subTitle: 'SubTwo',
title: 'Two',
},
{
subTitle: 'SubThree',
title: 'Three',
},
{
subTitle: 'SubFour',
title: 'Four',
},
{
subTitle: 'SubFive',
title: 'Five',
},
{
subTitle: 'SubSix',
title: 'Six',
},
{
subTitle: 'SubSeven',
title: 'Seven',
},
{
subTitle: 'SubEight',
title: 'Eight',
},
{
subTitle: 'SubNine',
title: 'Nine',
},
];
return (
<div className="sheet">
<ClayMultiStepNavWithBasicItems
activeIndex={active}
maxStepsShown={number('Max Steps Shown', 7)}
onIndexChange={setActive}
spritemap={spritemap}
steps={steps}
/>
</div>
|
victorvalle/clay
|
packages/clay-multi-step-nav/stories/index.tsx
|
TypeScript
|
MethodDeclaration
|
number('Max Steps Shown', 7)
|
victorvalle/clay
|
packages/clay-multi-step-nav/stories/index.tsx
|
TypeScript
|
FunctionDeclaration
|
export function activate(context: ExtensionContext) {
// The server is implemented in node
const serverModule = context.asAbsolutePath(
join('dist', 'server.js')
)
// The debug options for the server
// --inspect=6009: runs the server in Node's Inspector mode so VS Code can attach to the server for debugging
const debugOptions = { execArgv: ['--nolazy', '--inspect=6009'] }
// If the extension is launched in debug mode then the debug server options are used
// Otherwise the run options are used
const serverOptions: ServerOptions = {
run: {
module: serverModule,
transport: TransportKind.ipc
},
debug: {
module: serverModule,
transport: TransportKind.ipc,
options: debugOptions
}
}
// Options to control the language client
const clientOptions: LanguageClientOptions & { synchronize: { fileEvents: FileSystemWatcher[] } } = {
// Register the server for mcfunction documents
documentSelector: [{ language: 'mcfunction' }],
synchronize: {
fileEvents: []
},
initializationOptions: {
storagePath: context.storagePath,
globalStoragePath: context.globalStoragePath
},
progressOnInitialization: true
}
if (workspace.workspaceFolders) {
for (const root of workspace.workspaceFolders) {
clientOptions.synchronize.fileEvents.push(
workspace.createFileSystemWatcher(
new RelativePattern(root, 'data/**/*.{json,mcfunction,mcmeta}')
)
)
}
}
// Create the language client and start the client.
client = new LanguageClient(
'datapackLanguageServer',
'Datapack Language Server',
serverOptions,
clientOptions
)
// client.registerProposedFeatures()
// Start the client. This will also launch the server
client.start()
}
|
Ghoulboy78/datapack-language-server
|
src/client.ts
|
TypeScript
|
FunctionDeclaration
|
export function deactivate(): Thenable<void> | undefined {
if (!client) {
return undefined
}
return client.stop()
}
|
Ghoulboy78/datapack-language-server
|
src/client.ts
|
TypeScript
|
ArrowFunction
|
(_: Context, { commentDomain }: Modules): CommentRoutes => {
const getComments = async (req: Request, res: Response) => {
const postId = req.params.id;
let result;
try {
result = await commentDomain.getComments(postId, {
start: req.query.start,
limit: 3,
withVirtuals: true,
});
} catch (err) {
return res.status(400).json(err);
}
res.json(result);
};
const createComment = async (req: Request, res: Response) => {
const postId = req.params.id;
let comment;
try {
comment = await commentDomain.createComment(postId, req.body);
} catch (err) {
return res.status(400).json(err);
}
res.json(comment);
};
const deleteComment = async (req: Request, res: Response) => {
const commentId = req.params.id;
let result;
try {
result = await commentDomain.deleteComment(commentId);
} catch (err) {
return res.status(400).json(err);
}
res.send(result);
};
return {
getComments,
createComment,
deleteComment,
};
}
|
dhirp/google-datastore-blog-app
|
src/server/modules/blog/comment/comment.routes-handlers.ts
|
TypeScript
|
ArrowFunction
|
async (req: Request, res: Response) => {
const postId = req.params.id;
let result;
try {
result = await commentDomain.getComments(postId, {
start: req.query.start,
limit: 3,
withVirtuals: true,
});
} catch (err) {
return res.status(400).json(err);
}
res.json(result);
}
|
dhirp/google-datastore-blog-app
|
src/server/modules/blog/comment/comment.routes-handlers.ts
|
TypeScript
|
ArrowFunction
|
async (req: Request, res: Response) => {
const postId = req.params.id;
let comment;
try {
comment = await commentDomain.createComment(postId, req.body);
} catch (err) {
return res.status(400).json(err);
}
res.json(comment);
}
|
dhirp/google-datastore-blog-app
|
src/server/modules/blog/comment/comment.routes-handlers.ts
|
TypeScript
|
ArrowFunction
|
async (req: Request, res: Response) => {
const commentId = req.params.id;
let result;
try {
result = await commentDomain.deleteComment(commentId);
} catch (err) {
return res.status(400).json(err);
}
res.send(result);
}
|
dhirp/google-datastore-blog-app
|
src/server/modules/blog/comment/comment.routes-handlers.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface CommentRoutes {
getComments(req: Request, res: Response): any;
createComment(req: Request, res: Response): any;
deleteComment(req: Request, res: Response): any;
}
|
dhirp/google-datastore-blog-app
|
src/server/modules/blog/comment/comment.routes-handlers.ts
|
TypeScript
|
ArrowFunction
|
(availableViews: { [x: string]: React.RefObject<HTMLElement> }, home: string = 'home') => {
const [view, setView] = React.useState<keyof typeof availableViews>(home);
const changeView = (e: React.MouseEvent<HTMLButtonElement>) => {
const el = e.currentTarget;
const dest = el.dataset.dest;
if (isInUnion(dest, Object.keys(availableViews))) {
setView(dest);
}
}
const backHome = () => {
setView(home);
}
return { view, changeView, backHome }
}
|
mgn901/m13tk-react
|
src/view/useView.ts
|
TypeScript
|
ArrowFunction
|
(e: React.MouseEvent<HTMLButtonElement>) => {
const el = e.currentTarget;
const dest = el.dataset.dest;
if (isInUnion(dest, Object.keys(availableViews))) {
setView(dest);
}
}
|
mgn901/m13tk-react
|
src/view/useView.ts
|
TypeScript
|
ArrowFunction
|
() => {
setView(home);
}
|
mgn901/m13tk-react
|
src/view/useView.ts
|
TypeScript
|
ClassDeclaration
|
@Component({
selector: 'app-footer',
templateUrl: './footer.component.html',
styleUrls: ['./footer.component.css'],
})
export class FooterComponent {
}
|
mthalman/vira-offical-website
|
ViraOfficialWebpage/ClientApp/src/app/footer/footer.component.ts
|
TypeScript
|
FunctionDeclaration
|
export async function up(knex: Knex): Promise<any> {
return knex.schema.createTable("user", table =>{
table.increments("id").primary()
table.string("Username", 100).notNullable()
})
}
|
lunadis/ScriptControl
|
api/src/Data/Migrations/20200706214633_Users.ts
|
TypeScript
|
FunctionDeclaration
|
export async function down(knex: Knex): Promise<any> {
return knex.schema.dropTable("User")
}
|
lunadis/ScriptControl
|
api/src/Data/Migrations/20200706214633_Users.ts
|
TypeScript
|
ArrowFunction
|
table =>{
table.increments("id").primary()
table.string("Username", 100).notNullable()
}
|
lunadis/ScriptControl
|
api/src/Data/Migrations/20200706214633_Users.ts
|
TypeScript
|
FunctionDeclaration
|
async function clickLocationButtonAndAddLocation(gatheringIdx: number, unitIdx: number) {
await $getLocationButtonFor(gatheringIdx, unitIdx).click();
await browser.wait(protractor.ExpectedConditions.visibilityOf($locationModal), 5000, "Map modal waiting timeout");
expect(await $locationModal.isDisplayed()).toBe(true);
expect(await $locationModalMap.isDisplayed()).toBe(true);
await browser.actions()
.mouseMove($locationModalMap.getWebElement(), {x: 100, y: 100}).perform();
await browser.actions().click().perform();
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
(form: Form) => async (path: string, type?: string) => {
const parsePointer = (container: any, path: string): any => {
const [next, ...remaining] = path.split(".");
const nextObject = container[next];
if (remaining.length) {
return parsePointer(nextObject, remaining.join("."));
}
return nextObject;
};
expect(await lajiFormLocate(path).isDisplayed()).toBe(true);
const beforeChange = parsePointer(await form.getChangedData() || {}, path);
let widget;
let $secondOption, $otherOptionThanActive;
switch (type) {
case "checkbox":
widget = form.getBooleanWidget(path);
await widget.$nonactive.click();
break;
case "enum":
widget = form.$getEnumWidget(path);
await widget.click();
await browser.wait(protractor.ExpectedConditions.visibilityOf(widget.$$("li").first()), 300, "enum list didn't appear on widget click");
$secondOption = widget.$$("li").get(1);
$otherOptionThanActive = (await $secondOption.getAttribute("class")).includes("rw-state-selected")
? widget.$$("li").first()
: $secondOption;
await $otherOptionThanActive.click();
break;
case "date":
widget = form.getDateWidget(path).$input;
await widget.click();
await widget.sendKeys("1.1.2019");
await widget.sendKeys(protractor.Key.TAB);
break;
default:
widget = form.$getInputWidget(path);
await widget.sendKeys("1");
await widget.sendKeys(protractor.Key.TAB);
break;
}
expect(beforeChange).not.toEqual(parsePointer(await form.getChangedData(), path));
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async (path: string, type?: string) => {
const parsePointer = (container: any, path: string): any => {
const [next, ...remaining] = path.split(".");
const nextObject = container[next];
if (remaining.length) {
return parsePointer(nextObject, remaining.join("."));
}
return nextObject;
};
expect(await lajiFormLocate(path).isDisplayed()).toBe(true);
const beforeChange = parsePointer(await form.getChangedData() || {}, path);
let widget;
let $secondOption, $otherOptionThanActive;
switch (type) {
case "checkbox":
widget = form.getBooleanWidget(path);
await widget.$nonactive.click();
break;
case "enum":
widget = form.$getEnumWidget(path);
await widget.click();
await browser.wait(protractor.ExpectedConditions.visibilityOf(widget.$$("li").first()), 300, "enum list didn't appear on widget click");
$secondOption = widget.$$("li").get(1);
$otherOptionThanActive = (await $secondOption.getAttribute("class")).includes("rw-state-selected")
? widget.$$("li").first()
: $secondOption;
await $otherOptionThanActive.click();
break;
case "date":
widget = form.getDateWidget(path).$input;
await widget.click();
await widget.sendKeys("1.1.2019");
await widget.sendKeys(protractor.Key.TAB);
break;
default:
widget = form.$getInputWidget(path);
await widget.sendKeys("1");
await widget.sendKeys(protractor.Key.TAB);
break;
}
expect(beforeChange).not.toEqual(parsePointer(await form.getChangedData(), path));
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
(container: any, path: string): any => {
const [next, ...remaining] = path.split(".");
const nextObject = container[next];
if (remaining.length) {
return parsePointer(nextObject, remaining.join("."));
}
return nextObject;
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
form = await createForm({id: "JX.519"});
testWidget = _testWidget(form);
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
() => {
const $gatheringEvent = lajiFormLocate("gatheringEvent");
it("container is displayed", async () => {
expect(await $gatheringEvent.isPresent()).toBe(true);
});
describe("contains", () => {
it("secureLevel which is editable", async () => {
expect(await $gatheringEvent.element(lajiFormLocate("secureLevel").locator()).isDisplayed()).toBe(true);
await testWidget("secureLevel", "checkbox");
});
it("gatheringEvent.legPublic which is editable", async () => {
await testWidget("gatheringEvent.legPublic", "checkbox");
});
it("gatheringEvent.dateBegin which is editable", async () => {
await testWidget("gatheringEvent.dateBegin", "date");
});
it("gatheringEvent.dateEnd which is editable", async () => {
await testWidget("gatheringEvent.dateEnd", "date");
});
it("keywords which is editable", async () => {
expect(await $gatheringEvent.element(lajiFormLocate("keywords").locator()).isDisplayed()).toBe(true);
await testWidget("keywords");
});
// TODO TableField messes up ids!
describe("observers", () => {
it("displayed", async () => {
expect(await isDisplayed(form.$locate("gatheringEvent.0.leg"))).toBe(true);
});
it("can be added", async () => {
await form.$locateButton("gatheringEvent", "add").click();
expect(await isDisplayed(form.$locate("gatheringEvent.1.leg"))).toBe(true);
});
it("deleting first shows only the remaining empty", async () => {
// Should be 1st delete button (row 0 is labels)
await $$(".table-field .row").get(1).$("button").click(); // eslint-disable-line protractor/use-first-last
expect(await isDisplayed(form.$locate("gatheringEvent.1.leg"))).toBe(false);
expect(await form.$getInputWidget("gatheringEvent.0.leg").getAttribute("value")).toBe("");
});
});
});
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
expect(await $gatheringEvent.isPresent()).toBe(true);
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
() => {
it("secureLevel which is editable", async () => {
expect(await $gatheringEvent.element(lajiFormLocate("secureLevel").locator()).isDisplayed()).toBe(true);
await testWidget("secureLevel", "checkbox");
});
it("gatheringEvent.legPublic which is editable", async () => {
await testWidget("gatheringEvent.legPublic", "checkbox");
});
it("gatheringEvent.dateBegin which is editable", async () => {
await testWidget("gatheringEvent.dateBegin", "date");
});
it("gatheringEvent.dateEnd which is editable", async () => {
await testWidget("gatheringEvent.dateEnd", "date");
});
it("keywords which is editable", async () => {
expect(await $gatheringEvent.element(lajiFormLocate("keywords").locator()).isDisplayed()).toBe(true);
await testWidget("keywords");
});
// TODO TableField messes up ids!
describe("observers", () => {
it("displayed", async () => {
expect(await isDisplayed(form.$locate("gatheringEvent.0.leg"))).toBe(true);
});
it("can be added", async () => {
await form.$locateButton("gatheringEvent", "add").click();
expect(await isDisplayed(form.$locate("gatheringEvent.1.leg"))).toBe(true);
});
it("deleting first shows only the remaining empty", async () => {
// Should be 1st delete button (row 0 is labels)
await $$(".table-field .row").get(1).$("button").click(); // eslint-disable-line protractor/use-first-last
expect(await isDisplayed(form.$locate("gatheringEvent.1.leg"))).toBe(false);
expect(await form.$getInputWidget("gatheringEvent.0.leg").getAttribute("value")).toBe("");
});
});
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
expect(await $gatheringEvent.element(lajiFormLocate("secureLevel").locator()).isDisplayed()).toBe(true);
await testWidget("secureLevel", "checkbox");
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
await testWidget("gatheringEvent.legPublic", "checkbox");
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
await testWidget("gatheringEvent.dateBegin", "date");
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
await testWidget("gatheringEvent.dateEnd", "date");
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
expect(await $gatheringEvent.element(lajiFormLocate("keywords").locator()).isDisplayed()).toBe(true);
await testWidget("keywords");
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
() => {
it("displayed", async () => {
expect(await isDisplayed(form.$locate("gatheringEvent.0.leg"))).toBe(true);
});
it("can be added", async () => {
await form.$locateButton("gatheringEvent", "add").click();
expect(await isDisplayed(form.$locate("gatheringEvent.1.leg"))).toBe(true);
});
it("deleting first shows only the remaining empty", async () => {
// Should be 1st delete button (row 0 is labels)
await $$(".table-field .row").get(1).$("button").click(); // eslint-disable-line protractor/use-first-last
expect(await isDisplayed(form.$locate("gatheringEvent.1.leg"))).toBe(false);
expect(await form.$getInputWidget("gatheringEvent.0.leg").getAttribute("value")).toBe("");
});
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
expect(await isDisplayed(form.$locate("gatheringEvent.0.leg"))).toBe(true);
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
await form.$locateButton("gatheringEvent", "add").click();
expect(await isDisplayed(form.$locate("gatheringEvent.1.leg"))).toBe(true);
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
// Should be 1st delete button (row 0 is labels)
await $$(".table-field .row").get(1).$("button").click(); // eslint-disable-line protractor/use-first-last
expect(await isDisplayed(form.$locate("gatheringEvent.1.leg"))).toBe(false);
expect(await form.$getInputWidget("gatheringEvent.0.leg").getAttribute("value")).toBe("");
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
() => {
it("is displayed", async () => {
expect(await lajiFormLocate("gatherings").isDisplayed()).toBe(true);
});
it("is empty", async () => {
expect(await lajiFormLocate("gatherings.0").isPresent()).toBe(false);
});
it("map is present", async () => {
expect(await $gatheringsMap.isDisplayed()).toBe(true);
});
it("creating pointer on map creates gathering", async () => {
await putForeignMarkerToMap();
expect(await lajiFormLocate("gatherings.0").isDisplayed()).toBe(true);
});
describe("geocoding", () => {
it("starts and finishes after adding gathering", async () => {
if (await lajiFormLocate("gatherings.0.country").isPresent()) {
return;
}
const $loadingGeocoderButton = $(".geocoder-btn .react-spinner");
if (await $loadingGeocoderButton.isPresent()) {
await browser.wait(protractor.ExpectedConditions.invisibilityOf($loadingGeocoderButton), 6000, "Geocoding timeout");
}
expect(await $loadingGeocoderButton.isPresent()).toBe(false);
});
if (!googleApiKey) {
pending("Google API key missing");
}
it("adds country which is editable", async () => {
await testWidget("gatherings.0.country");
});
it("adds administrativeProvince which is editable", async () => {
await testWidget("gatherings.0.administrativeProvince");
});
it("adds municipality which is editable", async () => {
await testWidget("gatherings.0.municipality");
});
});
it("contains locality which is editable", async () => {
await testWidget("gatherings.0.locality");
});
it("contains localityDescription which is editable", async () => {
await testWidget("gatherings.0.localityDescription");
});
it("contains weather which is editable", async () => {
await testWidget("gatherings.0.weather");
});
it("contains notes which is editable", async () => {
await testWidget("gatherings.0.notes");
});
const $additionalsButton = $("#root_gatherings_0-additionals");
it("has additional fields button", async () => {
expect(await $additionalsButton.isDisplayed()).toBe(true);
});
describe("taxonCensus", () => {
it("can be added from additional fields", async () => {
await $additionalsButton.click();
const $$additionalListItems = $$(".dropdown.open li a");
await $$additionalListItems.last().click();
expect(await form.$locate("gatherings.0.taxonCensus").isDisplayed()).toBe(true);
await $additionalsButton.click();
expect(await $$additionalListItems.isPresent()).toBe(false);
});
it("can add items", async () => {
await form.$locateButton("gatherings.0.taxonCensus", "add").click();
});
it("added item is focused", async () => {
expect(await form.$getInputWidget("gatherings.0.taxonCensus.0.censusTaxonID").getAttribute("id")).toBe(await getFocusedId());
});
it("added item is displayed and can be edited", async () => {
await testWidget("gatherings.0.taxonCensus.0.censusTaxonID");
await testWidget("gatherings.0.taxonCensus.0.taxonCensusType", "enum");
});
it("second added item is focused", async () => {
await form.$locateButton("gatherings.0.taxonCensus", "add").click();
expect(await form.$getInputWidget("gatherings.0.taxonCensus.1.censusTaxonID").getAttribute("id")).toBe(await getFocusedId());
});
});
it("add button works", async () => {
await $gatheringAdd.click();
expect(await lajiFormLocate("gatherings.1").isDisplayed()).toBe(true);
await waitUntilBlockingLoaderHides();
});
it("map is empty for new gathering", async () => {
expect(await $gatheringsMap.$(".vector-marker.leaflet-interactive").isPresent()).toBe(false);
});
it("items can be deleted", async () => {
await $("#root_gatherings_1-delete").click();
await $("#root_gatherings_1-delete-confirm-yes").click();
expect(await lajiFormLocate("gatherings.1").isPresent()).toBe(false);
expect(await form.$locateAddition("gatherings.1", "header").isPresent()).toBe(false);
});
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
expect(await lajiFormLocate("gatherings").isDisplayed()).toBe(true);
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
expect(await lajiFormLocate("gatherings.0").isPresent()).toBe(false);
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
expect(await $gatheringsMap.isDisplayed()).toBe(true);
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
await putForeignMarkerToMap();
expect(await lajiFormLocate("gatherings.0").isDisplayed()).toBe(true);
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
() => {
it("starts and finishes after adding gathering", async () => {
if (await lajiFormLocate("gatherings.0.country").isPresent()) {
return;
}
const $loadingGeocoderButton = $(".geocoder-btn .react-spinner");
if (await $loadingGeocoderButton.isPresent()) {
await browser.wait(protractor.ExpectedConditions.invisibilityOf($loadingGeocoderButton), 6000, "Geocoding timeout");
}
expect(await $loadingGeocoderButton.isPresent()).toBe(false);
});
if (!googleApiKey) {
pending("Google API key missing");
}
it("adds country which is editable", async () => {
await testWidget("gatherings.0.country");
});
it("adds administrativeProvince which is editable", async () => {
await testWidget("gatherings.0.administrativeProvince");
});
it("adds municipality which is editable", async () => {
await testWidget("gatherings.0.municipality");
});
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
if (await lajiFormLocate("gatherings.0.country").isPresent()) {
return;
}
const $loadingGeocoderButton = $(".geocoder-btn .react-spinner");
if (await $loadingGeocoderButton.isPresent()) {
await browser.wait(protractor.ExpectedConditions.invisibilityOf($loadingGeocoderButton), 6000, "Geocoding timeout");
}
expect(await $loadingGeocoderButton.isPresent()).toBe(false);
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
await testWidget("gatherings.0.country");
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
await testWidget("gatherings.0.administrativeProvince");
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
await testWidget("gatherings.0.municipality");
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
await testWidget("gatherings.0.locality");
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
await testWidget("gatherings.0.localityDescription");
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
await testWidget("gatherings.0.weather");
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
await testWidget("gatherings.0.notes");
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
expect(await $additionalsButton.isDisplayed()).toBe(true);
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
() => {
it("can be added from additional fields", async () => {
await $additionalsButton.click();
const $$additionalListItems = $$(".dropdown.open li a");
await $$additionalListItems.last().click();
expect(await form.$locate("gatherings.0.taxonCensus").isDisplayed()).toBe(true);
await $additionalsButton.click();
expect(await $$additionalListItems.isPresent()).toBe(false);
});
it("can add items", async () => {
await form.$locateButton("gatherings.0.taxonCensus", "add").click();
});
it("added item is focused", async () => {
expect(await form.$getInputWidget("gatherings.0.taxonCensus.0.censusTaxonID").getAttribute("id")).toBe(await getFocusedId());
});
it("added item is displayed and can be edited", async () => {
await testWidget("gatherings.0.taxonCensus.0.censusTaxonID");
await testWidget("gatherings.0.taxonCensus.0.taxonCensusType", "enum");
});
it("second added item is focused", async () => {
await form.$locateButton("gatherings.0.taxonCensus", "add").click();
expect(await form.$getInputWidget("gatherings.0.taxonCensus.1.censusTaxonID").getAttribute("id")).toBe(await getFocusedId());
});
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
await $additionalsButton.click();
const $$additionalListItems = $$(".dropdown.open li a");
await $$additionalListItems.last().click();
expect(await form.$locate("gatherings.0.taxonCensus").isDisplayed()).toBe(true);
await $additionalsButton.click();
expect(await $$additionalListItems.isPresent()).toBe(false);
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
await form.$locateButton("gatherings.0.taxonCensus", "add").click();
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
expect(await form.$getInputWidget("gatherings.0.taxonCensus.0.censusTaxonID").getAttribute("id")).toBe(await getFocusedId());
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
await testWidget("gatherings.0.taxonCensus.0.censusTaxonID");
await testWidget("gatherings.0.taxonCensus.0.taxonCensusType", "enum");
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
await form.$locateButton("gatherings.0.taxonCensus", "add").click();
expect(await form.$getInputWidget("gatherings.0.taxonCensus.1.censusTaxonID").getAttribute("id")).toBe(await getFocusedId());
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
await $gatheringAdd.click();
expect(await lajiFormLocate("gatherings.1").isDisplayed()).toBe(true);
await waitUntilBlockingLoaderHides();
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
expect(await $gatheringsMap.$(".vector-marker.leaflet-interactive").isPresent()).toBe(false);
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
await $("#root_gatherings_1-delete").click();
await $("#root_gatherings_1-delete-confirm-yes").click();
expect(await lajiFormLocate("gatherings.1").isPresent()).toBe(false);
expect(await form.$locateAddition("gatherings.1", "header").isPresent()).toBe(false);
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
expect(await lajiFormLocate("gatherings.0.units").isDisplayed()).toBe(true);
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
expect(await lajiFormLocate("gatherings.0.units.0").isDisplayed()).toBe(true);
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
await $unitAdd.click();
expect(await lajiFormLocate("gatherings.0.units.1").isDisplayed()).toBe(true);
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
expect(await form.$getInputWidget("gatherings.0.units.1.identifications.0.taxon").getAttribute("id")).toBe(await getFocusedId());
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
expect(await lajiFormLocate("gatherings.0.units.0").getTagName()).toBe("tr");
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
await lajiFormLocate("gatherings.0.units.0").click();
expect(await lajiFormLocate("gatherings.0.units.0").getTagName()).toBe("div");
expect(await lajiFormLocate("gatherings.0.units.1").getTagName()).toBe("tr");
await lajiFormLocate("gatherings.0.units.1").click();
expect(await lajiFormLocate("gatherings.0.units.1").getTagName()).toBe("div");
expect(await lajiFormLocate("gatherings.0.units.0").getTagName()).toBe("tr");
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
await removeUnit(0, 1);
expect(await lajiFormLocate("gatherings.0.units.1").isPresent()).toBe(false);
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
expect(await lajiFormLocate("gatherings.0.units.0").getTagName()).toBe("div");
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
expect(await lajiFormLocate("gatherings.0.units.0.identifications.0.taxon").isDisplayed()).toBe(true);
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
await testWidget("gatherings.0.units.0.count");
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
await testWidget("gatherings.0.units.0.notes");
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
await testWidget("gatherings.0.units.0.taxonConfidence", "enum");
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
await testWidget("gatherings.0.units.0.recordBasis", "enum");
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
expect(await lajiFormLocate("gatherings.0.units.0.images").isDisplayed()).toBe(true);
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
expect(await $additionalsButton.isDisplayed()).toBe(true);
const informalGroups = [1, 343, 232, 187];
let mocks = [];
for (let id of informalGroups) {
mocks.push(await form.setMockResponse(`/informal-taxon-groups/MVL.${id}`));
}
await $additionalsButton.click();
await browser.wait(protractor.ExpectedConditions.visibilityOf($modal), 5000, "Additionals modal waiting timeout");
expect(await $modal.$$(".list-group .react-spinner").get(1).isDisplayed()).toBe(true);
for (let idx in informalGroups) {
await mocks[idx].resolve({
"id": informalGroups[idx],
"name": "test"
});
}
await browser.wait(protractor.ExpectedConditions.invisibilityOf($modal.$(".list-group .react-spinner")), 5000, "Additionals group title spinner didn't hide");
expect(await $modal.$$(".list-group .react-spinner").count()).toBe(0);
expect(await $modal.$$(".list-group").get(1).$(".list-group-item strong").getText()).toBe("test");
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
expect(await lajiFormLocate("gatherings.0.units.0.identifications.0.det").isPresent()).toBe(false);
expect(await $additionalsButton.isDisplayed()).toBe(true);
const $firstGroup = $$(".scope-field-modal-item").first();
const getFieldCount = () => lajiFormLocate("gatherings.0.units.0").$$("input").count();
const fieldCount = await getFieldCount();
const $additionalItem = $firstGroup.all(by.css(".list-group-item")).get(1);
expect(await $modal.isDisplayed()).toBe(true);
expect(await $additionalItem.isDisplayed()).toBe(true);
await $additionalItem.click();
await $modal.$(".close").click();
expect(await $additionalItem.isPresent()).toBe(false);
expect(await await getFieldCount()).toBe(fieldCount + 1);
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
() => lajiFormLocate("gatherings.0.units.0").$$("input").count()
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
(gatheringIdx: number, unitIdx: number): ElementFinder => $(`#root_gatherings_${gatheringIdx}_units_${unitIdx}-location`)
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
expect(await $getLocationButtonFor(0, 0).isDisplayed()).toBe(true);
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
await clickLocationButtonAndAddLocation(0, 0);
expect(await $gatheringsMap.$$(".vector-marker.leaflet-interactive").count()).toBe(2);
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
expect(await $locationModalMap.isPresent()).toBe(false);
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
expect(await $$gatheringMarkerPaths.count()).toBe(2);
const firstFill = await $$gatheringMarkerPaths.first().getAttribute("fill");
const secondFill = await $$gatheringMarkerPaths.last().getAttribute("fill");
expect(await firstFill).not.toBe(secondFill);
}
|
luomus/laji-form
|
test/trip-report-spec.ts
|
TypeScript
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.