OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <!-- | 2 <!-- |
3 @license | 3 @license |
4 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. | 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 | 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 | 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 | 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 | 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 | 9 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
10 --> | 10 --> |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 Polymer.Base.async(function() { | 537 Polymer.Base.async(function() { |
538 assert.notEqual(Polymer.dom(document).activeElement, menu); | 538 assert.notEqual(Polymer.dom(document).activeElement, menu); |
539 assert.notEqual(Polymer.dom(document).activeElement, menu.items[0]); | 539 assert.notEqual(Polymer.dom(document).activeElement, menu.items[0]); |
540 assert.notEqual(Polymer.dom(document).activeElement, menu.items[1]); | 540 assert.notEqual(Polymer.dom(document).activeElement, menu.items[1]); |
541 done(); | 541 done(); |
542 }); | 542 }); |
543 }); | 543 }); |
544 | 544 |
545 test('A disabled menu will not have a tab index.', function() { | 545 test('A disabled menu will not have a tab index.', function() { |
546 var menu = fixture('countries'); | 546 var menu = fixture('countries'); |
547 assert.equal(menu.tabIndex, 0); | 547 assert.equal(menu.getAttribute('tabindex'), '0'); |
548 menu.disabled = true; | 548 menu.disabled = true; |
549 assert.equal(menu.tabIndex, -1); | 549 assert.equal(menu.getAttribute('tabindex'), null); |
550 menu.disabled = false; | 550 menu.disabled = false; |
551 assert.equal(menu.tabIndex, 0); | 551 assert.equal(menu.getAttribute('tabindex'), '0'); |
552 }); | 552 }); |
553 | 553 |
554 test('Updated tab index of disabled element should remain.', function()
{ | 554 test('Updated tab index of disabled element should remain.', function()
{ |
555 var menu = fixture('countries'); | 555 var menu = fixture('countries'); |
556 assert.equal(menu.tabIndex, 0); | 556 assert.equal(menu.getAttribute('tabindex'), '0'); |
557 menu.disabled = true; | 557 menu.disabled = true; |
558 assert.equal(menu.tabIndex, -1); | 558 assert.equal(menu.getAttribute('tabindex'), null); |
559 menu.setAttribute('tabindex', 15); | 559 menu.setAttribute('tabindex', 15); |
560 assert.equal(menu.tabIndex, 15); | 560 assert.equal(menu.getAttribute('tabindex'), '15'); |
561 menu.disabled = false; | 561 menu.disabled = false; |
562 assert.equal(menu.tabIndex, 15); | 562 assert.equal(menu.getAttribute('tabindex'), '15'); |
563 }); | 563 }); |
564 | 564 |
565 test('A disabled menu will regain its non-zero tab index when re-enabled
.', function() { | 565 test('A disabled menu will regain its non-zero tab index when re-enabled
.', function() { |
566 var menu = fixture('nonzero-tabindex'); | 566 var menu = fixture('nonzero-tabindex'); |
567 assert.equal(menu.tabIndex, 32); | 567 assert.equal(menu.getAttribute('tabindex'), '32'); |
568 menu.disabled = true; | 568 menu.disabled = true; |
569 assert.equal(menu.tabIndex, -1); | 569 assert.equal(menu.getAttribute('tabindex'), null); |
570 menu.disabled = false; | 570 menu.disabled = false; |
571 assert.equal(menu.tabIndex, 32); | 571 assert.equal(menu.getAttribute('tabindex'), '32'); |
572 }); | 572 }); |
573 | 573 |
574 test('`tabIndex` properties of all items are updated when items change',
function(done) { | 574 test('`tabIndex` properties of all items are updated when items change',
function(done) { |
575 var menu = fixture('basic'); | 575 var menu = fixture('basic'); |
576 | 576 |
577 function assertTabIndexCounts(nodes, expected) { | 577 function assertTabIndexCounts(nodes, expected) { |
578 var tabIndexCounts = {}; | 578 var tabIndexCounts = {}; |
579 for (var i = 0; i < nodes.length; i++) { | 579 for (var i = 0; i < nodes.length; i++) { |
580 var tabIndex = nodes[i].tabIndex; | 580 var tabIndex = nodes[i].tabIndex; |
581 if (tabIndexCounts[tabIndex]) { | 581 if (tabIndexCounts[tabIndex]) { |
(...skipping 26 matching lines...) Expand all Loading... |
608 // Async wait for `observeNodes`. | 608 // Async wait for `observeNodes`. |
609 Polymer.Base.async(function() { | 609 Polymer.Base.async(function() { |
610 assertTabIndexCounts(menu.items, {"-1": 5, "0": 1}); | 610 assertTabIndexCounts(menu.items, {"-1": 5, "0": 1}); |
611 done(); | 611 done(); |
612 }); | 612 }); |
613 }); | 613 }); |
614 }); | 614 }); |
615 </script> | 615 </script> |
616 </body> | 616 </body> |
617 </html> | 617 </html> |
OLD | NEW |