@spectrum-web-components/theme 0.9.0 → 0.9.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.
@@ -1,152 +0,0 @@
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 '../sp-theme.js';
13
- import '../src/themes.js';
14
- import { Theme } from '../';
15
- import { elementUpdated, expect, fixture, html } from '@open-wc/testing';
16
- import { css } from '@spectrum-web-components/base';
17
- describe('Themes', () => {
18
- it('loads - light', async () => {
19
- const el = await fixture(html `
20
- <sp-theme color="light"></sp-theme>
21
- `);
22
- await elementUpdated(el);
23
- expect(el).to.exist;
24
- expect(el).shadowDom.to.exist;
25
- });
26
- it('loads - dark', async () => {
27
- const el = await fixture(html `
28
- <sp-theme color="dark"></sp-theme>
29
- `);
30
- await elementUpdated(el);
31
- expect(el).to.exist;
32
- expect(el).shadowDom.to.exist;
33
- });
34
- it('loads - unkown', async () => {
35
- const el = await fixture(html `
36
- <sp-theme color="unknown" scale="unknown"></sp-theme>
37
- `);
38
- await elementUpdated(el);
39
- expect(el).to.exist;
40
- expect(el).shadowDom.to.exist;
41
- });
42
- it('adds an instance only once', async () => {
43
- const el = await fixture(html `
44
- <sp-theme></sp-theme>
45
- `);
46
- await elementUpdated(el);
47
- const testableTheme = Theme;
48
- expect(testableTheme.instances.has(el), 'first').to.be.true;
49
- expect(testableTheme.instances.size).to.equal(1);
50
- el.remove();
51
- expect(testableTheme.instances.has(el), 'second').to.be.false;
52
- expect(testableTheme.instances.size).to.equal(0);
53
- document.body.append(el);
54
- expect(testableTheme.instances.has(el), 'third').to.be.true;
55
- expect(testableTheme.instances.size).to.equal(1);
56
- });
57
- });
58
- describe('Lightest', () => {
59
- it('loads', async () => {
60
- const el = await fixture(html `
61
- <sp-theme color="lightest"></sp-theme>
62
- `);
63
- await elementUpdated(el);
64
- expect(el).to.exist;
65
- expect(el).shadowDom.to.exist;
66
- });
67
- });
68
- describe('Medium', () => {
69
- it('loads', async () => {
70
- const el = await fixture(html `
71
- <sp-theme scale="medium"></sp-theme>
72
- `);
73
- await elementUpdated(el);
74
- expect(el).to.exist;
75
- expect(el).shadowDom.to.exist;
76
- });
77
- });
78
- describe('App styles', () => {
79
- it('applies app fragments', async () => {
80
- const el = await fixture(html `
81
- <sp-theme color="light">
82
- <style>
83
- div {
84
- padding: var(--app-padding);
85
- }
86
- </style>
87
- <div></div>
88
- </sp-theme>
89
- `);
90
- const div = el.querySelector('div');
91
- await elementUpdated(el);
92
- const preStylesDiv = getComputedStyle(div);
93
- expect(preStylesDiv.paddingBlockStart).to.equal('0px');
94
- Theme.registerThemeFragment('app', 'app', css `
95
- :host {
96
- --app-padding: 10px;
97
- }
98
- `);
99
- await elementUpdated(el);
100
- const postStylesDiv = getComputedStyle(div);
101
- expect(postStylesDiv.paddingBlockStart).to.equal('10px');
102
- Theme.themeFragmentsByKind.delete('app');
103
- });
104
- });
105
- describe('Setting attributes', () => {
106
- it('loads', async () => {
107
- const el = await fixture(html `
108
- <sp-theme color="light"></sp-theme>
109
- `);
110
- await elementUpdated(el);
111
- expect(el).to.not.be.undefined;
112
- expect(el.hasAttribute('scale')).to.be.false;
113
- if (el.shadowRoot.adoptedStyleSheets) {
114
- expect(el.shadowRoot.adoptedStyleSheets.length).to.equal(2);
115
- }
116
- else {
117
- expect([...el.shadowRoot.querySelectorAll('style')].length).to.equal(2);
118
- }
119
- await elementUpdated(el);
120
- // Invalid initial value falls back to default
121
- el.setAttribute('scale', 'fish');
122
- expect(el.getAttribute('scale')).to.equal('medium');
123
- if (el.shadowRoot.adoptedStyleSheets) {
124
- expect(el.shadowRoot.adoptedStyleSheets.length).to.equal(2);
125
- }
126
- else {
127
- expect([...el.shadowRoot.querySelectorAll('style')].length).to.equal(2);
128
- }
129
- el.color = 'dark';
130
- el.scale = 'medium';
131
- await elementUpdated(el);
132
- expect(el.getAttribute('color')).to.equal('dark');
133
- expect(el.getAttribute('scale')).to.equal('medium');
134
- if (el.shadowRoot.adoptedStyleSheets) {
135
- expect(el.shadowRoot.adoptedStyleSheets.length, 'all').to.equal(3);
136
- }
137
- else {
138
- expect([...el.shadowRoot.querySelectorAll('style')].length).to.equal(3);
139
- }
140
- // Invalid second + value fallsback to previous
141
- el.setAttribute('color', 'fish');
142
- await elementUpdated(el);
143
- expect(el.getAttribute('color')).to.equal('dark');
144
- if (el.shadowRoot.adoptedStyleSheets) {
145
- expect(el.shadowRoot.adoptedStyleSheets.length, 'last').to.equal(3);
146
- }
147
- else {
148
- expect([...el.shadowRoot.querySelectorAll('style')].length).to.equal(3);
149
- }
150
- });
151
- });
152
- //# sourceMappingURL=themes.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"themes.test.js","sourceRoot":"","sources":["themes.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,gBAAgB,CAAC;AACxB,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAoB,MAAM,KAAK,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAE,GAAG,EAAE,MAAM,+BAA+B,CAAC;AAOpD,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;IACpB,EAAE,CAAC,eAAe,EAAE,KAAK,IAAI,EAAE;QAC3B,MAAM,EAAE,GAAG,MAAM,OAAO,CACpB,IAAI,CAAA;;aAEH,CACJ,CAAC;QAEF,MAAM,cAAc,CAAC,EAAE,CAAC,CAAC;QAEzB,MA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C,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAClD,MAAM,CAAC,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAEpD,IAAI,EAAE,CAAC,UAAU,CAAC,kBAAkB,EAAE;YAClC,MAAM,CAAC,EAAE,CAAC,UAAU,CAAC,kBAAkB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SACtE;aAAM;YACH,MAAM,CACF,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CACtD,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SACjB;QAED,+CAA+C;QAC/C,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAEjC,MAAM,cAAc,CAAC,EAAE,CAAC,CAAC;QACzB,MAAM,CAAC,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAElD,IAAI,EAAE,CAAC,UAAU,CAAC,kBAAkB,EAAE;YAClC,MAAM,CAAC,EAAE,CAAC,UAAU,CAAC,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SACvE;aAAM;YACH,MAAM,CACF,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CACtD,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SACjB;IACL,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 '../sp-theme.js';\nimport '../src/themes.js';\nimport { Theme, ThemeFragmentMap } from '../';\nimport { elementUpdated, expect, fixture, html } from '@open-wc/testing';\nimport { css } from '@spectrum-web-components/base';\n\ntype TestableThemeConstructor = {\n instances: Set<Theme>;\n themeFragmentsByKind: ThemeFragmentMap;\n};\n\ndescribe('Themes', () => {\n it('loads - light', async () => {\n const el = await fixture<Theme>(\n html`\n <sp-theme color=\"light\"></sp-theme>\n `\n );\n\n await elementUpdated(el);\n\n expect(el).to.exist;\n expect(el).shadowDom.to.exist;\n });\n it('loads - dark', async () => {\n const el = await fixture<Theme>(\n html`\n <sp-theme color=\"dark\"></sp-theme>\n `\n );\n\n await elementUpdated(el);\n\n expect(el).to.exist;\n expect(el).shadowDom.to.exist;\n });\n it('loads - unkown', async () => {\n const el = await fixture<Theme>(\n html`\n <sp-theme color=\"unknown\" scale=\"unknown\"></sp-theme>\n `\n );\n\n await elementUpdated(el);\n\n expect(el).to.exist;\n expect(el).shadowDom.to.exist;\n });\n it('adds an instance only once', async () => {\n const el = await fixture<Theme>(\n html`\n <sp-theme></sp-theme>\n `\n );\n\n await elementUpdated(el);\n const testableTheme = Theme as unknown as TestableThemeConstructor;\n expect(testableTheme.instances.has(el), 'first').to.be.true;\n expect(testableTheme.instances.size).to.equal(1);\n\n el.remove();\n expect(testableTheme.instances.has(el), 'second').to.be.false;\n expect(testableTheme.instances.size).to.equal(0);\n\n document.body.append(el);\n expect(testableTheme.instances.has(el), 'third').to.be.true;\n expect(testableTheme.instances.size).to.equal(1);\n });\n});\n\ndescribe('Lightest', () => {\n it('loads', async () => {\n const el = await fixture<Theme>(\n html`\n <sp-theme color=\"lightest\"></sp-theme>\n `\n );\n\n await elementUpdated(el);\n\n expect(el).to.exist;\n expect(el).shadowDom.to.exist;\n });\n});\n\ndescribe('Medium', () => {\n it('loads', async () => {\n const el = await fixture<Theme>(\n html`\n <sp-theme scale=\"medium\"></sp-theme>\n `\n );\n\n await elementUpdated(el);\n\n expect(el).to.exist;\n expect(el).shadowDom.to.exist;\n });\n});\n\ndescribe('App styles', () => {\n it('applies app fragments', async () => {\n const el = await fixture<Theme>(\n html`\n <sp-theme color=\"light\">\n <style>\n div {\n padding: var(--app-padding);\n }\n </style>\n <div></div>\n </sp-theme>\n `\n );\n const div = el.querySelector('div') as HTMLDivElement;\n\n await elementUpdated(el);\n\n const preStylesDiv = getComputedStyle(div);\n expect(preStylesDiv.paddingBlockStart).to.equal('0px');\n\n Theme.registerThemeFragment(\n 'app',\n 'app',\n css`\n :host {\n --app-padding: 10px;\n }\n `\n );\n await elementUpdated(el);\n\n const postStylesDiv = getComputedStyle(div);\n expect(postStylesDiv.paddingBlockStart).to.equal('10px');\n\n (\n Theme as unknown as TestableThemeConstructor\n ).themeFragmentsByKind.delete('app');\n });\n});\n\ndescribe('Setting attributes', () => {\n it('loads', async () => {\n const el = await fixture<Theme>(\n html`\n <sp-theme color=\"light\"></sp-theme>\n `\n );\n\n await elementUpdated(el);\n\n expect(el).to.not.be.undefined;\n expect(el.hasAttribute('scale')).to.be.false;\n\n if (el.shadowRoot.adoptedStyleSheets) {\n expect(el.shadowRoot.adoptedStyleSheets.length).to.equal(2);\n } else {\n expect(\n [...el.shadowRoot.querySelectorAll('style')].length\n ).to.equal(2);\n }\n\n await elementUpdated(el);\n\n // Invalid initial value falls back to default\n el.setAttribute('scale', 'fish');\n expect(el.getAttribute('scale')).to.equal('medium');\n\n if (el.shadowRoot.adoptedStyleSheets) {\n expect(el.shadowRoot.adoptedStyleSheets.length).to.equal(2);\n } else {\n expect(\n [...el.shadowRoot.querySelectorAll('style')].length\n ).to.equal(2);\n }\n\n el.color = 'dark';\n el.scale = 'medium';\n\n await elementUpdated(el);\n expect(el.getAttribute('color')).to.equal('dark');\n expect(el.getAttribute('scale')).to.equal('medium');\n\n if (el.shadowRoot.adoptedStyleSheets) {\n expect(el.shadowRoot.adoptedStyleSheets.length, 'all').to.equal(3);\n } else {\n expect(\n [...el.shadowRoot.querySelectorAll('style')].length\n ).to.equal(3);\n }\n\n // Invalid second + value fallsback to previous\n el.setAttribute('color', 'fish');\n\n await elementUpdated(el);\n expect(el.getAttribute('color')).to.equal('dark');\n\n if (el.shadowRoot.adoptedStyleSheets) {\n expect(el.shadowRoot.adoptedStyleSheets.length, 'last').to.equal(3);\n } else {\n expect(\n [...el.shadowRoot.querySelectorAll('style')].length\n ).to.equal(3);\n }\n });\n});\n"]}