@spectrum-web-components/reactive-controllers 0.36.0 → 0.38.0
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectrum-web-components/reactive-controllers",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.38.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -79,5 +79,5 @@
|
|
|
79
79
|
"sideEffects": [
|
|
80
80
|
"./**/*.dev.js"
|
|
81
81
|
],
|
|
82
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "9a099b7543672f2fd4030833ab813b16c2cad62e"
|
|
83
83
|
}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { html, LitElement } from "lit";
|
|
3
3
|
import { elementUpdated, expect, fixture } from "@open-wc/testing";
|
|
4
4
|
import { ElementResolutionController } from "@spectrum-web-components/reactive-controllers/src/ElementResolution.js";
|
|
5
|
-
describe("
|
|
6
|
-
it("responds to
|
|
5
|
+
describe("Element Resolution", () => {
|
|
6
|
+
it("responds to DOM changes", async () => {
|
|
7
7
|
class TestEl extends LitElement {
|
|
8
8
|
}
|
|
9
9
|
if (!customElements.get("test-element-resolution-el")) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["element-resolution.test.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2022 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { html, LitElement } from 'lit';\nimport { elementUpdated, expect, fixture } from '@open-wc/testing';\nimport { ElementResolutionController } from '@spectrum-web-components/reactive-controllers/src/ElementResolution.js';\n\ndescribe('
|
|
5
|
-
"mappings": ";AAYA,SAAS,MAAM,kBAAkB;AACjC,SAAS,gBAAgB,QAAQ,eAAe;AAChD,SAAS,mCAAmC;AAE5C,SAAS,
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2022 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { html, LitElement } from 'lit';\nimport { elementUpdated, expect, fixture } from '@open-wc/testing';\nimport { ElementResolutionController } from '@spectrum-web-components/reactive-controllers/src/ElementResolution.js';\n\ndescribe('Element Resolution', () => {\n it('responds to DOM changes', async () => {\n class TestEl extends LitElement {}\n if (!customElements.get('test-element-resolution-el')) {\n customElements.define('test-element-resolution-el', TestEl);\n }\n const test = await fixture(\n html`\n <div>\n <test-element-resolution-el></test-element-resolution-el>\n <div class=\"target\" id=\"one\"></div>\n <div class=\"target\" id=\"two\"></div>\n </div>\n `\n );\n const el = test.querySelector('test-element-resolution-el') as TestEl;\n const target1 = test.querySelector('#one') as HTMLDivElement;\n const target2 = test.querySelector('#two') as HTMLDivElement;\n const controller = new ElementResolutionController(el as LitElement);\n expect(controller.element).to.be.null;\n controller.selector = '.target';\n await elementUpdated(el);\n expect(controller.element === target1).to.be.true;\n test.insertAdjacentElement('afterbegin', target2);\n await elementUpdated(el);\n expect(controller.element === target2).to.be.true;\n target2.setAttribute('class', 'not-target');\n await elementUpdated(el);\n expect(controller.element === target1).to.be.true;\n target2.setAttribute('class', 'target');\n await elementUpdated(el);\n expect(controller.element === target2).to.be.true;\n });\n});\n"],
|
|
5
|
+
"mappings": ";AAYA,SAAS,MAAM,kBAAkB;AACjC,SAAS,gBAAgB,QAAQ,eAAe;AAChD,SAAS,mCAAmC;AAE5C,SAAS,sBAAsB,MAAM;AACjC,KAAG,2BAA2B,YAAY;AAAA,IACtC,MAAM,eAAe,WAAW;AAAA,IAAC;AACjC,QAAI,CAAC,eAAe,IAAI,4BAA4B,GAAG;AACnD,qBAAe,OAAO,8BAA8B,MAAM;AAAA,IAC9D;AACA,UAAM,OAAO,MAAM;AAAA,MACf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOJ;AACA,UAAM,KAAK,KAAK,cAAc,4BAA4B;AAC1D,UAAM,UAAU,KAAK,cAAc,MAAM;AACzC,UAAM,UAAU,KAAK,cAAc,MAAM;AACzC,UAAM,aAAa,IAAI,4BAA4B,EAAgB;AACnE,WAAO,WAAW,OAAO,EAAE,GAAG,GAAG;AACjC,eAAW,WAAW;AACtB,UAAM,eAAe,EAAE;AACvB,WAAO,WAAW,YAAY,OAAO,EAAE,GAAG,GAAG;AAC7C,SAAK,sBAAsB,cAAc,OAAO;AAChD,UAAM,eAAe,EAAE;AACvB,WAAO,WAAW,YAAY,OAAO,EAAE,GAAG,GAAG;AAC7C,YAAQ,aAAa,SAAS,YAAY;AAC1C,UAAM,eAAe,EAAE;AACvB,WAAO,WAAW,YAAY,OAAO,EAAE,GAAG,GAAG;AAC7C,YAAQ,aAAa,SAAS,QAAQ;AACtC,UAAM,eAAe,EAAE;AACvB,WAAO,WAAW,YAAY,OAAO,EAAE,GAAG,GAAG;AAAA,EACjD,CAAC;AACL,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/test/match-media.test.js
CHANGED
|
@@ -3,11 +3,11 @@ import { html, LitElement } from "lit";
|
|
|
3
3
|
import { expect, fixture, nextFrame } from "@open-wc/testing";
|
|
4
4
|
import { setViewport } from "@web/test-runner-commands";
|
|
5
5
|
import { MatchMediaController } from "@spectrum-web-components/reactive-controllers/src/MatchMedia.js";
|
|
6
|
+
class TestEl extends LitElement {
|
|
7
|
+
}
|
|
8
|
+
customElements.define("test-match-media-el", TestEl);
|
|
6
9
|
describe("Match Media", () => {
|
|
7
10
|
it("responds to media changes", async () => {
|
|
8
|
-
class TestEl extends LitElement {
|
|
9
|
-
}
|
|
10
|
-
customElements.define("test-match-media-el", TestEl);
|
|
11
11
|
const el = await fixture(
|
|
12
12
|
html`
|
|
13
13
|
<test-match-media-el></test-match-media-el>
|
|
@@ -17,9 +17,12 @@ describe("Match Media", () => {
|
|
|
17
17
|
el,
|
|
18
18
|
"(min-width: 500px)"
|
|
19
19
|
);
|
|
20
|
+
await nextFrame();
|
|
21
|
+
await nextFrame();
|
|
20
22
|
expect(controller.matches).to.be.true;
|
|
21
23
|
await setViewport({ width: 360, height: 640 });
|
|
22
24
|
await nextFrame();
|
|
25
|
+
await nextFrame();
|
|
23
26
|
expect(controller.matches).to.be.false;
|
|
24
27
|
});
|
|
25
28
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["match-media.test.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { html, LitElement } from 'lit';\nimport { expect, fixture, nextFrame } from '@open-wc/testing';\nimport { setViewport } from '@web/test-runner-commands';\nimport { MatchMediaController } from '@spectrum-web-components/reactive-controllers/src/MatchMedia.js';\n\ndescribe('Match Media', () => {\n it('responds to media changes', async () => {\n
|
|
5
|
-
"mappings": ";AAYA,SAAS,MAAM,kBAAkB;AACjC,SAAS,QAAQ,SAAS,iBAAiB;AAC3C,SAAS,mBAAmB;AAC5B,SAAS,4BAA4B;AAErC,
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { html, LitElement } from 'lit';\nimport { expect, fixture, nextFrame } from '@open-wc/testing';\nimport { setViewport } from '@web/test-runner-commands';\nimport { MatchMediaController } from '@spectrum-web-components/reactive-controllers/src/MatchMedia.js';\n\nclass TestEl extends LitElement {}\ncustomElements.define('test-match-media-el', TestEl);\n\ndescribe('Match Media', () => {\n it('responds to media changes', async () => {\n const el = await fixture(\n html`\n <test-match-media-el></test-match-media-el>\n `\n );\n const controller = new MatchMediaController(\n el as LitElement & { shadowRoot: ShadowRoot },\n '(min-width: 500px)'\n );\n // Allow Controller to initialize\n await nextFrame();\n await nextFrame();\n expect(controller.matches).to.be.true;\n\n await setViewport({ width: 360, height: 640 });\n // Allow viewport update to propagate.\n await nextFrame();\n await nextFrame();\n expect(controller.matches).to.be.false;\n });\n});\n"],
|
|
5
|
+
"mappings": ";AAYA,SAAS,MAAM,kBAAkB;AACjC,SAAS,QAAQ,SAAS,iBAAiB;AAC3C,SAAS,mBAAmB;AAC5B,SAAS,4BAA4B;AAErC,MAAM,eAAe,WAAW;AAAC;AACjC,eAAe,OAAO,uBAAuB,MAAM;AAEnD,SAAS,eAAe,MAAM;AAC1B,KAAG,6BAA6B,YAAY;AACxC,UAAM,KAAK,MAAM;AAAA,MACb;AAAA;AAAA;AAAA,IAGJ;AACA,UAAM,aAAa,IAAI;AAAA,MACnB;AAAA,MACA;AAAA,IACJ;AAEA,UAAM,UAAU;AAChB,UAAM,UAAU;AAChB,WAAO,WAAW,OAAO,EAAE,GAAG,GAAG;AAEjC,UAAM,YAAY,EAAE,OAAO,KAAK,QAAQ,IAAI,CAAC;AAE7C,UAAM,UAAU;AAChB,UAAM,UAAU;AAChB,WAAO,WAAW,OAAO,EAAE,GAAG,GAAG;AAAA,EACrC,CAAC;AACL,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|