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