|
831 | 831 | </script>
|
832 | 832 | </dom-module>
|
833 | 833 |
|
| 834 | +<dom-module id="root-styles"> |
| 835 | + <template> |
| 836 | + <style> |
| 837 | + :root { |
| 838 | + --root-border: 2px solid black; |
| 839 | + } |
| 840 | + :host > * { |
| 841 | + --host-star-border: 10px solid orange; |
| 842 | + } |
| 843 | + #root { |
| 844 | + border: var(--root-border); |
| 845 | + } |
| 846 | + #host { |
| 847 | + border: var(--host-star-border); |
| 848 | + } |
| 849 | + </style> |
| 850 | + <div id="root"></div> |
| 851 | + <div id="host"></div> |
| 852 | + </template> |
| 853 | + <script> |
| 854 | + HTMLImports.whenReady(function() { |
| 855 | + Polymer({is: 'root-styles'}); |
| 856 | + }); |
| 857 | + </script> |
| 858 | +</dom-module> |
| 859 | + |
834 | 860 | <script>
|
835 | 861 | suite('scoped-styling-var', function() {
|
836 | 862 |
|
|
1073 | 1099 | assertComputed(x.$.child, '6px');
|
1074 | 1100 | });
|
1075 | 1101 |
|
1076 |
| - |
1077 |
| - |
1078 | 1102 | test('styles update based on root customStyle changes', function() {
|
1079 | 1103 | assertComputed(styled.$.dynamic, '0px');
|
1080 | 1104 | Polymer.StyleDefaults.customStyle['--dynamic'] = '4px solid navy';
|
|
1234 | 1258 | e.updateStyles();
|
1235 | 1259 | assertComputed(e, 'rgb(255, 0, 0)', null, 'background-color');
|
1236 | 1260 | });
|
| 1261 | + |
1237 | 1262 | test('updateStyles removes the correct number of style properties', function() {
|
1238 | 1263 | if (!Polymer.Settings.useNativeCSSProperties) {
|
1239 | 1264 | this.skip();
|
|
1274 | 1299 | CustomElements.takeRecords();
|
1275 | 1300 | assertComputed(e.$.child, '5px');
|
1276 | 1301 | });
|
| 1302 | + |
| 1303 | + test(':root and :host > * rules apply to all shadowroot children', function() { |
| 1304 | + var e = document.createElement('root-styles'); |
| 1305 | + document.body.appendChild(e); |
| 1306 | + CustomElements.takeRecords(); |
| 1307 | + assertComputed(e.$.root, '2px'); |
| 1308 | + assertComputed(e.$.host, '10px'); |
| 1309 | + }); |
1277 | 1310 | });
|
1278 | 1311 |
|
1279 | 1312 | </script>
|
|
0 commit comments