|
43 | 43 | <span id="dom-bind-dynamic" class$="[[dynamic]]">[[dynamic]]</span> |
44 | 44 | </template> |
45 | 45 |
|
| 46 | + <x-specificity></x-specificity> |
| 47 | + <x-specificity class="bar"></x-specificity> |
| 48 | + <div is="x-specificity-parent"> |
| 49 | + <div is="x-specificity-nested"></div> |
| 50 | + </div> |
| 51 | + <x-overriding></x-overriding> |
| 52 | + |
46 | 53 | <script> |
47 | 54 | suite('scoped-styling', function() { |
48 | 55 |
|
|
61 | 68 | test(':host, :host(...)', function() { |
62 | 69 | assertComputed(styled, '1px'); |
63 | 70 | assertComputed(styledWide, '2px'); |
64 | | - |
| 71 | + |
65 | 72 | }); |
66 | 73 |
|
67 | 74 | test(':host-context(...)', function() { |
|
210 | 217 |
|
211 | 218 | test('styles shimmed in registration order', function() { |
212 | 219 | var s$ = document.head.querySelectorAll('style[scope]'); |
213 | | - var expected = ['x-gchild', 'x-child2', 'x-styled', 'x-button', |
214 | | - 'x-mixed-case', 'x-mixed-case-button', 'x-dynamic-scope', 'x-dynamic-template']; |
| 220 | + var expected = ['x-gchild', 'x-child2', 'x-styled', 'x-button', 'x-mixed-case', |
| 221 | + 'x-mixed-case-button', 'x-dynamic-scope', 'x-dynamic-template', 'x-specificity', 'x-overriding', |
| 222 | + 'x-overriding-0', 'x-specificity-parent-0', 'x-specificity-nested-0']; |
215 | 223 | var actual = []; |
216 | 224 | for (var i=0; i<s$.length; i++) { |
217 | 225 | actual.push(s$[i].getAttribute('scope')); |
|
252 | 260 | x = document.createElement('button', 'x-mixed-case-button'); |
253 | 261 | document.body.appendChild(x); |
254 | 262 | assertComputed(x, '14px'); |
255 | | - |
| 263 | + }); |
| 264 | + |
| 265 | + test('specificity of :host selector with class', function() { |
| 266 | + assertComputed(document.querySelector('x-specificity'), '1px'); |
| 267 | + assertComputed(document.querySelector('x-specificity.bar'), '2px'); |
| 268 | + }); |
| 269 | + |
| 270 | + test('specificity of ::content > :not(template) selector', function() { |
| 271 | + assertComputed(document.querySelector('[is=x-specificity-nested]'), '10px'); |
| 272 | + }); |
| 273 | + |
| 274 | + test('overwriting mixin properties', function() { |
| 275 | + var root = document.querySelector('x-overriding'); |
| 276 | + assertComputed(root.querySelector('.red'), '1px'); |
| 277 | + assertComputed(root.querySelector('.green'), '2px'); |
| 278 | + assertComputed(root.querySelector('.red-2'), '1px'); |
| 279 | + assertComputed(root.querySelector('.blue'), '3px'); |
256 | 280 | }); |
257 | 281 | }); |
258 | | - |
| 282 | + |
259 | 283 | }); |
260 | 284 |
|
261 | 285 | </script> |
|
0 commit comments