@spectrum-web-components/toast 0.10.14-devmode.7 → 0.10.15-devmode2.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/custom-elements.json +4 -4
- package/package.json +8 -7
- package/test/toast.test.js +7 -1
- package/test/toast.test.js.map +2 -2
package/custom-elements.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"modules": [
|
|
5
5
|
{
|
|
6
6
|
"kind": "javascript-module",
|
|
7
|
-
"path": "sp-toast.
|
|
7
|
+
"path": "sp-toast.js",
|
|
8
8
|
"declarations": [],
|
|
9
9
|
"exports": [
|
|
10
10
|
{
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
"kind": "javascript-module",
|
|
22
|
-
"path": "src/Toast.
|
|
22
|
+
"path": "src/Toast.js",
|
|
23
23
|
"declarations": [
|
|
24
24
|
{
|
|
25
25
|
"kind": "variable",
|
|
@@ -271,7 +271,7 @@
|
|
|
271
271
|
"name": "toastVariants",
|
|
272
272
|
"declaration": {
|
|
273
273
|
"name": "toastVariants",
|
|
274
|
-
"module": "src/Toast.
|
|
274
|
+
"module": "src/Toast.js"
|
|
275
275
|
}
|
|
276
276
|
},
|
|
277
277
|
{
|
|
@@ -279,7 +279,7 @@
|
|
|
279
279
|
"name": "Toast",
|
|
280
280
|
"declaration": {
|
|
281
281
|
"name": "Toast",
|
|
282
|
-
"module": "src/Toast.
|
|
282
|
+
"module": "src/Toast.js"
|
|
283
283
|
}
|
|
284
284
|
}
|
|
285
285
|
]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectrum-web-components/toast",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.15-devmode2.0+326762c24",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -57,10 +57,10 @@
|
|
|
57
57
|
"lit-html"
|
|
58
58
|
],
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@spectrum-web-components/base": "^0.
|
|
61
|
-
"@spectrum-web-components/button": "^0.18.
|
|
62
|
-
"@spectrum-web-components/icon": "^0.11.
|
|
63
|
-
"@spectrum-web-components/icons-workflow": "^0.8.
|
|
60
|
+
"@spectrum-web-components/base": "^0.6.1-devmode2.0+326762c24",
|
|
61
|
+
"@spectrum-web-components/button": "^0.18.2-devmode2.0+326762c24",
|
|
62
|
+
"@spectrum-web-components/icon": "^0.11.13-devmode2.0+326762c24",
|
|
63
|
+
"@spectrum-web-components/icons-workflow": "^0.8.13-devmode2.0+326762c24",
|
|
64
64
|
"tslib": "^2.0.0"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
@@ -69,7 +69,8 @@
|
|
|
69
69
|
"types": "./src/index.d.ts",
|
|
70
70
|
"customElements": "custom-elements.json",
|
|
71
71
|
"sideEffects": [
|
|
72
|
-
"./sp-*.js"
|
|
72
|
+
"./sp-*.js",
|
|
73
|
+
"./**/*.dev.js"
|
|
73
74
|
],
|
|
74
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "326762c247bed8ab37e40a3ab1a47da83e1ace2b"
|
|
75
76
|
}
|
package/test/toast.test.js
CHANGED
|
@@ -8,9 +8,15 @@ import {
|
|
|
8
8
|
nextFrame,
|
|
9
9
|
waitUntil
|
|
10
10
|
} from "@open-wc/testing";
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
testForLitDevWarnings,
|
|
13
|
+
waitForPredicate
|
|
14
|
+
} from "../../../test/testing-helpers.js";
|
|
12
15
|
import { spy } from "sinon";
|
|
13
16
|
describe("Toast", () => {
|
|
17
|
+
testForLitDevWarnings(async () => await fixture(html`
|
|
18
|
+
<sp-toast open>Help text.</sp-toast>
|
|
19
|
+
`));
|
|
14
20
|
it("loads", async () => {
|
|
15
21
|
const el = await fixture(html`
|
|
16
22
|
<sp-toast open>Help text.</sp-toast>
|
package/test/toast.test.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["toast.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 '@spectrum-web-components/toast/sp-toast.js';\nimport { Toast, toastVariants } from '@spectrum-web-components/toast';\nimport {\n elementUpdated,\n expect,\n fixture,\n html,\n nextFrame,\n waitUntil,\n} from '@open-wc/testing';\nimport { CloseButton } from '@spectrum-web-components/button';\nimport {
|
|
5
|
-
"mappings": "AAYA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA;
|
|
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 '@spectrum-web-components/toast/sp-toast.js';\nimport { Toast, toastVariants } from '@spectrum-web-components/toast';\nimport {\n elementUpdated,\n expect,\n fixture,\n html,\n nextFrame,\n waitUntil,\n} from '@open-wc/testing';\nimport { CloseButton } from '@spectrum-web-components/button';\nimport {\n testForLitDevWarnings,\n waitForPredicate,\n} from '../../../test/testing-helpers.js';\nimport { spy } from 'sinon';\n\ninterface TestableToast {\n _timeout: number;\n countdownStart: number;\n}\n\ndescribe('Toast', () => {\n testForLitDevWarnings(\n async () =>\n await fixture<Toast>(\n html`\n <sp-toast open>Help text.</sp-toast>\n `\n )\n );\n it('loads', async () => {\n const el = await fixture<Toast>(\n html`\n <sp-toast open>Help text.</sp-toast>\n `\n );\n\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n });\n toastVariants.map((variant) => {\n it(`loads - [variant=\"${variant}\"]`, async () => {\n const el = await fixture<Toast>(\n html`\n <sp-toast variant=${variant} open>\n This toast is of the \\`${variant}\\` variant.\n </sp-toast>\n `\n );\n\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n });\n });\n it('loads - timeout', async () => {\n const el = await fixture<Toast>(\n html`\n <sp-toast timeout=\"100\">Help text.</sp-toast>\n `\n );\n\n await elementUpdated(el);\n expect(el.open).to.be.false;\n\n (el as unknown as TestableToast)._timeout = 100;\n el.open = true;\n await elementUpdated(el);\n\n await waitForPredicate(() => el.open === false);\n expect(el.open).to.be.false;\n });\n it('`timeout` updates `countdownStart`', async () => {\n const el = await fixture<Toast>(\n html`\n <sp-toast timeout=\"100\">Help text.</sp-toast>\n `\n );\n\n await elementUpdated(el);\n expect(el.open).to.be.false;\n\n const testableEl = el as unknown as TestableToast;\n testableEl._timeout = 100;\n el.open = true;\n await elementUpdated(el);\n\n const firstStart = testableEl.countdownStart;\n\n await nextFrame();\n await nextFrame();\n await nextFrame();\n\n el.timeout = 400;\n\n await elementUpdated(el);\n const secondStart = testableEl.countdownStart;\n\n expect(secondStart).to.not.equal(firstStart);\n\n await nextFrame();\n await nextFrame();\n\n el.timeout = 0;\n\n await elementUpdated(el);\n const thirdStart = testableEl.countdownStart;\n\n expect(thirdStart).to.equal(0);\n });\n it('stops timeout on `focusin`', async () => {\n const el = await fixture<Toast>(\n html`\n <sp-toast timeout=\"100\">Help text.</sp-toast>\n `\n );\n\n await elementUpdated(el);\n\n const testableEl = el as unknown as TestableToast;\n expect(el.open, 'not open to start').to.be.false;\n\n el.open = true;\n await elementUpdated(el);\n await nextFrame();\n\n expect(testableEl.countdownStart, 'initially not 0').to.not.equal(0);\n\n testableEl._timeout = 100;\n\n el.dispatchEvent(new FocusEvent('focusin'));\n\n await elementUpdated(el);\n expect(testableEl.countdownStart, '0 after focusin').to.equal(0);\n el.dispatchEvent(new FocusEvent('focusout'));\n\n await elementUpdated(el);\n await nextFrame();\n expect(testableEl.countdownStart, 'not 0 after focusout').to.not.equal(\n 0\n );\n\n await waitUntil(() => el.open === false, 'closes');\n expect(el.open, 'not open to end').to.be.false;\n });\n it('closes', async () => {\n const el = await fixture<Toast>(\n html`\n <sp-toast open>Help text.</sp-toast>\n `\n );\n\n await elementUpdated(el);\n expect(el.open).to.be.true;\n\n const renderRoot = el.shadowRoot ? el.shadowRoot : el;\n const closeButton = renderRoot.querySelector(\n 'sp-close-button'\n ) as CloseButton;\n closeButton.click();\n\n await elementUpdated(el);\n expect(el.open).to.be.false;\n });\n it('`close` can be prevented', async () => {\n const handleClose = (event: CustomEvent): void =>\n event.preventDefault();\n const el = await fixture<Toast>(\n html`\n <sp-toast open timeout=\"100\" @close=${handleClose}>\n Help text.\n </sp-toast>\n `\n );\n\n await elementUpdated(el);\n expect(el.open).to.be.true;\n\n const renderRoot = el.shadowRoot ? el.shadowRoot : el;\n const closeButton = renderRoot.querySelector(\n 'sp-close-button'\n ) as CloseButton;\n closeButton.click();\n\n await elementUpdated(el);\n expect(el.open).to.be.true;\n });\n it('can be a controlled element', async () => {\n const closeSpy = spy();\n const handleClose = (event: CustomEvent): void => {\n event.preventDefault();\n closeSpy();\n };\n const el = await fixture<Toast>(\n html`\n <sp-toast open timeout=\"100\" @close=${handleClose}>\n Help text.\n </sp-toast>\n `\n );\n\n await elementUpdated(el);\n expect(el.open).to.be.true;\n expect(closeSpy.callCount).to.equal(0);\n\n const renderRoot = el.shadowRoot ? el.shadowRoot : el;\n const closeButton = renderRoot.querySelector(\n 'sp-close-button'\n ) as CloseButton;\n closeButton.click();\n\n await elementUpdated(el);\n expect(el.open).to.be.true;\n expect(closeSpy.callCount).to.equal(1);\n\n el.open = false;\n await elementUpdated(el);\n expect(el.open).to.be.false;\n expect(closeSpy.callCount).to.equal(1);\n });\n it('validates variants', async () => {\n const el = await fixture<Toast>(\n html`\n <sp-toast variant=\"invalid\" open>\n This toast validates variants.\n </sp-toast>\n `\n );\n\n await elementUpdated(el);\n expect(el.variant).to.equal('');\n\n el.variant = toastVariants[0];\n\n await elementUpdated(el);\n expect(el.variant).to.equal(toastVariants[0]);\n\n el.variant = toastVariants[0];\n\n await elementUpdated(el);\n expect(el.variant).to.equal(toastVariants[0]);\n });\n it('maintains [variant] when disconnected/connected', async () => {\n const el = await fixture<Toast>(\n html`\n <sp-toast variant=\"positive\" open>\n This toast maintains variants.\n </sp-toast>\n `\n );\n\n await elementUpdated(el);\n expect(el.variant).to.equal('positive');\n const parent = el.parentElement as HTMLElement;\n\n el.remove();\n\n expect(el.variant).to.equal('positive');\n\n parent.append(el);\n\n expect(el.variant).to.equal('positive');\n });\n it('reopens', async () => {\n const closeSpy = spy();\n const el = await fixture<Toast>(\n html`\n <sp-toast\n variant=\"positive\"\n open\n @close=${() => {\n closeSpy();\n }}\n >\n This toast maintains variants.\n </sp-toast>\n `\n );\n\n await elementUpdated(el);\n expect(el.open).to.be.true;\n\n const closeButton = el.shadowRoot.querySelector(\n 'sp-close-button'\n ) as HTMLElement;\n closeButton.click();\n\n await elementUpdated(el);\n expect(el.open).to.be.false;\n\n el.open = true;\n\n await elementUpdated(el);\n expect(el.open).to.be.true;\n expect(closeSpy.callCount).to.equal(1);\n });\n});\n"],
|
|
5
|
+
"mappings": "AAYA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA;AAAA;AAAA;AAAA;AAIA;AAOA,SAAS,SAAS,MAAM;AACpB,wBACI,YACI,MAAM,QACF;AAAA;AAAA,iBAGJ,CACR;AACA,KAAG,SAAS,YA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