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

Unified Diff: LayoutTests/screen_orientation/screenorientation-api.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: ready for review 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
Index: LayoutTests/screen_orientation/screenorientation-api.html
diff --git a/LayoutTests/screen_orientation/screenorientation-api.html b/LayoutTests/screen_orientation/screenorientation-api.html
index 6d731bdc8a2d4e12d30424fe09ca6d69c1a3ec3c..fefb3fe32840c2a43806a0ea5eb42c7b9e2f0c5c 100644
--- a/LayoutTests/screen_orientation/screenorientation-api.html
+++ b/LayoutTests/screen_orientation/screenorientation-api.html
@@ -6,29 +6,72 @@
<script>
test(function() {
- assert_true('orientation' in window.screen);
- assert_true('angle' in window.screen.orientation);
- assert_true('type' in window.screen.orientation);
- assert_true('lock' in window.screen.orientation);
- assert_true('unlock' in window.screen.orientation);
- assert_true('onchange' in window.screen.orientation);
-}, "Test that the Screen Orientation API is present.")
+ assert_true('autocapitalize' in document.createElement('input'));
+}, "Test that the autocapitalize is avaible on HTMLInputElement.")
test(function() {
- assert_equals(typeof(screen.orientation), "object");
- assert_equals(typeof(screen.orientation.angle), "number");
- assert_equals(typeof(screen.orientation.type), "string");
- assert_equals(typeof(screen.orientation.lock), "function");
- assert_equals(typeof(screen.orientation.unlock), "function");
- assert_equals(typeof(screen.orientation.onchange), "object");
-}, "Test Screen Orientation API property types.");
+ assert_true('autocapitalize' in document.createElement('textarea'));
+}, "Test that the autocapitalize is avaible on HTMLTextAreaElement.")
test(function() {
- assert_true('addEventListener' in screen.orientation);
- assert_true('removeEventListener' in screen.orientation);
- assert_true('dispatchEvent' in screen.orientation);
- assert_true(screen.orientation instanceof EventTarget)
-}, "Test that screen.orientation is an EventTarget.");
+ var elements = [ document.createElement('input'),
+ document.createElement('textarea') ];
+
+ elements.forEach(function(e) {
+ e.autocapitalize = 'on';
+ assert_equals('sentences', e.autocapitalize);
+
+ e.autocapitalize = 'off';
+ assert_equals('none', e.autocapitalize);
+ });
+}, "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(defaultValue, e.autocapitalize);
+
+ // Invalid value.
+ e.autocapitalize = 'foo';
+ assert_equals(defaultValue, e.autocapitalize);
+ assert_equals('foo', e.getAtribute('autocapitalize'));
+ e.setAttribute('autocapitalize', 'bar');
+ assert_equals(defaultValue, e.autocapitalize);
+ assert_equals('bar', e.getAtribute('autocapitalize'));
+
+ // Default value.
+ e.removeAttribute('autocapitalize');
+ assert_equals(defaultValue, e.autocapitalize);
+ assert_equals(null, e.getAtribute('autocapitalize'));
+
+ // Case insensitive.
+ e.setAttribute('autocapitalize', 'NoNe');
+ assert_equals('none', e.autocapitalize);
+ assert_equals('none', e.getAtribute('autocapitalize'));
+ e.autocapitalize = 'WORDS';
+ assert_equals('words', e.autocapitalize);
+ assert_equals('words', e.getAtribute('autocapitalize'));
+
+ knownValues.forEach(function(value) {
+ e.setAttribute('autocapitalize', value);
+ assert_equals(value, e.autocapitalize);
+ assert_equals(value, e.getAtribute('autocapitalize'));
+
+ e.removeAttribute('autocapitalize');
+
+ e.autocapitalize = value;
+ assert_equals(value, e.autocapitalize);
+ assert_equals(value, e.getAtribute('autocapitalize'));
+
+ e.removeAttribute('autocapitalize');
+ });
+ });
+}, "Test reflection of autocapitalize.");
</script>
</body>

Powered by Google App Engine
This is Rietveld 408576698