OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <!-- |
| 3 @license |
| 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 |
| 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 |
| 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 |
| 10 --> |
| 11 |
| 12 <html> |
| 13 <head> |
| 14 |
| 15 <title>paper-tabs-attr-for-selected</title> |
| 16 <meta charset="utf-8"> |
| 17 <meta name="viewport" content="width=device-width, minimum-scale=1.0, initia
l-scale=1, user-scalable=yes"> |
| 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="../paper-tabs.html"> |
| 24 <link rel="import" href="../../test-fixture/test-fixture.html"> |
| 25 |
| 26 </head> |
| 27 <body> |
| 28 |
| 29 <test-fixture id="basic"> |
| 30 <template> |
| 31 <paper-tabs attr-for-selected="name" selected="bar"> |
| 32 <paper-tab name="foo">ITEM FOO</paper-tab> |
| 33 <paper-tab name="bar">ITEM BAR</paper-tab> |
| 34 <paper-tab name="zot">ITEM ZOT</paper-tab> |
| 35 </paper-tabs> |
| 36 </template> |
| 37 </test-fixture> |
| 38 |
| 39 <script> |
| 40 |
| 41 suite('set the selected attribute', function() { |
| 42 |
| 43 var tabs; |
| 44 |
| 45 setup(function () { |
| 46 tabs = fixture('basic'); |
| 47 }); |
| 48 |
| 49 test('selected value', function() { |
| 50 assert.equal(tabs.selected, 'bar'); |
| 51 }); |
| 52 |
| 53 test('selected tab has iron-selected class', function() { |
| 54 assert.isTrue(tabs.querySelector('[name=bar]').classList.contains('iro
n-selected')); |
| 55 }); |
| 56 |
| 57 }); |
| 58 |
| 59 suite('select tab via click', function() { |
| 60 |
| 61 var tabs, tab; |
| 62 |
| 63 setup(function () { |
| 64 tabs = fixture('basic'); |
| 65 tab = tabs.querySelector('[name=zot]'); |
| 66 tab.dispatchEvent(new CustomEvent('click', {bubbles: true})); |
| 67 }); |
| 68 |
| 69 test('selected value', function() { |
| 70 assert.equal(tabs.selected, 'zot'); |
| 71 }); |
| 72 |
| 73 test('selected tab has iron-selected class', function() { |
| 74 assert.isTrue(tab.classList.contains('iron-selected')); |
| 75 }); |
| 76 |
| 77 }); |
| 78 |
| 79 </script> |
| 80 |
| 81 </body> |
| 82 </html> |
OLD | NEW |