feat(core): remove unused keyboardEventShimIE test helper
This commit is contained in:
parent
2b583ee750
commit
495cb0c500
5 changed files with 6 additions and 53 deletions
6
.changeset/chilly-poets-march.md
Normal file
6
.changeset/chilly-poets-march.md
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
'@lion/core': minor
|
||||
'@lion/calendar': minor
|
||||
---
|
||||
|
||||
Remove keyboardEventShimIE test helper
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
import { html } from '@lion/core';
|
||||
import '@lion/core/test-helpers';
|
||||
import { localize } from '@lion/localize';
|
||||
import { localizeTearDown } from '@lion/localize/test-helpers';
|
||||
import { expect, fixture as _fixture } from '@open-wc/testing';
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@
|
|||
"docs",
|
||||
"src",
|
||||
"test",
|
||||
"test-helpers",
|
||||
"translations",
|
||||
"types"
|
||||
],
|
||||
|
|
@ -48,7 +47,6 @@
|
|||
},
|
||||
"exports": {
|
||||
".": "./index.js",
|
||||
"./test-helpers": "./test-helpers/index.js",
|
||||
"./closestPolyfill": "./src/closestPolyfill.js",
|
||||
"./docs/*": "./docs/*"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
export * from './keyboardEventShimIE.js';
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
if (typeof window.KeyboardEvent !== 'function') {
|
||||
// e.g. is IE and needs "polyfill"
|
||||
const KeyboardEvent = (event, _params) => {
|
||||
// current spec for it https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/KeyboardEvent
|
||||
const params = {
|
||||
bubbles: false,
|
||||
cancelable: false,
|
||||
view: document.defaultView,
|
||||
key: false,
|
||||
location: false,
|
||||
ctrlKey: false,
|
||||
shiftKey: false,
|
||||
altKey: false,
|
||||
metaKey: false,
|
||||
repeat: false,
|
||||
..._params,
|
||||
};
|
||||
const modifiersListArray = [];
|
||||
if (params.ctrlKey) {
|
||||
modifiersListArray.push('Control');
|
||||
}
|
||||
if (params.shiftKey) {
|
||||
modifiersListArray.push('Shift');
|
||||
}
|
||||
if (params.altKey) {
|
||||
modifiersListArray.push('Alt');
|
||||
}
|
||||
if (params.metaKey) {
|
||||
modifiersListArray.push('Meta');
|
||||
}
|
||||
|
||||
const ev = document.createEvent('KeyboardEvent');
|
||||
// IE Spec for it https://technet.microsoft.com/en-us/windows/ff975297(v=vs.60)
|
||||
ev.initKeyboardEvent(
|
||||
event,
|
||||
params.bubbles,
|
||||
params.cancelable,
|
||||
params.view,
|
||||
params.key,
|
||||
params.location,
|
||||
modifiersListArray.join(' '),
|
||||
params.repeat ? 1 : 0,
|
||||
params.locale,
|
||||
);
|
||||
return ev;
|
||||
};
|
||||
KeyboardEvent.prototype = window.Event.prototype;
|
||||
window.KeyboardEvent = KeyboardEvent;
|
||||
}
|
||||
Loading…
Reference in a new issue