Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Side by Side Diff: polymer_1.0.4/bower_components/iron-menu-behavior/test/iron-menubar-behavior.html

Issue 1205703007: Add polymer 1.0 to npm_modules (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: Renamed folder to 1.0.4 Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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>iron-menubar-behavior 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="test-menubar.html">
27
28 </head>
29 <body>
30
31 <test-fixture id="basic">
32 <template>
33 <test-menubar>
34 <div>item 1</div>
35 <div>item 2</div>
36 <div>item 3</div>
37 </test-menubar>
38 </template>
39 </test-fixture>
40
41 <test-fixture id="multi">
42 <template>
43 <test-menubar multi>
44 <div>item 1</div>
45 <div>item 2</div>
46 <div>item 3</div>
47 </test-menubar>
48 </template>
49 </test-fixture>
50
51 <script>
52
53 suite('menubar a11y tests', function() {
54
55 test('menubar has role="menubar"', function() {
56 var menubar = fixture('basic');
57 assert.equal(menubar.getAttribute('role'), 'menubar', 'has role="menub ar"');
58 });
59
60 test('first item gets focus when menubar is focused', function(done) {
61 var menubar = fixture('basic');
62 menubar.focus();
63 setTimeout(function() {
64 assert.equal(document.activeElement, menubar.firstElementChild, 'doc ument.activeElement is first item')
65 done();
66 // wait for async in _onFocus
67 }, 200);
68 });
69
70 test('selected item gets focus when menubar is focused', function(done) {
71 var menubar = fixture('basic');
72 menubar.selected = 1;
73 menubar.focus();
74 setTimeout(function() {
75 assert.equal(document.activeElement, menubar.selectedItem, 'document .activeElement is selected item');
76 done();
77 // wait for async in _onFocus
78 }, 200);
79 });
80
81 test('last activated item in a multi select menubar is focused', functio n(done) {
82 var menubar = fixture('multi');
83 menubar.selected = 0;
84 menubar.items[1].click();
85 setTimeout(function() {
86 assert.equal(document.activeElement, menubar.items[1], 'document.act iveElement is last activated item');
87 done();
88 // wait for async in _onFocus
89 }, 200);
90 });
91
92 test('deselection in a multi select menubar focuses deselected item', fu nction(done) {
93 var menubar = fixture('multi');
94 menubar.selected = 0;
95 menubar.items[0].click();
96 setTimeout(function() {
97 assert.equal(document.activeElement, menubar.items[0], 'document.act iveElement is last activated item');
98 done();
99 // wait for async in _onFocus
100 }, 200);
101 });
102
103 });
104
105 </script>
106
107 </body>
108 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698