Skip to content

Commit

Permalink
Get FireFox tests passing 100% (previously, there was one failure)
Browse files Browse the repository at this point in the history
  • Loading branch information
NullVoxPopuli committed Aug 15, 2024
1 parent 9c99e6f commit 33a0619
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
5 changes: 4 additions & 1 deletion test-app/tests/helpers/browser-detect.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
export const isEdge = navigator.userAgent.indexOf('Edge') >= 0;

// Unlike Chrome, Firefox emits `selectionchange` events.
// Firefox emits `selectionchange` events.
export const isFirefox = navigator.userAgent.indexOf('Firefox') >= 0;

// Chrome emits `selectionchange` events.
export const isChrome = navigator.userAgent.indexOf('Chrome') >= 0;
9 changes: 1 addition & 8 deletions test-app/tests/unit/dom/click-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,14 +200,7 @@ module('DOM Helper: click', function (hooks) {
});

module('focusable element types', function () {
let clickSteps = [
'mousedown',
'focus',
'focusin',
'selectionchange',
'mouseup',
'click',
];
let clickSteps = ['mousedown', 'focus', 'focusin', 'mouseup', 'click'];

test('clicking a input via selector with context set', async function (assert) {
element = buildInstrumentedElement('input');
Expand Down
6 changes: 3 additions & 3 deletions test-app/tests/unit/dom/fill-in-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { module, test } from 'qunit';
import { fillIn, setupContext, teardownContext } from '@ember/test-helpers';
import { buildInstrumentedElement, insertElement } from '../../helpers/events';
import { isFirefox } from '../../helpers/browser-detect';
import { isFirefox, isChrome } from '../../helpers/browser-detect';
import hasEmberVersion from '@ember/test-helpers/has-ember-version';
import {
registerHooks,
Expand All @@ -12,7 +12,7 @@ import { createDescriptor } from 'dom-element-descriptors';

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

if (isFirefox) {
if (isFirefox || isChrome) {
clickSteps.push('selectionchange');
}

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

assert.verifySteps(clickSteps);
assert.verifySteps(['focus', 'focusin', 'input', 'change']);
assert.strictEqual(
document.activeElement,
element,
Expand Down

0 comments on commit 33a0619

Please sign in to comment.