@spectrum-web-components/tray 0.3.0 → 0.3.3-express.9

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/tray",
3
- "version": "0.3.0",
3
+ "version": "0.3.3-express.9+abfee7409",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -44,19 +44,20 @@
44
44
  "lit-html"
45
45
  ],
46
46
  "dependencies": {
47
- "@spectrum-web-components/base": "^0.5.1",
48
- "@spectrum-web-components/modal": "^0.6.0",
49
- "@spectrum-web-components/shared": "^0.13.3",
50
- "@spectrum-web-components/underlay": "^0.8.2",
47
+ "@spectrum-web-components/base": "^0.5.2",
48
+ "@spectrum-web-components/modal": "^0.6.2-express.9+abfee7409",
49
+ "@spectrum-web-components/reactive-controllers": "^0.2.0",
50
+ "@spectrum-web-components/shared": "^0.13.4",
51
+ "@spectrum-web-components/underlay": "^0.8.4-express.9+abfee7409",
51
52
  "tslib": "^2.0.0"
52
53
  },
53
54
  "devDependencies": {
54
- "@spectrum-css/tray": "^1.0.13"
55
+ "@spectrum-css/tray": "^1.0.17"
55
56
  },
56
57
  "types": "./src/index.d.ts",
57
58
  "customElements": "custom-elements.json",
58
59
  "sideEffects": [
59
60
  "./sp-*.js"
60
61
  ],
61
- "gitHead": "f23b15ec952d7450272a8275524c905e028b4ddc"
62
+ "gitHead": "abfee740957976448a3e4cf90df17d6165f857d6"
62
63
  }
@@ -0,0 +1,15 @@
1
+ /*
2
+ Copyright 2020 Adobe. All rights reserved.
3
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License. You may obtain a copy
5
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+
7
+ Unless required by applicable law or agreed to in writing, software distributed under
8
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ OF ANY KIND, either express or implied. See the License for the specific language
10
+ governing permissions and limitations under the License.
11
+ */
12
+ import * as stories from '../stories/tray.stories.js';
13
+ import { regressVisuals } from '../../../test/visual/test.js';
14
+ regressVisuals('TrayStories', stories);
15
+ //# sourceMappingURL=tray.test-vrt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tray.test-vrt.js","sourceRoot":"","sources":["tray.test-vrt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,KAAK,OAAO,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,cAAc,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC","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 * as stories from '../stories/tray.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\n\nregressVisuals('TrayStories', stories);\n"]}
@@ -0,0 +1,60 @@
1
+ /*
2
+ Copyright 2020 Adobe. All rights reserved.
3
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License. You may obtain a copy
5
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+
7
+ Unless required by applicable law or agreed to in writing, software distributed under
8
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ OF ANY KIND, either express or implied. See the License for the specific language
10
+ governing permissions and limitations under the License.
11
+ */
12
+ import { elementUpdated, expect, fixture, html, nextFrame, oneEvent, } from '@open-wc/testing';
13
+ import '../sp-tray.js';
14
+ import '@spectrum-web-components/theme/sp-theme.js';
15
+ import '@spectrum-web-components/theme/src/themes.js';
16
+ describe('Tray', () => {
17
+ it('loads default tray accessibly', async () => {
18
+ const el = await fixture(html `
19
+ <sp-tray></sp-tray>
20
+ `);
21
+ await elementUpdated(el);
22
+ await expect(el).to.be.accessible();
23
+ });
24
+ it('focuses focusable light DOM element', async () => {
25
+ const el = await fixture(html `
26
+ <sp-tray open>
27
+ <div>
28
+ <a href="#">Test element</a>
29
+ </div>
30
+ </sp-tray>
31
+ `);
32
+ const anchor = el.querySelector('a');
33
+ await elementUpdated(el);
34
+ el.focus();
35
+ await elementUpdated(el);
36
+ expect(document.activeElement).to.equal(anchor);
37
+ });
38
+ it('closes', async () => {
39
+ const test = await fixture(html `
40
+ <sp-theme scale="medium" color="dark">
41
+ <sp-tray></sp-tray>
42
+ </sp-theme>
43
+ `);
44
+ const el = test.querySelector('sp-tray');
45
+ // Ensure closed styles are set before opening so that
46
+ // the `transitionend` event will be met below.
47
+ await nextFrame();
48
+ await nextFrame();
49
+ expect(el.open).to.be.false;
50
+ el.open = true;
51
+ await elementUpdated(el);
52
+ expect(el.open).to.be.true;
53
+ const closed = oneEvent(el, 'close');
54
+ const overlay = el.shadowRoot.querySelector('sp-underlay');
55
+ overlay.click();
56
+ await closed;
57
+ expect(el.open).to.be.false;
58
+ });
59
+ });
60
+ //# sourceMappingURL=tray.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tray.test.js","sourceRoot":"","sources":["tray.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,EACH,cAAc,EACd,MAAM,EACN,OAAO,EACP,IAAI,EACJ,SAAS,EACT,QAAQ,GACX,MAAM,kBAAkB,CAAC;AAE1B,OAAO,eAAe,CAAC;AAEvB,OAAO,4CAA4C,CAAC;AACpD,OAAO,8CAA8C,CAAC;AAEtD,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE;IAClB,EAAE,CAAC,+BAA+B,EAAE,KAAK,IAAI,E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,EAAE,EAAE,OAAO,CAAC,CAAC;QACrC,MAAM,OAAO,GAAG,EAAE,CAAC,UAAU,CAAC,aAAa,CACvC,aAAa,CACD,CAAC;QACjB,OAAO,CAAC,KAAK,EAAE,CAAC;QAChB,MAAM,MAAM,CAAC;QAEb,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC;IAChC,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC","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 {\n elementUpdated,\n expect,\n fixture,\n html,\n nextFrame,\n oneEvent,\n} from '@open-wc/testing';\n\nimport '../sp-tray.js';\nimport { Tray } from '..';\nimport '@spectrum-web-components/theme/sp-theme.js';\nimport '@spectrum-web-components/theme/src/themes.js';\n\ndescribe('Tray', () => {\n it('loads default tray accessibly', async () => {\n const el = await fixture<Tray>(\n html`\n <sp-tray></sp-tray>\n `\n );\n\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n });\n it('focuses focusable light DOM element', async () => {\n const el = await fixture<Tray>(\n html`\n <sp-tray open>\n <div>\n <a href=\"#\">Test element</a>\n </div>\n </sp-tray>\n `\n );\n const anchor = el.querySelector('a');\n await elementUpdated(el);\n\n el.focus();\n await elementUpdated(el);\n\n expect(document.activeElement).to.equal(anchor);\n });\n it('closes', async () => {\n const test = await fixture<HTMLElement>(\n html`\n <sp-theme scale=\"medium\" color=\"dark\">\n <sp-tray></sp-tray>\n </sp-theme>\n `\n );\n\n const el = test.querySelector('sp-tray') as Tray;\n // Ensure closed styles are set before opening so that\n // the `transitionend` event will be met below.\n await nextFrame();\n await nextFrame();\n expect(el.open).to.be.false;\n\n el.open = true;\n await elementUpdated(el);\n\n expect(el.open).to.be.true;\n const closed = oneEvent(el, 'close');\n const overlay = el.shadowRoot.querySelector(\n 'sp-underlay'\n ) as HTMLElement;\n overlay.click();\n await closed;\n\n expect(el.open).to.be.false;\n });\n});\n"]}