| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** @fileoverview Suite of tests for extension-keyboard-shortcuts. */ | 5 /** @fileoverview Suite of tests for extension-keyboard-shortcuts. */ |
| 6 cr.define('extension_keyboard_shortcut_tests', function() { | 6 cr.define('extension_keyboard_shortcut_tests', function() { |
| 7 /** @enum {string} */ | 7 /** @enum {string} */ |
| 8 var TestNames = { | 8 var TestNames = { |
| 9 Layout: 'Layout', | 9 Layout: 'Layout', |
| 10 // The ShortcutUtil test suite is all js-based (no UI), so we can execute | 10 // The ShortcutUtil test suite is all js-based (no UI), so we can execute |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 var cards = | 75 var cards = |
| 76 keyboardShortcuts.$$('#main').querySelectorAll('.shortcut-card'); | 76 keyboardShortcuts.$$('#main').querySelectorAll('.shortcut-card'); |
| 77 assertEquals(2, cards.length); | 77 assertEquals(2, cards.length); |
| 78 | 78 |
| 79 var card1 = cards[0]; | 79 var card1 = cards[0]; |
| 80 expectEquals(oneCommand.name, | 80 expectEquals(oneCommand.name, |
| 81 card1.querySelector('.card-title span').textContent); | 81 card1.querySelector('.card-title span').textContent); |
| 82 var commands = card1.querySelectorAll('.command-entry'); | 82 var commands = card1.querySelectorAll('.command-entry'); |
| 83 assertEquals(1, commands.length); | 83 assertEquals(1, commands.length); |
| 84 expectTrue(isVisibleOnCard(commands[0], '.command-name')); | 84 expectTrue(isVisibleOnCard(commands[0], '.command-name')); |
| 85 expectTrue(isVisibleOnCard(commands[0], '.command-keys')); | |
| 86 expectFalse(isVisibleOnCard(commands[0], '.no-command-set')); | |
| 87 expectTrue(isVisibleOnCard(commands[0], 'paper-dropdown-menu')); | 85 expectTrue(isVisibleOnCard(commands[0], 'paper-dropdown-menu')); |
| 88 | 86 |
| 89 var card2 = cards[1]; | 87 var card2 = cards[1]; |
| 90 commands = card2.querySelectorAll('.command-entry'); | 88 commands = card2.querySelectorAll('.command-entry'); |
| 91 assertEquals(2, commands.length); | 89 assertEquals(2, commands.length); |
| 92 expectFalse(isVisibleOnCard(commands[1], '.command-keys')); | |
| 93 expectTrue(isVisibleOnCard(commands[1], '.no-command-set')); | |
| 94 | 90 |
| 95 expectEquals( | 91 expectEquals( |
| 96 1, | 92 1, |
| 97 keyboardShortcuts.computeSelectedScope_(twoCommands.commands[0])); | 93 keyboardShortcuts.computeSelectedScope_(twoCommands.commands[0])); |
| 98 expectEquals( | 94 expectEquals( |
| 99 0, | 95 0, |
| 100 keyboardShortcuts.computeSelectedScope_(twoCommands.commands[1])); | 96 keyboardShortcuts.computeSelectedScope_(twoCommands.commands[1])); |
| 101 }); | 97 }); |
| 102 }); | 98 }); |
| 103 suite(assert(TestNames.ShortcutUtil), function() { | 99 suite(assert(TestNames.ShortcutUtil), function() { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 128 expectEquals('Ctrl+Shift+A', extensions.keystrokeToString(e)); | 124 expectEquals('Ctrl+Shift+A', extensions.keystrokeToString(e)); |
| 129 }); | 125 }); |
| 130 }); | 126 }); |
| 131 } | 127 } |
| 132 | 128 |
| 133 return { | 129 return { |
| 134 registerTests: registerTests, | 130 registerTests: registerTests, |
| 135 TestNames: TestNames, | 131 TestNames: TestNames, |
| 136 }; | 132 }; |
| 137 }); | 133 }); |
| OLD | NEW |