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

Unified Diff: LayoutTests/fast/forms/autocapitalize.html

Issue 995363002: Implement autocapitalize in Blink to be used by the embedder. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: update webexposed tests Created 5 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 | « no previous file | LayoutTests/virtual/stable/webexposed/element-instance-property-listing-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/forms/autocapitalize.html
diff --git a/LayoutTests/fast/forms/autocapitalize.html b/LayoutTests/fast/forms/autocapitalize.html
new file mode 100644
index 0000000000000000000000000000000000000000..4b6092b5df834bbafc1884f72a1c73631434b36c
--- /dev/null
+++ b/LayoutTests/fast/forms/autocapitalize.html
@@ -0,0 +1,100 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script>
+
+test(function() {
+ assert_true('autocapitalize' in document.createElement('input'));
+}, "Test that the autocapitalize is avaible on HTMLInputElement.")
+
+test(function() {
+ assert_true('autocapitalize' in document.createElement('textarea'));
+}, "Test that the autocapitalize is avaible on HTMLTextAreaElement.")
+
+test(function() {
+ var elements = [ document.createElement('input'),
+ document.createElement('textarea') ];
+
+ elements.forEach(function(e) {
+ e.autocapitalize = 'on';
+ assert_equals(e.autocapitalize, 'sentences');
+
+ e.autocapitalize = 'off';
+ assert_equals(e.autocapitalize, 'none');
+ });
+}, "Test deprecated values of autocapitalize.");
+
+test(function() {
+ var elements = [ document.createElement('input'),
+ document.createElement('textarea') ];
+ var knownValues = [ 'none', 'characters', 'words', 'sentences' ];
+
+ var defaultValue = 'sentences';
+ elements.forEach(function(e) {
+ // Default value.
+ assert_equals(e.autocapitalize, defaultValue);
+
+ // Invalid value.
+ e.autocapitalize = 'foo';
+ assert_equals(e.autocapitalize, defaultValue);
+ assert_equals(e.getAttribute('autocapitalize'), 'foo');
+ e.setAttribute('autocapitalize', 'bar');
+ assert_equals(e.autocapitalize, defaultValue);
+ assert_equals(e.getAttribute('autocapitalize'), 'bar');
+
+ // Default value.
+ e.removeAttribute('autocapitalize');
+ assert_equals(defaultValue, e.autocapitalize);
+ assert_equals(e.getAttribute('autocapitalize'), null);
+
+ // Case insensitive.
+ e.setAttribute('autocapitalize', 'NoNe');
+ assert_equals(e.autocapitalize, 'none');
+ assert_equals(e.getAttribute('autocapitalize'), 'NoNe');
+ e.autocapitalize = 'WORDS';
+ assert_equals(e.autocapitalize, 'words');
+ assert_equals(e.getAttribute('autocapitalize'), 'WORDS');
+
+ knownValues.forEach(function(value) {
+ e.setAttribute('autocapitalize', value);
+ assert_equals(e.autocapitalize, value);
+ assert_equals(e.getAttribute('autocapitalize'), value);
+
+ e.removeAttribute('autocapitalize');
+
+ e.autocapitalize = value;
+ assert_equals(e.autocapitalize, value);
+ assert_equals(e.getAttribute('autocapitalize'), value);
+
+ e.removeAttribute('autocapitalize');
+ });
+ });
+}, "Test reflection of autocapitalize.");
+
+test(function() {
+ var testData = [
+ // Types with sentences as default value.
+ { type: 'text', value: 'sentences' },
+ { type: 'search', value: 'sentences' },
+ // Types supporting the features with none as default value.
+ { type: 'email', value: 'none' },
+ { type: 'url', value: 'none' },
+ { type: 'tel', value: 'none' },
+ // Other types that do not support the value.
+ { type: 'number', value: 'none' },
+ { type: 'date', value: 'none' },
+ { type: 'color', value: 'none' }
+ ];
+
+ testData.forEach(function(data) {
+ var input = document.createElement('input');
+ input.type = data.type;
+ assert_equals(input.autocapitalize, data.value);
+ });
+}, "Test the default value depending on <input> type.")
+
+</script>
+</body>
+</html>
« no previous file with comments | « no previous file | LayoutTests/virtual/stable/webexposed/element-instance-property-listing-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698