|
533 | 533 | }
|
534 | 534 | </style>
|
535 | 535 |
|
| 536 | +<dom-module id="x-apply-depend-before-create"> |
| 537 | + <template> |
| 538 | + <style> |
| 539 | + :host { |
| 540 | + @apply --before-create; |
| 541 | + } |
| 542 | + </style> |
| 543 | + </template> |
| 544 | + <script> |
| 545 | + HTMLImports.whenReady(function() { |
| 546 | + Polymer({ |
| 547 | + is: 'x-apply-depend-before-create' |
| 548 | + }) |
| 549 | + }) |
| 550 | + </script> |
| 551 | +</dom-module> |
| 552 | + |
| 553 | +<dom-module id="x-create-after-apply"> |
| 554 | + <template> |
| 555 | + <style> |
| 556 | + :host { |
| 557 | + --before-create: { |
| 558 | + border: 2px solid green; |
| 559 | + }; |
| 560 | + } |
| 561 | + </style> |
| 562 | + <x-apply-depend-before-create id="child"></x-apply-depend-before-create> |
| 563 | + </template> |
| 564 | + <script> |
| 565 | + HTMLImports.whenReady(function() { |
| 566 | + Polymer({ |
| 567 | + is: 'x-create-after-apply' |
| 568 | + }) |
| 569 | + }) |
| 570 | + </script> |
| 571 | +</dom-module> |
| 572 | + |
| 573 | +<dom-module id="x-reuse-mixin-name-for-variable"> |
| 574 | + <template> |
| 575 | + <style> |
| 576 | + :host { |
| 577 | + /* --foo is used above as a mixin for color */ |
| 578 | + --foo: 20px solid blue; |
| 579 | + /* this looks suspiciously like defining a mixin from another mixin */ |
| 580 | + --color: var(--foo); |
| 581 | + border: var(--color); |
| 582 | + } |
| 583 | + </style> |
| 584 | + </template> |
| 585 | + <script> |
| 586 | + HTMLImports.whenReady(function() { |
| 587 | + Polymer({ |
| 588 | + is: 'x-reuse-mixin-name-for-variable' |
| 589 | + }) |
| 590 | + }); |
| 591 | + </script> |
| 592 | +</dom-module> |
| 593 | + |
536 | 594 | <script>
|
537 | 595 | suite('scoped-styling-apply', function() {
|
538 | 596 | function assertComputed(element, value, property) {
|
|
736 | 794 | assert.equal(parent2Text, parent3Text, 'x-produce-mixin-3 should not have invalidated x-consume-mixin');
|
737 | 795 | }
|
738 | 796 | });
|
| 797 | + |
| 798 | + test('mixins can be depended on before creation', function() { |
| 799 | + var e = document.createElement('x-apply-depend-before-create'); |
| 800 | + document.body.appendChild(e); |
| 801 | + CustomElements.takeRecords(); |
| 802 | + var e2 = document.createElement('x-create-after-apply'); |
| 803 | + document.body.appendChild(e2); |
| 804 | + CustomElements.takeRecords(); |
| 805 | + assertComputed(e2.$.child, '2px'); |
| 806 | + }); |
| 807 | + |
| 808 | + test('mixin names can be safely reused for variable definitions', function() { |
| 809 | + var e = document.createElement('x-reuse-mixin-name-for-variable'); |
| 810 | + document.body.appendChild(e); |
| 811 | + CustomElements.takeRecords(); |
| 812 | + assertComputed(e, '20px'); |
| 813 | + }); |
739 | 814 | });
|
740 | 815 |
|
741 | 816 | </script>
|
|
0 commit comments