Skip to content

Commit

Permalink
test(fillIn): account for selectionchange in Firefox
Browse files Browse the repository at this point in the history
  • Loading branch information
buschtoens committed Feb 27, 2022
1 parent 9d8843d commit 4a62d25
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tests/unit/dom/fill-in-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ import {
_registerHook,
} from '@ember/test-helpers';
import { buildInstrumentedElement, insertElement } from '../../helpers/events';
import { isIE11 } from '../../helpers/browser-detect';
import { isIE11, isFirefox } from '../../helpers/browser-detect';
import hasEmberVersion from '@ember/test-helpers/has-ember-version';

let clickSteps = ['focus', 'focusin', 'input', 'change'];

if (isIE11) {
clickSteps = ['focusin', 'input', 'change', 'focus'];
} else if (isFirefox) {
clickSteps.push('selectionchange');
}

module('DOM Helper: fillIn', function (hooks) {
Expand Down Expand Up @@ -226,7 +228,8 @@ module('DOM Helper: fillIn', function (hooks) {
await setupContext(context);
await fillIn(element, 'foo');

assert.verifySteps(clickSteps);
// For this specific case, Firefox does not emit `selectionchange`.
assert.verifySteps(clickSteps.filter((s) => s !== 'selectionchange'));
assert.strictEqual(
document.activeElement,
element,
Expand Down Expand Up @@ -255,7 +258,8 @@ module('DOM Helper: fillIn', function (hooks) {
await setupContext(context);
await fillIn(`#${element.id}`, '');

assert.verifySteps(clickSteps);
// For this specific case, Firefox does not emit `selectionchange`.
assert.verifySteps(clickSteps.filter((s) => s !== 'selectionchange'));
assert.strictEqual(
document.activeElement,
element,
Expand Down

0 comments on commit 4a62d25

Please sign in to comment.