Index: polymer_1.2.3/bower_components/iron-iconset-svg/test/iron-iconset-svg.html |
diff --git a/polymer_1.0.4/bower_components/iron-iconset-svg/test/iron-iconset-svg.html b/polymer_1.2.3/bower_components/iron-iconset-svg/test/iron-iconset-svg.html |
similarity index 66% |
copy from polymer_1.0.4/bower_components/iron-iconset-svg/test/iron-iconset-svg.html |
copy to polymer_1.2.3/bower_components/iron-iconset-svg/test/iron-iconset-svg.html |
index 4af6f8becdb54a8215d82f50d99ffa05b6d0812b..aa7bae9ff9f446ebad508035bb90ee223f5849d1 100644 |
--- a/polymer_1.0.4/bower_components/iron-iconset-svg/test/iron-iconset-svg.html |
+++ b/polymer_1.2.3/bower_components/iron-iconset-svg/test/iron-iconset-svg.html |
@@ -22,6 +22,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN |
<link rel="import" href="../iron-iconset-svg.html"> |
<link rel="import" href="../../iron-meta/iron-meta.html"> |
+ <link rel="import" href="../../promise-polyfill/promise-polyfill.html"> |
<link rel="import" href="../../test-fixture/test-fixture.html"> |
</head> |
@@ -41,6 +42,9 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN |
<defs> |
<circle id="circle" cx="20" cy="20" r="10"></circle> |
<rect id="square" x="0" y="0" width="20" height="20"></rect> |
+ <symbol id="rect" viewBox="0 0 50 25"> |
+ <rect x="0" y="0" width="50" height="25"></rect> |
+ </symbol> |
</defs> |
</svg> |
</iron-iconset-svg> |
@@ -55,8 +59,16 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN |
suite('basic behavior', function () { |
var iconset; |
var meta; |
+ var loadedPromise; |
setup(function () { |
+ loadedPromise = new Promise(function(resolve) { |
+ window.addEventListener('iron-iconset-added', function(ev) { |
+ if (ev && ev.detail === iconset) { |
+ resolve(); |
+ } |
+ }); |
+ }); |
var elements = fixture('TrivialIconsetSvg'); |
iconset = elements[0]; |
meta = elements[1]; |
@@ -65,6 +77,16 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN |
test('it can be accessed via iron-meta', function () { |
expect(meta.byKey('foo')).to.be.equal(iconset); |
}); |
+ |
+ test('it does not have a size', function () { |
+ var rect = iconset.getBoundingClientRect(); |
+ expect(rect.width).to.be.equal(0); |
+ expect(rect.height).to.be.equal(0); |
+ }); |
+ |
+ test('it fires an iron-iconset-added event on the window', function() { |
+ return loadedPromise; |
+ }); |
}); |
suite('when paired with a size and SVG definition', function () { |
@@ -77,6 +99,12 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN |
div = elements[1]; |
}); |
+ test('it does not have a size', function () { |
+ var rect = iconset.getBoundingClientRect(); |
+ expect(rect.width).to.be.equal(0); |
+ expect(rect.height).to.be.equal(0); |
+ }); |
+ |
test('appends a child to the target element', function () { |
expect(div.firstElementChild).to.not.be.ok; |
iconset.applyIcon(div, 'circle'); |
@@ -84,7 +112,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN |
}); |
test('can be queried for all available icons', function () { |
- expect(iconset.getIconNames()).to.deep.eql(['my-icons:circle', 'my-icons:square']); |
+ expect(iconset.getIconNames()).to.deep.eql(['my-icons:circle', 'my-icons:square', 'my-icons:rect']); |
}); |
test('supports any icon defined in the svg', function () { |
@@ -97,6 +125,16 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN |
}); |
}); |
+ test('prefers a viewBox attribute over the iconset size', function () { |
+ iconset.applyIcon(div, 'rect'); |
+ expect(div.firstElementChild.getAttribute('viewBox')).to.be.equal('0 0 50 25'); |
+ }); |
+ |
+ test('uses the iconset size when viewBox is not defined on the element', function () { |
+ iconset.applyIcon(div, 'circle'); |
+ expect(div.firstElementChild.getAttribute('viewBox')).to.be.equal('0 0 20 20'); |
+ }); |
+ |
}); |
}); |