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

Unified Diff: third_party/polymer/components/iron-menu-behavior/test/iron-menu-behavior.html

Issue 2113853002: Run bower update (Closed) Base URL: https://github.com/catapult-project/catapult@polymer10-migration
Patch Set: Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: third_party/polymer/components/iron-menu-behavior/test/iron-menu-behavior.html
diff --git a/third_party/polymer/components/iron-menu-behavior/test/iron-menu-behavior.html b/third_party/polymer/components/iron-menu-behavior/test/iron-menu-behavior.html
index 3b6b2910384dd4872c08eb2c58db0bd7e28f3776..e0e50ed04736d861d34df1050e6539f37367af73 100644
--- a/third_party/polymer/components/iron-menu-behavior/test/iron-menu-behavior.html
+++ b/third_party/polymer/components/iron-menu-behavior/test/iron-menu-behavior.html
@@ -338,6 +338,47 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
done();
});
});
+
+ test('`tabIndex` properties of all items are updated when items change', function(done) {
+ var menu = fixture('basic');
+
+ function assertTabIndexCounts(nodes, expected) {
+ var tabIndexCounts = {};
+ for (var i = 0; i < nodes.length; i++) {
+ var tabIndex = nodes[i].tabIndex;
+ if (tabIndexCounts[tabIndex]) {
+ tabIndexCounts[tabIndex]++;
+ } else {
+ tabIndexCounts[tabIndex] = 1;
+ }
+ }
+
+ assert.equal(Object.keys(tabIndexCounts).length, Object.keys(expected).length);
+ Object.keys(expected).forEach(function(key) {
+ assert.equal(tabIndexCounts[key], expected[key]);
+ });
+ }
+
+ function divWithTabIndex(tabIndex) {
+ var div = document.createElement('div');
+ div.tabIndex = tabIndex;
+ return div;
+ }
+
+ // Only the selected item will have tabIndex 0.
+ menu.select(0);
+ assertTabIndexCounts(menu.items, {"-1": 2, "0": 1});
+
+ Polymer.dom(menu).appendChild(divWithTabIndex(1));
+ Polymer.dom(menu).appendChild(divWithTabIndex(2));
+ Polymer.dom(menu).appendChild(divWithTabIndex(3));
+
+ // Async wait for `observeNodes`.
+ Polymer.Base.async(function() {
+ assertTabIndexCounts(menu.items, {"-1": 5, "0": 1});
+ done();
+ });
+ });
});
</script>
</body>

Powered by Google App Engine
This is Rietveld 408576698