|
88 | 88 | @host {
|
89 | 89 | * {
|
90 | 90 | padding: 20px;
|
| 91 | + border-top-color: brown; |
91 | 92 | }
|
92 | 93 | }
|
93 | 94 | </style>
|
94 | 95 | <shadow></shadow>
|
95 | 96 | <div>padding: 20px</div>
|
96 | 97 | </template>
|
97 | 98 |
|
| 99 | + <template id="x-zim2"> |
| 100 | + <style> |
| 101 | + @host { |
| 102 | + * { |
| 103 | + padding: 20px; |
| 104 | + } |
| 105 | + } |
| 106 | + </style> |
| 107 | + <div>padding: 20px</div> |
| 108 | + </template> |
98 | 109 |
|
99 | 110 | <script>
|
100 | 111 | XFoo = register('x-foo', '', HTMLElement.prototype, ['x-foo']);
|
101 | 112 | XBar = register('x-bar', 'x-foo', XFoo.prototype, ['x-foo', 'x-bar']);
|
102 | 113 | XZot = register('x-zot', 'x-bar', XBar.prototype, ['x-foo', 'x-bar', 'x-zot']);
|
103 | 114 | XZim = register('x-zim', 'x-zot', XZot.prototype, ['x-foo', 'x-bar', 'x-zot', 'x-zim']);
|
| 115 | + XZim2 = register('x-zim2', 'x-zot', XZot.prototype, ['x-foo', 'x-bar', 'x-zot', 'x-zim2']); |
104 | 116 | register('x-scope', '', HTMLElement.prototype, ['x-scope']);
|
105 | 117 | register('x-button', '', HTMLButtonElement.prototype, ['x-button']);
|
106 | 118 | </script>
|
@@ -128,6 +140,9 @@ <h4>Expected: red background with black text and orange border</h4>
|
128 | 140 |
|
129 | 141 | <h4>Expected: red background with black text and orange border and 20px padding</h4>
|
130 | 142 | <x-zim></x-zim>
|
| 143 | + |
| 144 | + <h4>Expected: 20px padding</h4> |
| 145 | + <x-zim2></x-zim2> |
131 | 146 |
|
132 | 147 | <script>
|
133 | 148 | document.addEventListener('WebComponentsReady', function() {
|
@@ -168,18 +183,32 @@ <h4>Expected: red background with black text and orange border and 20px padding<
|
168 | 183 | chai.assert.equal(zimStyle.backgroundColor, 'rgb(255, 0, 0)',
|
169 | 184 | '@host styles are inherited (backgroundColor)');
|
170 | 185 |
|
171 |
| - chai.assert.equal(zimStyle.borderTopColor, 'rgb(255, 165, 0)', |
| 186 | + chai.assert.equal(zimStyle.borderTopColor, 'rgb(165, 42, 42)', |
172 | 187 | '@host styles are combined with inherited @host styles (borderTopColor)');
|
173 | 188 | chai.assert.equal(zimStyle.borderBottomColor, 'rgb(255, 165, 0)',
|
174 | 189 | '@host styles are combined with inherited @host styles (borderBottomColor)');
|
175 | 190 | chai.assert.equal(zimStyle.color, 'rgb(0, 0, 0)',
|
176 | 191 | '@host styles are applied to given selector (color)');
|
177 | 192 | chai.assert.equal(zimStyle.paddingTop, '20px',
|
178 | 193 | '@host styles are loaded via external sheet in import (paddingTop)');
|
179 |
| - chai.assert.equal(zimStyle.paddingLeft, '20px', |
| 194 | + chai.assert.equal(zimStyle.paddingLeft, '20px', |
180 | 195 | '@host styles are loaded via external sheet in import (paddingLeft)');
|
181 | 196 | zim.offsetHeight;
|
| 197 | + |
| 198 | + var zim2 = document.querySelector('x-zim2'); |
| 199 | + var zimStyle2 = getComputedStyle(zim2); |
| 200 | + chai.assert.equal(zimStyle2.borderTopColor, 'rgb(0, 0, 0)', |
| 201 | + '@host styles are not combined without <shadow> (borderTopColor)'); |
| 202 | + chai.assert.equal(zimStyle2.borderBottomColor, 'rgb(0, 0, 0)', |
| 203 | + '@host styles are not combined without <shadow> (borderBottomColor)'); |
| 204 | + chai.assert.equal(zimStyle2.paddingTop, '20px', |
| 205 | + '@host styles are loaded via external sheet in import (paddingTop)'); |
| 206 | + chai.assert.equal(zimStyle2.paddingLeft, '20px', |
| 207 | + '@host styles are loaded via external sheet in import (paddingLeft)'); |
| 208 | + |
182 | 209 | done();
|
| 210 | + |
| 211 | + |
183 | 212 | });
|
184 | 213 | </script>
|
185 | 214 | </body>
|
|
0 commit comments