Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / forms / autocapitalize.html
blob4b6092b5df834bbafc1884f72a1c73631434b36c
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <script src="../../resources/testharness.js"></script>
5 <script src="../../resources/testharnessreport.js"></script>
6 <script>
8 test(function() {
9 assert_true('autocapitalize' in document.createElement('input'));
10 }, "Test that the autocapitalize is avaible on HTMLInputElement.")
12 test(function() {
13 assert_true('autocapitalize' in document.createElement('textarea'));
14 }, "Test that the autocapitalize is avaible on HTMLTextAreaElement.")
16 test(function() {
17 var elements = [ document.createElement('input'),
18 document.createElement('textarea') ];
20 elements.forEach(function(e) {
21 e.autocapitalize = 'on';
22 assert_equals(e.autocapitalize, 'sentences');
24 e.autocapitalize = 'off';
25 assert_equals(e.autocapitalize, 'none');
26 });
27 }, "Test deprecated values of autocapitalize.");
29 test(function() {
30 var elements = [ document.createElement('input'),
31 document.createElement('textarea') ];
32 var knownValues = [ 'none', 'characters', 'words', 'sentences' ];
34 var defaultValue = 'sentences';
35 elements.forEach(function(e) {
36 // Default value.
37 assert_equals(e.autocapitalize, defaultValue);
39 // Invalid value.
40 e.autocapitalize = 'foo';
41 assert_equals(e.autocapitalize, defaultValue);
42 assert_equals(e.getAttribute('autocapitalize'), 'foo');
43 e.setAttribute('autocapitalize', 'bar');
44 assert_equals(e.autocapitalize, defaultValue);
45 assert_equals(e.getAttribute('autocapitalize'), 'bar');
47 // Default value.
48 e.removeAttribute('autocapitalize');
49 assert_equals(defaultValue, e.autocapitalize);
50 assert_equals(e.getAttribute('autocapitalize'), null);
52 // Case insensitive.
53 e.setAttribute('autocapitalize', 'NoNe');
54 assert_equals(e.autocapitalize, 'none');
55 assert_equals(e.getAttribute('autocapitalize'), 'NoNe');
56 e.autocapitalize = 'WORDS';
57 assert_equals(e.autocapitalize, 'words');
58 assert_equals(e.getAttribute('autocapitalize'), 'WORDS');
60 knownValues.forEach(function(value) {
61 e.setAttribute('autocapitalize', value);
62 assert_equals(e.autocapitalize, value);
63 assert_equals(e.getAttribute('autocapitalize'), value);
65 e.removeAttribute('autocapitalize');
67 e.autocapitalize = value;
68 assert_equals(e.autocapitalize, value);
69 assert_equals(e.getAttribute('autocapitalize'), value);
71 e.removeAttribute('autocapitalize');
72 });
73 });
74 }, "Test reflection of autocapitalize.");
76 test(function() {
77 var testData = [
78 // Types with sentences as default value.
79 { type: 'text', value: 'sentences' },
80 { type: 'search', value: 'sentences' },
81 // Types supporting the features with none as default value.
82 { type: 'email', value: 'none' },
83 { type: 'url', value: 'none' },
84 { type: 'tel', value: 'none' },
85 // Other types that do not support the value.
86 { type: 'number', value: 'none' },
87 { type: 'date', value: 'none' },
88 { type: 'color', value: 'none' }
91 testData.forEach(function(data) {
92 var input = document.createElement('input');
93 input.type = data.type;
94 assert_equals(input.autocapitalize, data.value);
95 });
96 }, "Test the default value depending on <input> type.")
98 </script>
99 </body>
100 </html>