| 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>iron-pages-basic</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="../iron-pages.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 <iron-pages> |
| 32 <div id="page0">Page 0</div> |
| 33 <div id="page1">Page 1</div> |
| 34 <div id="page2">Page 2</div> |
| 35 <div id="page3">Page 3</div> |
| 36 </iron-pages> |
| 37 </template> |
| 38 </test-fixture> |
| 39 |
| 40 <script> |
| 41 |
| 42 suite('basic', function() { |
| 43 var pages; |
| 44 |
| 45 suite('defaults', function() { |
| 46 setup(function () { |
| 47 pages = fixture('basic'); |
| 48 }); |
| 49 |
| 50 test('to nothing selected', function() { |
| 51 assert.equal(pages.selected, undefined); |
| 52 }); |
| 53 |
| 54 test('null activateEvent', function() { |
| 55 // `activateEvent` is not a useful feature for iron-pages and it can
interfere |
| 56 // with ux; ensure iron-pages has cleared any default `activateEvent
` |
| 57 assert.equal(pages.activateEvent, null); |
| 58 }); |
| 59 |
| 60 test('to iron-selected as selectedClass', function() { |
| 61 assert.equal(pages.selectedClass, 'iron-selected'); |
| 62 }); |
| 63 |
| 64 test('as many items as children', function() { |
| 65 assert.equal(pages.items.length, 4); |
| 66 }); |
| 67 |
| 68 test('all pages are display:none', function() { |
| 69 pages.items.forEach(function(p) { |
| 70 assert.equal(getComputedStyle(p).display, 'none'); |
| 71 }); |
| 72 }); |
| 73 }); |
| 74 |
| 75 suite('set the selected attribute', function() { |
| 76 setup(function () { |
| 77 pages = fixture('basic'); |
| 78 pages.selected = 0; |
| 79 }); |
| 80 |
| 81 test('selected value', function() { |
| 82 assert.equal(pages.selected, '0'); |
| 83 }); |
| 84 |
| 85 test('selected item', function() { |
| 86 assert.equal(pages.selectedItem, pages.items[0]); |
| 87 }); |
| 88 |
| 89 test('selected item is display:block and all others are display:none',
function() { |
| 90 pages.items.forEach(function(p) { |
| 91 assert.equal(getComputedStyle(p).display, p == pages.selectedItem
? 'block' : 'none'); |
| 92 }); |
| 93 }); |
| 94 }); |
| 95 |
| 96 }); |
| 97 |
| 98 </script> |
| 99 |
| 100 </body> |
| 101 </html> |
| OLD | NEW |