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 |
| 25 <style> |
| 26 .iron-selected { |
| 27 background: #ccc; |
| 28 } |
| 29 </style> |
| 30 |
| 31 </head> |
| 32 <body> |
| 33 |
| 34 <test-fixture id="test"> |
| 35 <template> |
| 36 <iron-selector id="selector"> |
| 37 <div>Item 0</div> |
| 38 <div>Item 1</div> |
| 39 <div>Item 2</div> |
| 40 <div>Item 3</div> |
| 41 <div>Item 4</div> |
| 42 </iron-selector> |
| 43 </template> |
| 44 </test-fixture> |
| 45 |
| 46 <script> |
| 47 |
| 48 suite('selected attributes', function() { |
| 49 |
| 50 var s; |
| 51 |
| 52 setup(function () { |
| 53 s = fixture('test'); |
| 54 }); |
| 55 |
| 56 test('custom selectedAttribute', function() { |
| 57 // set selectedAttribute |
| 58 s.selectedAttribute = 'myattr'; |
| 59 // check selected attribute (should not be there) |
| 60 assert.isFalse(s.children[4].hasAttribute('myattr')); |
| 61 // set selected |
| 62 s.selected = 4; |
| 63 // now selected attribute should be there |
| 64 assert.isTrue(s.children[4].hasAttribute('myattr')); |
| 65 }); |
| 66 |
| 67 }); |
| 68 |
| 69 </script> |
| 70 |
| 71 </body> |
| 72 </html> |
OLD | NEW |