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

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

Issue 1486953003: Support numbers in settings-checkbox (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase + Feedback Created 5 years 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_checkbox.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-checkbox. */ 5 /** @fileoverview Suite of tests for settings-checkbox. */
6 cr.define('settings_checkbox', function() { 6 cr.define('settings_checkbox', function() {
7 function registerTests() { 7 function registerTests() {
8 suite('SettingsCheckbox', function() { 8 suite('SettingsCheckbox', function() {
9 /** 9 /**
10 * Checkbox created before each test. 10 * Checkbox created before each test.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 test('does not change when disabled', function() { 59 test('does not change when disabled', function() {
60 testElement.checked = false; 60 testElement.checked = false;
61 testElement.setAttribute('disabled', ''); 61 testElement.setAttribute('disabled', '');
62 assertTrue(testElement.disabled); 62 assertTrue(testElement.disabled);
63 assertTrue(testElement.$.checkbox.disabled); 63 assertTrue(testElement.$.checkbox.disabled);
64 64
65 MockInteractions.tap(testElement.$.checkbox); 65 MockInteractions.tap(testElement.$.checkbox);
66 assertFalse(testElement.checked); 66 assertFalse(testElement.checked);
67 assertFalse(testElement.$.checkbox.checked); 67 assertFalse(testElement.$.checkbox.checked);
68 }); 68 });
69
70 test('numerical pref', function() {
71 var prefNum = {
72 key: 'test',
73 type: chrome.settingsPrivate.PrefType.NUMBER,
74 value: 1
75 };
76
77 testElement.set('pref', prefNum);
78 assertTrue(testElement.checked);
79
80 testElement.removeAttribute('checked');
81 assertFalse(testElement.checked);
82 assertEquals(0, prefNum.value);
83
84 testElement.setAttribute('checked', '');
85 assertTrue(testElement.checked);
86 assertEquals(1, prefNum.value);
87 });
69 }); 88 });
70 } 89 }
71 90
72 return { 91 return {
73 registerTests: registerTests, 92 registerTests: registerTests,
74 }; 93 };
75 }); 94 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/settings/controls/settings_checkbox.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698