Skip to content
This repository was archived by the owner on Jan 4, 2021. It is now read-only.

Commit 26ced1d

Browse files
author
Francois-Xavier Gentilhomme
committed
[DEV] Add offset params
1 parent 83b0c5e commit 26ced1d

36 files changed

+837
-683
lines changed

analysis.json

Lines changed: 224 additions & 202 deletions
Large diffs are not rendered by default.

docs/components/iron-iconset-svg/.bower.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "iron-iconset-svg",
33
"description": "Manages a set of svg icons",
4-
"version": "2.0.1",
4+
"version": "2.1.0",
55
"keywords": [
66
"web-components",
77
"polymer",
@@ -53,11 +53,11 @@
5353
"webcomponentsjs": "^1.0.0"
5454
},
5555
"homepage": "https://github.com/PolymerElements/iron-iconset-svg",
56-
"_release": "2.0.1",
56+
"_release": "2.1.0",
5757
"_resolution": {
5858
"type": "version",
59-
"tag": "v2.0.1",
60-
"commit": "5710525f06f7dbbe85f61a8c5e403b040520bacf"
59+
"tag": "v2.1.0",
60+
"commit": "791acf9d965c7b539b57589769d085a0518e2235"
6161
},
6262
"_source": "https://github.com/PolymerElements/iron-iconset-svg.git",
6363
"_target": "1 - 2",

docs/components/iron-iconset-svg/bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "iron-iconset-svg",
33
"description": "Manages a set of svg icons",
4-
"version": "2.0.1",
4+
"version": "2.1.0",
55
"keywords": [
66
"web-components",
77
"polymer",

docs/components/iron-iconset-svg/iron-iconset-svg.html

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,16 @@
8080
rtlMirroring: {
8181
type: Boolean,
8282
value: false
83+
},
84+
85+
/**
86+
* Set to true to measure RTL based on the dir attribute on the body or
87+
* html elements (measured on document.body or document.documentElement as
88+
* available).
89+
*/
90+
useGlobalRtlAttribute: {
91+
type: Boolean,
92+
value: false
8393
}
8494
},
8595

@@ -156,12 +166,21 @@
156166
*/
157167
_targetIsRTL: function(target) {
158168
if (this.__targetIsRTL == null) {
159-
if (target && target.nodeType !== Node.ELEMENT_NODE) {
160-
target = target.host;
161-
}
169+
if (this.useGlobalRtlAttribute) {
170+
var globalElement =
171+
(document.body && document.body.hasAttribute('dir'))
172+
? document.body
173+
: document.documentElement;
162174

163-
this.__targetIsRTL = target &&
164-
window.getComputedStyle(target)['direction'] === 'rtl';
175+
this.__targetIsRTL = globalElement.getAttribute('dir') === 'rtl';
176+
} else {
177+
if (target && target.nodeType !== Node.ELEMENT_NODE) {
178+
target = target.host;
179+
}
180+
181+
this.__targetIsRTL = target &&
182+
window.getComputedStyle(target)['direction'] === 'rtl';
183+
}
165184
}
166185

167186
return this.__targetIsRTL;

docs/components/iron-iconset-svg/test/iron-iconset-svg.html

Lines changed: 79 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,23 @@
4747
</template>
4848
</test-fixture>
4949

50+
<test-fixture id="GloballyMirroredIconsetSVG">
51+
<template>
52+
<iron-iconset-svg name="globally-mirrored-icons" rtl-mirroring use-global-rtl-attribute>
53+
<circle id="circle" cx="20" cy="20" r="10"></circle>
54+
<symbol id="rect" viewBox="0 0 50 25" mirror-in-rtl>
55+
<rect x="0" y="0" width="50" height="25"></rect>
56+
</symbol>
57+
</iron-iconset-svg>
58+
</template>
59+
</test-fixture>
60+
61+
<test-fixture id="DefaultContainer">
62+
<template>
63+
<dir></div>
64+
</template>
65+
</test-fixture>
66+
5067
<test-fixture id="RtlContainer">
5168
<template>
5269
<div dir="rtl"></div>
@@ -73,9 +90,10 @@
7390

7491
<script>
7592

76-
suite('<iron-iconset>', function () {
7793

78-
suite('basic behavior', function () {
94+
suite('<iron-iconset>', function() {
95+
96+
suite('basic behavior', function() {
7997
var iconset;
8098
var meta;
8199
var loadedPromise;
@@ -109,39 +127,71 @@
109127
});
110128

111129
suite('when stamping in an RTL context', function() {
112-
var iconset;
113-
var rtlContainer;
114130

115-
setup(function() {
116-
iconset = fixture('MirroredIconsetSvg');
117-
rtlContainer = fixture('RtlContainer');
118-
});
131+
var rtlSuite = function(iconsetFixture, iconContainerFixture) {
132+
var iconset;
133+
var iconContainer;
119134

120-
test('icons marked as mirror-in-rtl are mirrored', function() {
121-
iconset.applyIcon(rtlContainer, 'rect');
122-
var svg = rtlContainer.firstElementChild;
123-
var computedStyle = window.getComputedStyle(svg);
124-
var transform = computedStyle.transform || computedStyle.webkitTransform;
125-
expect(transform).to.be.eql('matrix(-1, 0, 0, 1, 0, 0)');
126-
});
135+
setup(function() {
136+
iconset = fixture(iconsetFixture);
137+
iconContainer = fixture(iconContainerFixture);
138+
});
127139

128-
test('icons not marked as mirror-in-rtl are not mirrored', function() {
129-
iconset.applyIcon(rtlContainer, 'circle');
130-
var svg = rtlContainer.firstElementChild;
131-
var computedStyle = window.getComputedStyle(svg);
132-
var transform = computedStyle.transform || computedStyle.webkitTransform;
133-
expect(transform).to.be.eql('none');
134-
});
140+
test('icons marked as mirror-in-rtl are mirrored', function() {
141+
iconset.applyIcon(iconContainer, 'rect');
142+
var svg = iconContainer.firstElementChild;
143+
var computedStyle = window.getComputedStyle(svg);
144+
var transform = computedStyle.transform || computedStyle.webkitTransform;
145+
expect(transform).to.be.eql('matrix(-1, 0, 0, 1, 0, 0)');
146+
});
147+
148+
test('icons not marked as mirror-in-rtl are not mirrored', function() {
149+
iconset.applyIcon(iconContainer, 'circle');
150+
var svg = iconContainer.firstElementChild;
151+
var computedStyle = window.getComputedStyle(svg);
152+
var transform = computedStyle.transform || computedStyle.webkitTransform;
153+
expect(transform).to.be.eql('none');
154+
});
155+
156+
test('getComputedStyle is called no more once for all icons', function() {
157+
sinon.spy(window, 'getComputedStyle');
158+
159+
for (var i = 0; i < 3; ++i) {
160+
iconset.applyIcon(iconContainer, 'rect');
161+
}
162+
163+
expect(window.getComputedStyle.callCount).to.be.lessThan(2);
164+
window.getComputedStyle.restore();
165+
});
166+
};
167+
168+
rtlSuite('MirroredIconsetSvg', 'RtlContainer');
169+
170+
suite('when preferring the global RTL attribute', function() {
135171

136-
test('many mirrored icons only call getComputedStyle once', function() {
137-
sinon.spy(window, 'getComputedStyle');
172+
suite('and dir="rtl" on <body>', function() {
173+
setup(function() {
174+
document.body.setAttribute('dir', 'rtl');
175+
});
138176

139-
for (var i = 0; i < 3; ++i) {
140-
iconset.applyIcon(rtlContainer, 'rect');
141-
}
177+
teardown(function() {
178+
document.body.removeAttribute('dir');
179+
});
142180

143-
expect(window.getComputedStyle.callCount).to.be.eql(1);
144-
window.getComputedStyle.restore();
181+
rtlSuite('GloballyMirroredIconsetSVG', 'DefaultContainer');
182+
});
183+
184+
suite('and dir="rtl" on <html>', function() {
185+
setup(function() {
186+
document.documentElement.setAttribute('dir', 'rtl');
187+
});
188+
189+
teardown(function() {
190+
document.documentElement.removeAttribute('dir');
191+
});
192+
193+
rtlSuite('GloballyMirroredIconsetSVG', 'DefaultContainer');
194+
});
145195
});
146196
});
147197

docs/components/iron-input/.bower.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "iron-input",
3-
"version": "2.0.0",
3+
"version": "2.0.1",
44
"description": "An input element with data binding",
55
"authors": [
66
"The Polymer Authors"
@@ -57,11 +57,11 @@
5757
"resolutions": {
5858
"webcomponentsjs": "^1.0.0"
5959
},
60-
"_release": "2.0.0",
60+
"_release": "2.0.1",
6161
"_resolution": {
6262
"type": "version",
63-
"tag": "v2.0.0",
64-
"commit": "330e8431f2ff423c34cd6e1744293dc779b4e3b0"
63+
"tag": "v2.0.1",
64+
"commit": "354343f4bdad87de7049f6c8242941f2457a6b8c"
6565
},
6666
"_source": "https://github.com/PolymerElements/iron-input.git",
6767
"_target": "1 - 2",

docs/components/iron-input/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ for two-way data binding. `bind-value` will notify if it is changed either by us
5050

5151
```html
5252
<iron-input bind-value="{{bindValue}}">
53-
<input value="{{value::input}}"></iron-input>
53+
<input value="{{value::input}}">
5454
</iron-input>
5555
```
5656

docs/components/iron-input/bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "iron-input",
3-
"version": "2.0.0",
3+
"version": "2.0.1",
44
"description": "An input element with data binding",
55
"authors": [
66
"The Polymer Authors"

docs/components/iron-input/iron-input.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,12 @@
160160
autoValidate: {
161161
type: Boolean,
162162
value: false
163-
}
163+
},
164+
165+
/**
166+
* The native input element.
167+
*/
168+
_inputElement: Object,
164169
},
165170

166171
observers: [

docs/components/myscript-common-element/.bower.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@
4646
"paper-toggle-button": "^2.0.0",
4747
"paper-slider": "^2.0.2"
4848
},
49-
"_release": "9b6d86048f",
49+
"_release": "29f88e0087",
5050
"_resolution": {
5151
"type": "branch",
5252
"branch": "2.0.0-alpha1",
53-
"commit": "9b6d86048fe435ef7e15af3c162568969942f74a"
53+
"commit": "29f88e00879970861c73460b572a179265caa327"
5454
},
5555
"_source": "https://github.com/MyScript/myscript-common-element.git",
5656
"_target": "2.0.0-alpha1",

0 commit comments

Comments
 (0)