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

Side by Side Diff: chrome/test/data/webui/settings/settings_toggle_button_tests.js

Issue 2718253006: MD Settings: checkbox: Support inverted when setting pref (Closed)
Patch Set: Rebase Created 3 years, 9 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
« no previous file with comments | « chrome/browser/resources/settings/controls/settings_boolean_control_behavior.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 settings-toggle-button. */ 5 /** @fileoverview Suite of tests for settings-toggle-button. */
6 cr.define('settings_toggle_button', function() { 6 cr.define('settings_toggle_button', function() {
7 function registerTests() { 7 function registerTests() {
8 suite('SettingsToggleButton', function() { 8 suite('SettingsToggleButton', function() {
9 /** 9 /**
10 * Toggle button created before each test. 10 * Toggle button created before each test.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 testElement.checked = false; 57 testElement.checked = false;
58 testElement.setAttribute('disabled', ''); 58 testElement.setAttribute('disabled', '');
59 assertTrue(testElement.disabled); 59 assertTrue(testElement.disabled);
60 assertTrue(testElement.$.control.disabled); 60 assertTrue(testElement.$.control.disabled);
61 61
62 MockInteractions.tap(testElement.$.control); 62 MockInteractions.tap(testElement.$.control);
63 assertFalse(testElement.checked); 63 assertFalse(testElement.checked);
64 assertFalse(testElement.$.control.checked); 64 assertFalse(testElement.$.control.checked);
65 }); 65 });
66 66
67 test('inverted', function() {
68 testElement.inverted = true;
69 testElement.set('pref', {
70 key: 'test',
71 type: chrome.settingsPrivate.PrefType.BOOLEAN,
72 value: true
73 });
74
75 assertTrue(testElement.pref.value);
76 assertFalse(testElement.checked);
77
78 MockInteractions.tap(testElement.$.control);
79 assertFalse(testElement.pref.value);
80 assertTrue(testElement.checked);
81
82 MockInteractions.tap(testElement.$.control);
83 assertTrue(testElement.pref.value);
84 assertFalse(testElement.checked);
85 });
86
67 test('numerical pref', function() { 87 test('numerical pref', function() {
68 var prefNum = { 88 var prefNum = {
69 key: 'test', 89 key: 'test',
70 type: chrome.settingsPrivate.PrefType.NUMBER, 90 type: chrome.settingsPrivate.PrefType.NUMBER,
71 value: 1 91 value: 1
72 }; 92 };
73 93
74 testElement.set('pref', prefNum); 94 testElement.set('pref', prefNum);
75 assertTrue(testElement.checked); 95 assertTrue(testElement.checked);
76 96
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 assertTrue(testElement.checked); 151 assertTrue(testElement.checked);
132 assertEquals(1, prefNum.value); 152 assertEquals(1, prefNum.value);
133 }); 153 });
134 }); 154 });
135 } 155 }
136 156
137 return { 157 return {
138 registerTests: registerTests, 158 registerTests: registerTests,
139 }; 159 };
140 }); 160 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/settings/controls/settings_boolean_control_behavior.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698