1
0
Fork 0

Made test more stable

This commit is contained in:
Ava Wroten 2020-03-15 16:34:34 -05:00
parent 3530bb84c4
commit 1481bed98d

View file

@ -1,7 +1,7 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
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';
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 });
});
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) {
await render(hbs`<MealList />`);
let element = find('[data-test-id=meal-list-wrapper]')
await element.focus();
await settled();
let element = find('[data-test-id=meal-list-wrapper]');
await triggerEvent(element, 'focus');
await click('[data-test-id=sort-down]');
assert.dom(findAll('[data-test-id=meal-name]')[0]).includesText('Meal 2');