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

Unified Diff: chrome/test/data/webui/settings/settings_toggle_button_tests.js

Issue 2681373002: MD Settings: Fix the Network Prediction toggle box. (Closed)
Patch Set: fix the merge Created 3 years, 10 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
« no previous file with comments | « chrome/browser/resources/settings/privacy_page/privacy_page.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/webui/settings/settings_toggle_button_tests.js
diff --git a/chrome/test/data/webui/settings/settings_toggle_button_tests.js b/chrome/test/data/webui/settings/settings_toggle_button_tests.js
index 212cf2d8b652ce82a8a278e59b26dfa5de485ffb..212a0372d69ccd10df60d011e2dc934ebd6cb567 100644
--- a/chrome/test/data/webui/settings/settings_toggle_button_tests.js
+++ b/chrome/test/data/webui/settings/settings_toggle_button_tests.js
@@ -94,6 +94,55 @@ cr.define('settings_toggle_button', function() {
assertTrue(testElement.checked);
assertEquals(1, prefNum.value);
});
+
+ test('numerical pref with custom values', function() {
+ var prefNum = {
+ key: 'test',
+ type: chrome.settingsPrivate.PrefType.NUMBER,
+ value: 5
+ };
+
+ testElement.numericUncheckedValue = 5;
+
+ testElement.set('pref', prefNum);
+ assertFalse(testElement.checked);
+
+ testElement.setAttribute('checked', '');
+ assertTrue(testElement.checked);
+ assertEquals(1, prefNum.value);
+
+ testElement.removeAttribute('checked');
+ assertFalse(testElement.checked);
+ assertEquals(5, prefNum.value);
+ });
+
+ test('numerical pref with unknown inital value', function() {
+ prefNum = {
+ key: 'test',
+ type: chrome.settingsPrivate.PrefType.NUMBER,
+ value: 3
+ };
+
+ testElement.numericUncheckedValue = 5;
+
+ testElement.set('pref', prefNum);
+
+ // Unknown value should still count as checked.
+ assertTrue(testElement.checked);
+
+ // The control should not clobber an existing unknown value.
+ assertEquals(3, prefNum.value);
+
+ // Unchecking should still send the unchecked value to prefs.
+ testElement.removeAttribute('checked');
+ assertFalse(testElement.checked);
+ assertEquals(5, prefNum.value);
+
+ // Checking should still send the normal checked value to prefs.
+ testElement.setAttribute('checked', '');
+ assertTrue(testElement.checked);
+ assertEquals(1, prefNum.value);
+ });
});
}
« no previous file with comments | « chrome/browser/resources/settings/privacy_page/privacy_page.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698