From 8bb6effecb65b1706cd538b77e08e7b5fb517b3a Mon Sep 17 00:00:00 2001 From: Anthony Wikkerink Date: Mon, 12 Jun 2017 16:46:05 -0400 Subject: [PATCH 1/2] Fix mixins not working with :dir(rtl) and :host-context in different versions of polymer --- bower.json | 6 +++-- d2l-offscreen-shared-styles.html | 10 ++----- d2l-offscreen.html | 6 +++++ demo/index.html | 2 +- test/.eslintrc | 13 +++++++++ test/a11y.html | 28 +++++++++++++++++++ test/d2l-offscreen.html | 37 +++++++++++++++++++++++++ test/index.html | 21 +++++++++++++++ wct.conf.json | 46 ++++++++++++++++++++++++++++++++ 9 files changed, 158 insertions(+), 11 deletions(-) create mode 100644 test/.eslintrc create mode 100644 test/a11y.html create mode 100644 test/d2l-offscreen.html create mode 100644 test/index.html create mode 100644 wct.conf.json diff --git a/bower.json b/bower.json index 2b836b8..96b9781 100644 --- a/bower.json +++ b/bower.json @@ -20,7 +20,8 @@ "polymer": "Polymer/polymer#1.9 - 2" }, "devDependencies": { - "d2l-demo-template": "0.0.12 - 1.0.1" + "d2l-demo-template": "0.0.12 - 1.0.1", + "web-component-tester": "Polymer/web-component-tester#^6.0.0" }, "variants": { "1.x": { @@ -28,7 +29,8 @@ "polymer": "Polymer/polymer#1.9" }, "devDependencies": { - "d2l-demo-template": "^0.0.12" + "d2l-demo-template": "^0.0.12", + "web-component-tester": "Polymer/web-component-tester#^4.0.0" }, "resolutions": { "webcomponentsjs": "^0.7" diff --git a/d2l-offscreen-shared-styles.html b/d2l-offscreen-shared-styles.html index 2551c21..c269bc1 100644 --- a/d2l-offscreen-shared-styles.html +++ b/d2l-offscreen-shared-styles.html @@ -11,14 +11,8 @@ white-space: nowrap; left: -10000px; }; - } - :host(:dir(rtl)) { - --d2l-offscreen: { - position: absolute !important; - overflow: hidden; - width: 1px; - height: 1px; - white-space: nowrap; + --d2l-offscreen-rtl { + left: 0; right: -10000px; }; } diff --git a/d2l-offscreen.html b/d2l-offscreen.html index daa4f84..189473b 100644 --- a/d2l-offscreen.html +++ b/d2l-offscreen.html @@ -7,6 +7,12 @@ display: inline-block; @apply(--d2l-offscreen); } + :host(:dir(rtl)) { + @apply(--d2l-offscreen-rtl); + } + :host-context([dir="rtl"]) { + @apply(--d2l-offscreen-rtl); + } diff --git a/demo/index.html b/demo/index.html index 600ee0d..476cf8e 100644 --- a/demo/index.html +++ b/demo/index.html @@ -10,7 +10,7 @@ -
+
Some offscreen content: this should be offscreenthis should be offscreen
diff --git a/test/.eslintrc b/test/.eslintrc new file mode 100644 index 0000000..4f283c8 --- /dev/null +++ b/test/.eslintrc @@ -0,0 +1,13 @@ +{ + "globals": { + "WCT": false, + "suite": false, + "setup": false, + "teardown": false, + "test": false, + "fixture": false, + "a11ySuite": false, + "expect": false, + "sinon": false + } +} diff --git a/test/a11y.html b/test/a11y.html new file mode 100644 index 0000000..4733de8 --- /dev/null +++ b/test/a11y.html @@ -0,0 +1,28 @@ + + + + + + + d2l-offscreen test + + + + + + + + + + + + + + + diff --git a/test/d2l-offscreen.html b/test/d2l-offscreen.html new file mode 100644 index 0000000..70ed36f --- /dev/null +++ b/test/d2l-offscreen.html @@ -0,0 +1,37 @@ + + + + + + + d2l-offscreen test + + + + + + + + + + + + + + diff --git a/test/index.html b/test/index.html new file mode 100644 index 0000000..c2832b9 --- /dev/null +++ b/test/index.html @@ -0,0 +1,21 @@ + + + + + + d2l-button-group tests + + + + + + + diff --git a/wct.conf.json b/wct.conf.json new file mode 100644 index 0000000..c33e1ce --- /dev/null +++ b/wct.conf.json @@ -0,0 +1,46 @@ +{ + "plugins": { + "local": { + "browsers": ["chrome"] + }, + "sauce": { + "browsers": [ + { + "browserName": "chrome", + "platform": "OS X 10.12", + "version": "" + }, + { + "browserName": "chrome", + "platform": "Windows 10", + "version": "" + }, + { + "browserName": "firefox", + "platform": "OS X 10.12", + "version": "" + }, + { + "browserName": "firefox", + "platform": "Windows 10", + "version": "" + }, + { + "browserName": "safari", + "platform": "OS X 10.12", + "version": "10.0" + }, + { + "browserName": "microsoftedge", + "platform": "Windows 10", + "version": "" + }, + { + "browserName": "internet explorer", + "platform": "Windows 10", + "version": "11" + } + ] + } + } +} From 177a0707caba5cfd25faad12aef72b89cc0c1e03 Mon Sep 17 00:00:00 2001 From: Anthony Wikkerink Date: Mon, 12 Jun 2017 16:56:21 -0400 Subject: [PATCH 2/2] Use @apply syntax --- d2l-offscreen.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/d2l-offscreen.html b/d2l-offscreen.html index 189473b..753d168 100644 --- a/d2l-offscreen.html +++ b/d2l-offscreen.html @@ -5,13 +5,13 @@