|
269 | 269 | </script>
|
270 | 270 | </dom-module>
|
271 | 271 |
|
| 272 | + <dom-module id="x-var-produce-via-consume"> |
| 273 | + <template> |
| 274 | + <style> |
| 275 | + :host { |
| 276 | + display: block; |
| 277 | + border: 10px solid orange; |
| 278 | + --foo: { |
| 279 | + color: var(--bar); |
| 280 | + } |
| 281 | + } |
| 282 | + </style> |
| 283 | + </template> |
| 284 | + <script> |
| 285 | + HTMLImports.whenReady(function() { |
| 286 | + Polymer({ |
| 287 | + is: 'x-var-produce-via-consume' |
| 288 | + }); |
| 289 | + }); |
| 290 | + </script> |
| 291 | +</dom-module> |
| 292 | + |
272 | 293 |
|
273 | 294 | <script>
|
274 | 295 | suite('scoped-styling-apply', function() {
|
|
361 | 382 | });
|
362 | 383 | });
|
363 | 384 |
|
| 385 | + test('producing a var that consumes another var preserves static styling', function() { |
| 386 | + var d = document.createElement('x-var-produce-via-consume'); |
| 387 | + document.body.appendChild(d); |
| 388 | + CustomElements.takeRecords(); |
| 389 | + assertComputed(d, '10px'); |
| 390 | + }); |
| 391 | + |
| 392 | + test('producing a var that consumes results in static and not dynamic stylesheet', function() { |
| 393 | + var d = document.createElement('x-var-produce-via-consume'); |
| 394 | + document.body.appendChild(d); |
| 395 | + CustomElements.takeRecords(); |
| 396 | + var styleRoot = d.shadowRoot ? d.shadowRoot : document.head; |
| 397 | + var staticStyle = styleRoot.querySelector('style[scope=x-var-produce-via-consume]'); |
| 398 | + assert.ok(staticStyle); |
| 399 | + assert.match(staticStyle.textContent, /display/, 'static style does not contain style content'); |
| 400 | + assert.equal(styleRoot.querySelectorAll('style[scope~=x-var-produce-via-consume]').length, 1); |
| 401 | + }); |
| 402 | + |
364 | 403 | // TODO(sorvell): fix for #1761 was reverted; include test once this issue is addressed
|
365 |
| - // test('mixin values can be overridden by subsequent concrete properties', function() { |
366 |
| - // assertComputed(styled.$.override, '19px'); |
367 |
| - // }); |
| 404 | + test('mixin values can be overridden by subsequent concrete properties', function() { |
| 405 | + assertComputed(styled.$.override, '19px'); |
| 406 | + }); |
368 | 407 | });
|
369 | 408 |
|
370 | 409 | </script>
|
|
0 commit comments