| OLD | NEW |
| 1 <!doctype html> | 1 <!doctype html> |
| 2 <!-- | 2 <!-- |
| 3 @license | 3 @license |
| 4 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. | 4 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. |
| 5 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt | 5 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
| 6 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | 6 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
| 7 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt | 7 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
| 8 Code distributed by Google as part of the polymer project is also | 8 Code distributed by Google as part of the polymer project is also |
| 9 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt | 9 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
| 10 --> | 10 --> |
| 11 | 11 |
| 12 <html> | 12 <html> |
| 13 <head> | 13 <head> |
| 14 | 14 |
| 15 <title>iron-iconset</title> | 15 <title>iron-iconset</title> |
| 16 <meta charset="utf-8"> | 16 <meta charset="utf-8"> |
| 17 <meta name="viewport" content="width=device-width, initial-scale=1.0"> | 17 <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 18 | 18 |
| 19 <script src="../../webcomponentsjs/webcomponents-lite.js"></script> | 19 <script src="../../webcomponentsjs/webcomponents-lite.js"></script> |
| 20 <script src="../../web-component-tester/browser.js"></script> | 20 <script src="../../web-component-tester/browser.js"></script> |
| 21 <script src="../../test-fixture/test-fixture-mocha.js"></script> | 21 <script src="../../test-fixture/test-fixture-mocha.js"></script> |
| 22 | 22 |
| 23 <link rel="import" href="../iron-iconset.html"> | 23 <link rel="import" href="../iron-iconset.html"> |
| 24 <link rel="import" href="../../iron-meta/iron-meta.html"> | 24 <link rel="import" href="../../iron-meta/iron-meta.html"> |
| 25 <link rel="import" href="../../promise-polyfill/promise-polyfill.html"> |
| 25 <link rel="import" href="../../test-fixture/test-fixture.html"> | 26 <link rel="import" href="../../test-fixture/test-fixture.html"> |
| 26 | 27 |
| 27 </head> | 28 </head> |
| 28 <body> | 29 <body> |
| 29 | 30 |
| 30 <test-fixture id="TrivialIconset"> | 31 <test-fixture id="TrivialIconset"> |
| 31 <template> | 32 <template> |
| 32 <iron-iconset name="foo" src="../demo/my-icons.png"></iron-iconset> | 33 <iron-iconset name="foo" src="../demo/my-icons.png"></iron-iconset> |
| 33 <iron-meta type="iconset"></iron-meta> | 34 <iron-meta type="iconset"></iron-meta> |
| 34 </template> | 35 </template> |
| (...skipping 21 matching lines...) Expand all Loading... |
| 56 </iron-iconset> | 57 </iron-iconset> |
| 57 <div></div> | 58 <div></div> |
| 58 </template> | 59 </template> |
| 59 </test-fixture> | 60 </test-fixture> |
| 60 | 61 |
| 61 <script> | 62 <script> |
| 62 suite('<iron-iconset>', function () { | 63 suite('<iron-iconset>', function () { |
| 63 suite('basic behavior', function () { | 64 suite('basic behavior', function () { |
| 64 var iconset; | 65 var iconset; |
| 65 var meta; | 66 var meta; |
| 67 var loadedPromise; |
| 66 | 68 |
| 67 setup(function () { | 69 setup(function () { |
| 70 loadedPromise = new Promise(function(resolve) { |
| 71 window.addEventListener('iron-iconset-added', function(ev) { |
| 72 if (ev && ev.detail === iconset) { |
| 73 resolve(); |
| 74 } |
| 75 }); |
| 76 }); |
| 77 |
| 68 var elements = fixture('TrivialIconset'); | 78 var elements = fixture('TrivialIconset'); |
| 69 | 79 |
| 70 iconset = elements[0]; | 80 iconset = elements[0]; |
| 71 meta = elements[1]; | 81 meta = elements[1]; |
| 72 }); | 82 }); |
| 73 | 83 |
| 74 test('it can be accessed via iron-meta', function () { | 84 test('it can be accessed via iron-meta', function () { |
| 75 expect(meta.byKey('foo')).to.be.equal(iconset); | 85 expect(meta.byKey('foo')).to.be.equal(iconset); |
| 76 }); | 86 }); |
| 87 |
| 88 test('it fires an iron-iconset-added event on the window', function() { |
| 89 return loadedPromise; |
| 90 }); |
| 77 }); | 91 }); |
| 78 | 92 |
| 79 suite('when src, width, iconSize and icons are assigned', function () { | 93 suite('when src, width, iconSize and icons are assigned', function () { |
| 80 var iconset; | 94 var iconset; |
| 81 var div; | 95 var div; |
| 82 | 96 |
| 83 setup(function () { | 97 setup(function () { |
| 84 var elements = fixture('StandardIconset'); | 98 var elements = fixture('StandardIconset'); |
| 85 | 99 |
| 86 iconset = elements[0]; | 100 iconset = elements[0]; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 iconStyle = window.getComputedStyle(div); | 154 iconStyle = window.getComputedStyle(div); |
| 141 | 155 |
| 142 expect(iconStyle.backgroundPosition).to.match(/-10px -34px/); | 156 expect(iconStyle.backgroundPosition).to.match(/-10px -34px/); |
| 143 }); | 157 }); |
| 144 }); | 158 }); |
| 145 }); | 159 }); |
| 146 </script> | 160 </script> |
| 147 | 161 |
| 148 </body> | 162 </body> |
| 149 </html> | 163 </html> |
| OLD | NEW |