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 cr.define('settings_device_page', function() { | 5 cr.define('settings_device_page', function() { |
6 /** @return {!DevicePageElement} */ | 6 /** @return {!DevicePageElement} */ |
7 function getDevicePage() { | 7 function getDevicePage() { |
8 var devicePage = document.createElement('settings-device-page'); | 8 var devicePage = document.createElement('settings-device-page'); |
9 var page = this.getPage('basic'); | 9 var page = this.getPage('basic'); |
10 var deviceSection = this.getSection(page, 'device'); | 10 var deviceSection = this.getSection(page, 'device'); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 }, { | 46 }, { |
47 key: 'settings.language.remap_diamond_key_to', | 47 key: 'settings.language.remap_diamond_key_to', |
48 type: chrome.settingsPrivate.PrefType.NUMBER, | 48 type: chrome.settingsPrivate.PrefType.NUMBER, |
49 value: 3, | 49 value: 3, |
50 }, { | 50 }, { |
51 key: 'settings.language.send_function_keys', | 51 key: 'settings.language.send_function_keys', |
52 type: chrome.settingsPrivate.PrefType.BOOLEAN, | 52 type: chrome.settingsPrivate.PrefType.BOOLEAN, |
53 value: false, | 53 value: false, |
54 }]; | 54 }]; |
55 | 55 |
56 test('keyboard subpage', function() { | 56 var devicePage; |
57 var devicePage = document.createElement('settings-device-page'); | 57 |
| 58 setup(function() { |
| 59 devicePage = document.createElement('settings-device-page'); |
58 devicePage.currentRoute = {page: 'basic', section: '', subpage: []}; | 60 devicePage.currentRoute = {page: 'basic', section: '', subpage: []}; |
59 devicePage.prefs = fakePrefs; | 61 devicePage.prefs = fakePrefs; |
| 62 Polymer.dom.flush(); |
| 63 }); |
60 | 64 |
| 65 test('keyboard subpage', function() { |
61 // Open the keyboard subpage. | 66 // Open the keyboard subpage. |
62 var keyboardRow = devicePage.$$('#main #keyboardRow'); | 67 var keyboardRow = devicePage.$$('#main #keyboardRow'); |
63 assertTrue(!!keyboardRow); | 68 assertTrue(!!keyboardRow); |
64 MockInteractions.tap(keyboardRow); | 69 MockInteractions.tap(keyboardRow); |
65 expectEquals(devicePage.currentRoute.section, 'device'); | 70 expectEquals(devicePage.currentRoute.section, 'device'); |
66 expectEquals(devicePage.currentRoute.subpage[0], 'keyboard'); | 71 expectEquals(devicePage.currentRoute.subpage[0], 'keyboard'); |
67 var keyboardPage = devicePage.$$('#keyboard settings-keyboard'); | 72 var keyboardPage = devicePage.$$('#keyboard settings-keyboard'); |
68 assertTrue(!!keyboardPage); | 73 assertTrue(!!keyboardPage); |
69 | 74 |
70 // Initially, the optional keys are hidden. | 75 // Initially, the optional keys are hidden. |
(...skipping 12 matching lines...) Expand all Loading... |
83 // Pretend a Caps Lock key is now available. | 88 // Pretend a Caps Lock key is now available. |
84 showCapsLock = true; | 89 showCapsLock = true; |
85 cr.webUIListenerCallback( | 90 cr.webUIListenerCallback( |
86 'show-keys-changed', showCapsLock, showDiamondKey); | 91 'show-keys-changed', showCapsLock, showDiamondKey); |
87 Polymer.dom.flush(); | 92 Polymer.dom.flush(); |
88 expectTrue(!!keyboardPage.$$('#capsLockKey')); | 93 expectTrue(!!keyboardPage.$$('#capsLockKey')); |
89 expectTrue(!!keyboardPage.$$('#diamondKey')); | 94 expectTrue(!!keyboardPage.$$('#diamondKey')); |
90 }); | 95 }); |
91 }); | 96 }); |
92 }); | 97 }); |
OLD | NEW |