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

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

Issue 2783513002: MD Settings: Display error messages in "add" and "edit" exception dialogs. (Closed)
Patch Set: Remove left overs (again) 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/settings/site_settings/edit_exception_dialog.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/site_list_tests.js
diff --git a/chrome/test/data/webui/settings/site_list_tests.js b/chrome/test/data/webui/settings/site_list_tests.js
index 16732132dcd133f9986334b880c2ad72c7d39b1a..83a81cf8fccd4f81b84f55f09573825e5fd67881 100644
--- a/chrome/test/data/webui/settings/site_list_tests.js
+++ b/chrome/test/data/webui/settings/site_list_tests.js
@@ -1056,7 +1056,8 @@ cr.define('site_list', function() {
}
suite('EditExceptionDialog', function() {
- var dialog;
+ /** @type {SettingsEditExceptionDialogElement} */ var dialog;
+
/**
* The dialog tests don't call |getExceptionList| so the exception needs to
* be processes as a |SiteSettingsPref|.
@@ -1085,22 +1086,32 @@ cr.define('site_list', function() {
dialog.remove();
});
- test('action button disabled on invalid input', function() {
+ test('invalid input', function() {
var input = dialog.$$('paper-input');
assertTrue(!!input);
+ assertFalse(input.invalid);
+
var actionButton = dialog.$.actionButton;
assertTrue(!!actionButton);
assertFalse(actionButton.disabled);
+ // Simulate user input of whitespace only text.
+ input.value = ' ';
+ input.fire('input');
+ Polymer.dom.flush();
+ assertTrue(actionButton.disabled);
+ assertTrue(input.invalid);
+
+ // Simulate user input of invalid text.
browserProxy.setIsPatternValid(false);
var expectedPattern = 'foobarbaz';
- // Simulate user input.
input.value = expectedPattern;
input.fire('input');
return browserProxy.whenCalled('isPatternValid').then(function(pattern) {
assertEquals(expectedPattern, pattern);
assertTrue(actionButton.disabled);
+ assertTrue(input.invalid);
});
});
@@ -1137,6 +1148,48 @@ cr.define('site_list', function() {
});
});
+ suite('AddExceptionDialog', function() {
+ /** @type {AddSiteDialogElement} */ var dialog;
+
+ setup(function() {
+ browserProxy = new TestSiteSettingsPrefsBrowserProxy();
+ settings.SiteSettingsPrefsBrowserProxyImpl.instance_ = browserProxy;
+ PolymerTest.clearBody();
+ dialog = document.createElement('add-site-dialog');
+ dialog.category = settings.ContentSettingsTypes.GEOLOCATION;
+ dialog.contentSetting = settings.PermissionValues.ALLOW;
+ document.body.appendChild(dialog);
+ });
+
+ teardown(function() {
+ dialog.remove();
+ });
+
+ test('invalid input', function() {
+ // Initially the action button should be disabled, but the error warning
+ // should not be shown for an empty input.
+ var input = dialog.$$('paper-input');
+ assertTrue(!!input);
+ assertFalse(input.invalid);
+
+ var actionButton = dialog.$.add;
+ assertTrue(!!actionButton);
+ assertTrue(actionButton.disabled);
+
+ // Simulate user input of invalid text.
+ browserProxy.setIsPatternValid(false);
+ var expectedPattern = 'foobarbaz';
+ input.value = expectedPattern;
+ input.fire('input');
+
+ return browserProxy.whenCalled('isPatternValid').then(function(pattern) {
+ assertEquals(expectedPattern, pattern);
+ assertTrue(actionButton.disabled);
+ assertTrue(input.invalid);
+ });
+ });
+ });
+
return {
registerTests: registerTests,
};
« no previous file with comments | « chrome/browser/resources/settings/site_settings/edit_exception_dialog.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698