本文整理汇总了TypeScript中@ember/test-helpers.find函数的典型用法代码示例。如果您正苦于以下问题:TypeScript find函数的具体用法?TypeScript find怎么用?TypeScript find使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了find函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: test
test('property rendering', async function(assert) {
const time = new Date().getTime();
const actor = 'John Appleseed';
const title = 'Last Modified';
this.set('time', time);
this.set('actor', actor);
this.set('title', title);
await render(hbs`{{last-saved-by time=time actor=actor}}`);
assert.ok(this.element.textContent!.includes(moment(time).fromNow()), 'it shows the last saved time from now');
assert.ok(this.element.textContent!.includes(actor), 'it shows the actor attribute');
await render(hbs`{{last-saved-by time=time title=title}}`);
assert.ok(this.element.textContent!.includes('Last Modified'), 'it shows the passed in title');
assert.ok(!this.element.textContent!.includes('Last Saved:'), 'it does not show the default title');
await render(hbs`
{{#last-saved-by time=time title=title actor=actor as |ls|}}
<div class="yielded-title">{{ls.title}}</div>
<div class="yielded-actor">{{ls.actor}}</div>
{{/last-saved-by}}
`);
assert.equal(find('.yielded-title')!.textContent!.trim(), title, 'block usage yields the title');
assert.equal(find('.yielded-actor')!.textContent!.trim(), actor, 'block usage yields the actor');
});
示例2: test
test('DOM interactions', async () => {
await render(hbs`<div class="message">Hello, world</div>`);
await click('.message');
await doubleClick('.message');
await tap('.message');
await focus('.message');
await blur('.message');
await triggerEvent('.message', 'custom-event');
await triggerKeyEvent('.message', 'keydown', 'Enter', { ctrlKey: true });
await fillIn('.message', 'content');
const messageElement = find('.message')!;
await click(messageElement);
await doubleClick(messageElement);
await tap(messageElement);
await focus(messageElement);
await blur(messageElement);
await triggerEvent(messageElement, 'custom-event');
await triggerKeyEvent(messageElement, 'keydown', 'Enter', { ctrlKey: true });
await fillIn(messageElement, 'content');
await typeIn(messageElement, 'content');
const allMessages = findAll('.message');
for (const element of allMessages) {
await click(element);
}
const root = getRootElement();
await click(root);
});
示例3: visit
@test public async 'visiting /injection-factories'(assert: Assert) {
await visit('/injection-factories');
assert.equal(currentURL(), '/injection-factories', 'Test page loads');
const view = find('.mike-view');
assert.ok(view, '.mike-view found');
if (!view) { throw new Error(''); }
const viewId = view.id;
assert.ok(getViewById.call(this, viewId).get('resizeService'), 'resizeService has been injected onto views');
const component = find('.test-component');
assert.ok(component, '.test-component found');
if (!component) { throw new Error(''); }
const componentId = component.id;
// tslint:disable-next-line:max-line-length
assert.ok(getViewById.call(this, componentId).get('resizeService'), 'resizeService has been injected onto components');
}
示例4: visit
@test async 'visiting /'(assert: Assert) {
await visit('/');
assert.equal(currentURL(), '/');
const codeElement: Element | null = find('.index-view code');
if (codeElement === null) { throw new Error('no <code>'); }
assert.ok(/min\-width:\s[0-9]+px/.test('' + codeElement.textContent), 'min-width text found');
}
示例5: test
test('toggle action shows and hides dropdown', async function(assert) {
assert.expect(3);
this.set('urn', nonHdfsUrn);
await render(hbs`
{{datasets/dataset-fabric-switcher urn=urn}}
`);
assert.notOk(find(contentSelector), 'expected dropdown content class is hidden');
await triggerEvent(triggerSelector, 'mouseenter');
assert.ok(find(contentSelector), 'expected dropdown content class is shown');
await triggerEvent(triggerSelector, 'mouseleave');
assert.notOk(find(contentSelector), 'expected dropdown content class is hidden');
});
示例6:
isDisabled: () => !!find('[data-test-chat-submit][disabled]'),
示例7: test
test('an image tag is present', function(assert) {
const img = find('img');
assert.ok(img, 'the html tag is present');
assert.equal(img!.getAttribute('alt'), 'Thumbnail', 'has alt text');
});
示例8: find
toastText: () => find(toast)!.textContent,