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 <html> |
| 12 <head> |
| 13 |
| 14 <title>paper-menu tests</title> |
| 15 |
| 16 <meta charset="utf-8"> |
| 17 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
| 18 <meta name="viewport" content="width=device-width, minimum-scale=1.0, initia
l-scale=1, user-scalable=yes"> |
| 19 |
| 20 <script src="../../webcomponentsjs/webcomponents-lite.js"></script> |
| 21 |
| 22 <script src="../../web-component-tester/browser.js"></script> |
| 23 <script src="../../test-fixture/test-fixture-mocha.js"></script> |
| 24 |
| 25 <link rel="import" href="../../test-fixture/test-fixture.html"> |
| 26 <link rel="import" href="../paper-menu.html"> |
| 27 |
| 28 </head> |
| 29 <body> |
| 30 |
| 31 <test-fixture id="basic"> |
| 32 <template> |
| 33 <paper-menu> |
| 34 <div>item 1</div> |
| 35 <div>item 2</div> |
| 36 <div>item 3</div> |
| 37 </paper-menu> |
| 38 </template> |
| 39 </test-fixture> |
| 40 |
| 41 <script> |
| 42 |
| 43 suite('menu a11y tests', function() { |
| 44 var menu, selectedMenu; |
| 45 |
| 46 setup(function() { |
| 47 menu = fixture('basic'); |
| 48 }); |
| 49 |
| 50 test('menu has role="menu"', function() { |
| 51 assert.equal(menu.getAttribute('role'), 'menu', 'has role="menu"'); |
| 52 }); |
| 53 |
| 54 test('first item gets focus when menu is focused', function(done) { |
| 55 menu.focus(); |
| 56 setTimeout(function() { |
| 57 assert.equal(document.activeElement, menu.firstElementChild, 'docume
nt.activeElement is first item') |
| 58 done(); |
| 59 }); |
| 60 }); |
| 61 |
| 62 test('selected item gets focus when menu is focused', function(done) { |
| 63 menu.selected = 1; |
| 64 menu.focus(); |
| 65 setTimeout(function() { |
| 66 assert.equal(document.activeElement, menu.selectedItem, 'document.ac
tiveElement is selected item'); |
| 67 done(); |
| 68 }); |
| 69 }); |
| 70 |
| 71 }); |
| 72 |
| 73 </script> |
| 74 |
| 75 </body> |
| 76 </html> |
OLD | NEW |