@eagami/ui 5.90.0 → 5.90.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -101,7 +101,7 @@ Pass `version` and `onReport` to log how each reload turned out, and check `isSt
101
101
 
102
102
  ## Testing
103
103
 
104
- `<ea-dialog>` and `<ea-drawer>` are built on the native `<dialog>` element, and `@eagami/ui/testing` keeps them working in jsdom, which lacks `showModal()` and `close()`. Call `installNativeDialogShim()` once from your test setup file:
104
+ `<ea-dialog>` and `<ea-drawer>` are built on the native `<dialog>` element, and `@eagami/ui/testing` keeps them working in jsdom, which lacks `showModal()`, `close()` and `getAnimations()`. Call `installNativeDialogShim()` once from your test setup file:
105
105
 
106
106
  ```ts
107
107
  import { installNativeDialogShim } from '@eagami/ui/testing';
@@ -13,6 +13,7 @@ function installNativeDialogShim() {
13
13
  this.open = false;
14
14
  this.dispatchEvent(new Event("close"));
15
15
  };
16
+ if (typeof Element.prototype.getAnimations !== "function") Element.prototype.getAnimations = () => [];
16
17
  }
17
18
  export { installNativeDialogShim };
18
19
 
@@ -1 +1 @@
1
- {"version":3,"file":"eagami-ui-testing.mjs","names":[],"sources":["../../../testing/src/native-dialog.ts"],"sourcesContent":["/**\n * Fills in the native `<dialog>` methods jsdom leaves unimplemented, so a spec\n * can create a component that opens an `ea-dialog` or `ea-drawer` without the\n * test runner throwing on `showModal()` or `close()`. Call once from the test\n * setup file. Only missing methods are patched, so a runtime that implements\n * the element keeps its own behavior.\n */\nexport function installNativeDialogShim(): void {\n if (typeof HTMLDialogElement === 'undefined') {\n return;\n }\n const proto = HTMLDialogElement.prototype;\n if (typeof proto.show !== 'function') {\n proto.show = function (this: HTMLDialogElement): void {\n this.open = true;\n };\n }\n if (typeof proto.showModal !== 'function') {\n proto.showModal = function (this: HTMLDialogElement): void {\n this.open = true;\n };\n }\n if (typeof proto.close !== 'function') {\n proto.close = function (this: HTMLDialogElement, returnValue?: string): void {\n if (!this.open) {\n return;\n }\n if (returnValue !== undefined) {\n this.returnValue = returnValue;\n }\n this.open = false;\n this.dispatchEvent(new Event('close'));\n };\n }\n}\n"],"mappings":"AAOA,SAAgB,0BAAuB;CACrC,IAAI,OAAO,sBAAsB,aAC/B;CAEF,MAAM,QAAQ,kBAAkB;CAChC,IAAI,OAAO,MAAM,SAAS,YACxB,MAAM,OAAO,WAAA;EACX,KAAK,OAAO;CACd;CAEF,IAAI,OAAO,MAAM,cAAc,YAC7B,MAAM,YAAY,WAAA;EAChB,KAAK,OAAO;CACd;CAEF,IAAI,OAAO,MAAM,UAAU,YACzB,MAAM,QAAQ,SAAmC,aAAoB;EACnE,IAAI,CAAC,KAAK,MACR;EAEF,IAAI,gBAAgB,QAClB,KAAK,cAAc;EAErB,KAAK,OAAO;EACZ,KAAK,cAAc,IAAI,MAAM,OAAO,CAAC;CACvC;AAEJ"}
1
+ {"version":3,"file":"eagami-ui-testing.mjs","names":[],"sources":["../../../testing/src/native-dialog.ts"],"sourcesContent":["/**\n * Fills in the native `<dialog>` methods jsdom leaves unimplemented, and the\n * `Element.getAnimations()` an `ea-drawer` reads to follow its slide out, so a\n * spec can create a component that opens an `ea-dialog` or `ea-drawer` without\n * the test runner throwing on `showModal()`, `close()` or a drawer closing.\n * Call once from the test setup file. Only missing methods are patched, so a\n * runtime that implements them keeps its own behavior.\n */\nexport function installNativeDialogShim(): void {\n if (typeof HTMLDialogElement === 'undefined') {\n return;\n }\n const proto = HTMLDialogElement.prototype;\n if (typeof proto.show !== 'function') {\n proto.show = function (this: HTMLDialogElement): void {\n this.open = true;\n };\n }\n if (typeof proto.showModal !== 'function') {\n proto.showModal = function (this: HTMLDialogElement): void {\n this.open = true;\n };\n }\n if (typeof proto.close !== 'function') {\n proto.close = function (this: HTMLDialogElement, returnValue?: string): void {\n if (!this.open) {\n return;\n }\n if (returnValue !== undefined) {\n this.returnValue = returnValue;\n }\n this.open = false;\n this.dispatchEvent(new Event('close'));\n };\n }\n // With no layout engine nothing ever transitions, which an empty list says\n if (typeof Element.prototype.getAnimations !== 'function') {\n Element.prototype.getAnimations = (): Animation[] => [];\n }\n}\n"],"mappings":"AAQA,SAAgB,0BAAuB;CACrC,IAAI,OAAO,sBAAsB,aAC/B;CAEF,MAAM,QAAQ,kBAAkB;CAChC,IAAI,OAAO,MAAM,SAAS,YACxB,MAAM,OAAO,WAAA;EACX,KAAK,OAAO;CACd;CAEF,IAAI,OAAO,MAAM,cAAc,YAC7B,MAAM,YAAY,WAAA;EAChB,KAAK,OAAO;CACd;CAEF,IAAI,OAAO,MAAM,UAAU,YACzB,MAAM,QAAQ,SAAmC,aAAoB;EACnE,IAAI,CAAC,KAAK,MACR;EAEF,IAAI,gBAAgB,QAClB,KAAK,cAAc;EAErB,KAAK,OAAO;EACZ,KAAK,cAAc,IAAI,MAAM,OAAO,CAAC;CACvC;CAGF,IAAI,OAAO,QAAQ,UAAU,kBAAkB,YAC7C,QAAQ,UAAU,sBAAmC,CAAA;AAEzD"}