From b5ba9a82195a993a214ee6ff4d10d4f51f5c9597 Mon Sep 17 00:00:00 2001 From: Steven Orvell Date: Thu, 4 Feb 2016 17:55:52 -0800 Subject: [PATCH] Fixes #3326. Changes inspired by #3276 and #3344 --- src/lib/style-properties.html | 14 ++--------- src/standard/styling.html | 11 ++++++++- src/standard/x-styling.html | 16 +++++++++++++ test/unit/styling-cross-scope-var.html | 3 ++- test/unit/styling-remote.html | 20 ++++++++++++---- test/unit/styling-scoped.html | 33 +++++++++++++++++++------- 6 files changed, 69 insertions(+), 28 deletions(-) diff --git a/src/lib/style-properties.html b/src/lib/style-properties.html index 544a0be984..b1c649558f 100644 --- a/src/lib/style-properties.html +++ b/src/lib/style-properties.html @@ -88,17 +88,7 @@ // but not production, so strip out {...} cssText = cssText.replace(this.rx.BRACKETED, '') .replace(this.rx.VAR_ASSIGN, ''); - var parts = cssText.split(';'); - for (var i=0, p; i= o, 'style not in registration order: ' + scope); + o = n; } - assert.deepEqual(actual, expected); }); }); } diff --git a/test/unit/styling-scoped.html b/test/unit/styling-scoped.html index 6a27b2aa6b..d3215818d6 100644 --- a/test/unit/styling-scoped.html +++ b/test/unit/styling-scoped.html @@ -249,17 +249,23 @@ }); test('styles shimmed in registration order', function() { + var regList = Polymer.telemetry.registrations.map(function(reg) { + return reg.is; + }); + function regIndex(styleScope) { + for (var i=0; (r=regList[i]); i++) { + if (styleScope.match(new RegExp(r + '\\-?\\d*$'))) { + return i; + } + } + } var s$ = document.head.querySelectorAll('style[scope]'); - var expected = ['x-keyframes', 'x-keyframes-1', 'x-keyframes-0', 'x-gchild', 'x-child2', - 'x-styled', 'x-button', 'x-mixed-case', 'x-mixed-case-button', - 'x-dynamic-scope', 'x-dynamic-template', 'x-dynamic-svg', - 'x-specificity', 'x-overriding', 'x-overriding-0', - 'x-specificity-parent-0', 'x-specificity-nested-0']; - var actual = []; - for (var i=0; i= o, 'style not in registration order: ' + scope); + o = n; } - assert.deepEqual(actual, expected); }); test('svg elements properly scoped', function() { @@ -306,6 +312,15 @@ test('specificity of ::content > :not(template) selector', function() { assertComputed(document.querySelector('[is=x-specificity-nested]'), '10px'); }); + + test('overwriting mixin properties', function() { + var root = document.querySelector('x-overriding'); + assertComputed(root.querySelector('.red'), '1px'); + assertComputed(root.querySelector('.green'), '2px'); + assertComputed(root.querySelector('.red-2'), '1px'); + assertComputed(root.querySelector('.blue'), '3px'); + }); + }); test('svg classes are dynamically scoped correctly', function() {