Skip to content

Commit

Permalink
test(karma): remove unnecessary IE11-related code (#5054)
Browse files Browse the repository at this point in the history
  • Loading branch information
nolanlawson authored Dec 17, 2024
1 parent 5d1837b commit 158f7e6
Showing 1 changed file with 9 additions and 22 deletions.
Original file line number Diff line number Diff line change
@@ -1,25 +1,12 @@
// IE11 doesn't support FocusEvent constructor
// https://developer.mozilla.org/en-US/docs/Web/API/FocusEvent/FocusEvent#Browser_compatibility
function isFocusEventConstructorSupported() {
try {
new FocusEvent();
return true;
} catch (_error) {
return false;
}
}

describe.runIf(isFocusEventConstructorSupported())('FocusEvent constructor supported', () => {
it('should set composed to false by default', () => {
const focusEvent = new FocusEvent('focus');
expect(focusEvent.composed).toBe(false);
});
it('should set composed to false by default', () => {
const focusEvent = new FocusEvent('focus');
expect(focusEvent.composed).toBe(false);
});

it('should set composed to the value specified in the option', () => {
const composedEvt = new FocusEvent('focus', { composed: true });
expect(composedEvt.composed).toBe(true);
it('should set composed to the value specified in the option', () => {
const composedEvt = new FocusEvent('focus', { composed: true });
expect(composedEvt.composed).toBe(true);

const nonComposedEvt = new FocusEvent('focus', { composed: false });
expect(nonComposedEvt.composed).toBe(false);
});
const nonComposedEvt = new FocusEvent('focus', { composed: false });
expect(nonComposedEvt.composed).toBe(false);
});

0 comments on commit 158f7e6

Please sign in to comment.