OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <!-- |
| 3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. |
| 4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
| 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
| 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
| 7 Code distributed by Google as part of the polymer project is also |
| 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
| 9 --> |
| 10 |
| 11 <html> |
| 12 <head> |
| 13 |
| 14 <title>iron-selector-selected-attribute</title> |
| 15 <meta charset="utf-8"> |
| 16 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-
scale=1.0"> |
| 17 |
| 18 <script src="../../webcomponentsjs/webcomponents-lite.js"></script> |
| 19 <script src="../../web-component-tester/browser.js"></script> |
| 20 <script src="../../test-fixture/test-fixture-mocha.js"></script> |
| 21 |
| 22 <link rel="import" href="../../test-fixture/test-fixture.html"> |
| 23 <link rel="import" href="../iron-selector.html"> |
| 24 </head> |
| 25 <body> |
| 26 |
| 27 <test-fixture id="test1"> |
| 28 <template> |
| 29 <iron-selector> |
| 30 <div>Item 0</div> |
| 31 <div>Item 1</div> |
| 32 <div>Item 2</div> |
| 33 <span>Item 3</span> |
| 34 </iron-selector> |
| 35 </template> |
| 36 </test-fixture> |
| 37 |
| 38 <test-fixture id="test2"> |
| 39 <template> |
| 40 <iron-selector> |
| 41 <div>Item 0</div> |
| 42 <div>Item 1</div> |
| 43 <div>Item 2</div> |
| 44 <p>Item 3</p> |
| 45 </iron-selector> |
| 46 </template> |
| 47 </test-fixture> |
| 48 |
| 49 <script> |
| 50 |
| 51 suite('excluded local names', function() { |
| 52 |
| 53 var test1, test2; |
| 54 |
| 55 setup(function () { |
| 56 test1 = fixture('test1'); |
| 57 test2 = fixture('test2'); |
| 58 }); |
| 59 |
| 60 test('default `_excludedLocalNames`', function() { |
| 61 assert.isTrue('template' in test1._excludedLocalNames); |
| 62 assert.isTrue('template' in test2._excludedLocalNames); |
| 63 }); |
| 64 |
| 65 test('custom `_excludedLocalNames`', function() { |
| 66 test1._excludedLocalNames.foo = 1; |
| 67 |
| 68 assert.isTrue('foo' in test1._excludedLocalNames); |
| 69 assert.isFalse('foo' in test2._excludedLocalNames); |
| 70 }); |
| 71 |
| 72 |
| 73 test('items', function(done) { |
| 74 test1._excludedLocalNames.span = 1; |
| 75 test2._excludedLocalNames.div = 1; |
| 76 test1._updateItems(); |
| 77 test2._updateItems(); |
| 78 |
| 79 Polymer.Base.async(function() { |
| 80 var NOT_FOUND = -1; |
| 81 var items1 = test1.items.map(function(el) { return el.localName; }); |
| 82 var items2 = test2.items.map(function(el) { return el.localName; }); |
| 83 |
| 84 assert.equal(items1.indexOf('span'), NOT_FOUND); |
| 85 assert.equal(items2.indexOf('div'), NOT_FOUND); |
| 86 done(); |
| 87 }); |
| 88 }); |
| 89 |
| 90 }); |
| 91 |
| 92 </script> |
| 93 |
| 94 </body> |
| 95 </html> |
OLD | NEW |