Made test more stable
This commit is contained in:
parent
3530bb84c4
commit
1481bed98d
1 changed files with 3 additions and 12 deletions
|
@ -1,7 +1,7 @@
|
||||||
import { module, test } from 'qunit';
|
import { module, test } from 'qunit';
|
||||||
import { setupRenderingTest } from 'ember-qunit';
|
import { setupRenderingTest } from 'ember-qunit';
|
||||||
import { setupMirage } from 'ember-cli-mirage/test-support';
|
import { setupMirage } from 'ember-cli-mirage/test-support';
|
||||||
import { render, find, findAll, click, settled } from '@ember/test-helpers';
|
import { render, find, findAll, click, triggerEvent } from '@ember/test-helpers';
|
||||||
import { hbs } from 'ember-cli-htmlbars';
|
import { hbs } from 'ember-cli-htmlbars';
|
||||||
|
|
||||||
module('Integration | Component | meal-list', function(hooks) {
|
module('Integration | Component | meal-list', function(hooks) {
|
||||||
|
@ -16,19 +16,10 @@ module('Integration | Component | meal-list', function(hooks) {
|
||||||
assert.dom('[data-test-id=meal-item]').exists({ count: 2 });
|
assert.dom('[data-test-id=meal-item]').exists({ count: 2 });
|
||||||
});
|
});
|
||||||
|
|
||||||
test('it can focus list wrapper', async function(assert) {
|
|
||||||
await render(hbs`<MealList />`);
|
|
||||||
let element = find('[data-test-id=meal-list-wrapper]')
|
|
||||||
await element.focus();
|
|
||||||
|
|
||||||
assert.equal(element, document.activeElement);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('it can reorder items via sort up/down links', async function(assert) {
|
test('it can reorder items via sort up/down links', async function(assert) {
|
||||||
await render(hbs`<MealList />`);
|
await render(hbs`<MealList />`);
|
||||||
let element = find('[data-test-id=meal-list-wrapper]')
|
let element = find('[data-test-id=meal-list-wrapper]');
|
||||||
await element.focus();
|
await triggerEvent(element, 'focus');
|
||||||
await settled();
|
|
||||||
await click('[data-test-id=sort-down]');
|
await click('[data-test-id=sort-down]');
|
||||||
|
|
||||||
assert.dom(findAll('[data-test-id=meal-name]')[0]).includesText('Meal 2');
|
assert.dom(findAll('[data-test-id=meal-name]')[0]).includesText('Meal 2');
|
||||||
|
|
Loading…
Add table
Reference in a new issue