From 5eab693742360e662107dac920891add7fd5cbdc Mon Sep 17 00:00:00 2001 From: Kazuki KANAMORI Date: Sat, 8 Jun 2013 14:38:47 +0900 Subject: [PATCH 1/3] added input[type=email] test --- .../forms/the-input-element/email.html | 128 ++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 html/semantics/forms/the-input-element/email.html diff --git a/html/semantics/forms/the-input-element/email.html b/html/semantics/forms/the-input-element/email.html new file mode 100644 index 00000000000000..cddf2e9ca70a53 --- /dev/null +++ b/html/semantics/forms/the-input-element/email.html @@ -0,0 +1,128 @@ + + + + Input Email + + + + + + + +

Input email

+ + + +
+
+ + + + + From dfbb97a37043098334f5a508edcf9861de99579c Mon Sep 17 00:00:00 2001 From: Kazuki KANAMORI Date: Sat, 8 Jun 2013 14:56:42 +0900 Subject: [PATCH 2/3] removed unnecessary viewport meta tags --- html/semantics/forms/the-input-element/email.html | 1 - 1 file changed, 1 deletion(-) diff --git a/html/semantics/forms/the-input-element/email.html b/html/semantics/forms/the-input-element/email.html index cddf2e9ca70a53..8af2b926f18218 100644 --- a/html/semantics/forms/the-input-element/email.html +++ b/html/semantics/forms/the-input-element/email.html @@ -2,7 +2,6 @@ Input Email - From 260b57d31f5b5ec77d614d40c6901da6448eacd2 Mon Sep 17 00:00:00 2001 From: Kazuki KANAMORI Date: Sat, 8 Jun 2013 15:55:37 +0900 Subject: [PATCH 3/3] Modified not to use nested test. --- .../forms/the-input-element/email.html | 160 +++++++++--------- 1 file changed, 80 insertions(+), 80 deletions(-) diff --git a/html/semantics/forms/the-input-element/email.html b/html/semantics/forms/the-input-element/email.html index 8af2b926f18218..6c2d04583511e2 100644 --- a/html/semantics/forms/the-input-element/email.html +++ b/html/semantics/forms/the-input-element/email.html @@ -26,101 +26,101 @@

Input email

assert_equals(attributes.length, 4); for (var i = 0; i < attributes.length; i++) { if (attributes[i].name === 'multiple') { - assert_true(true); return; } } assert_unreached(); }, '"multiple" attribute supported for input:email element'); + // When the multiple attribute is NOT specified on the element + var element = document.getElementsByTagName('input')[0]; test(function(){ - var element = document.getElementsByTagName('input')[0]; - test(function(){ - element.value = ''; - assert_equals(element.value, ''); - }, 'User agents should allow the user to set the value to the empty string'); - test(function(){ - element.value = 'user@example.com\u000A'; - assert_equals(element.value, 'user@example.com'); - }, 'User agents must not allow users to insert "LF" (U+000A) character into the value'); - test(function(){ - element.value = 'user@example.com\u000D'; - assert_equals(element.value, 'user@example.com'); - }, 'User agents must not allow users to insert "CR" (U+000D) character into the value'); - test(function(){ - element.value = 'user@example.com'; - assert_true(validEmailRegexp.test(element.value)); - }, 'The value attribute, if specified and not empty, must have a value that is a single valid e-mail address'); - test(function(){ - element.setAttribute('multiple', null); - element.value = ' user@example.com , user2@example.com '; - element.removeAttribute('multiple'); - assert_equals(element.value, 'user@example.com'); - assert_true(validEmailRegexp.test(element.value)); - }, 'When the multiple attribute is removed, the user agent must run the value sanitization algorithm') - }, - 'When the multiple attribute is NOT specified on the element'); + element.value = ''; + assert_equals(element.value, ''); + }, 'User agents should allow the user to set the value to the empty string'); + test(function(){ + element.value = 'user2@example.com\u000A'; + assert_equals(element.value, 'user2@example.com'); + }, 'User agents must not allow users to insert "LF" (U+000A) character into the value'); + test(function(){ + element.value = 'user3@example.com\u000D'; + assert_equals(element.value, 'user3@example.com'); + }, 'User agents must not allow users to insert "CR" (U+000D) character into the value'); + test(function(){ + element.value = 'user4@example.com'; + assert_true(validEmailRegexp.test(element.value)); + }, 'The value attribute, if specified and not empty, must have a value that is a single valid e-mail address'); + test(function(){ + element.setAttribute('multiple', null); + element.value = ' user@example.com , user2@example.com '; + element.removeAttribute('multiple'); + assert_equals(element.value, 'user@example.com'); + assert_true(validEmailRegexp.test(element.value)); + }, 'When the multiple attribute is removed, the user agent must run the value sanitization algorithm'); + // When the mutiple attribute is specified on the element + element = document.getElementById('multiple_email'); + test(function(){ + var values = element.values; + assert_not_equals(typeof values, 'undefined', 'type of values'); + assert_equals(values.length, 2); + assert_equals(values[0], 'user1@example.com'); + assert_equals(values[1], 'user2@test.com'); + }, 'The element\'s values are the result of splitting on commas the element\'s value.'); test(function(){ - var element = document.getElementById('multiple_email'); + element.value = ''; + var values = element.values; + assert_not_equals(typeof values, 'undefined', 'type of values'); + values.push('user,@example.com'); + assert_equals(values.length, 0); + }, 'User agents must not allow users to set any individual value to a string containing "," (U+002C) character'); + test(function(){ + element.value = ''; + var values = element.values; + assert_not_equals(typeof values, 'undefined', 'type of values'); + values.push('user@e\u000Axample.com'); + assert_equals(values.length, 0); + }, 'User agents must not allow users to set any individual value to a string containing "LF" (U+000A) character'); + test(function(){ + element.value = ''; + var values = element.values; + assert_not_equals(typeof values, 'undefined', 'type of values'); + values.push('user@e\u000Dxample.com'); + assert_equals(values.length, 0); + }, 'User agents must not allow users to set any individual value to a string containing "CR" (U+000D) character'); + + // Whenever the user changes the element\'s values, the user agent must run the following steps + (function(){ + element.value = ' user1@example.com , user2@test.com, user3@test.com '; + var values = element.values; + assert_not_equals(typeof values, 'undefined', 'type of values'); + test(function(){ + assert_equals(values.length, 3); + }, 'Let latest values be a copy of the element\'s values.'); test(function(){ - var values = element.values; - assert_not_equals(typeof values, 'undefined', 'type of values'); - assert_equals(values.length, 2); assert_equals(values[0], 'user1@example.com'); assert_equals(values[1], 'user2@test.com'); - }, 'The element\'s values are the result of splitting on commas the element\'s value.'); - test(function(){ - element.value = ''; - var values = element.values; - assert_not_equals(typeof values, 'undefined', 'type of values'); - values.push('user,@example.com'); - assert_equals(values.length, 0); - }, 'User agents must not allow users to set any individual value to a string containing "," (U+002C) character'); + assert_equals(values[2], 'user3@test.com'); + }, 'Strip leading and trailing whitespace from each value in latest values') test(function(){ - element.value = ''; - var values = element.values; - assert_not_equals(typeof values, 'undefined', 'type of values'); - values.push('user@e\u000Axample.com'); - assert_equals(values.length, 0); - }, 'User agents must not allow users to set any individual value to a string containing "LF" (U+000A) character'); - test(function(){ - element.value = ''; - var values = element.values; - assert_not_equals(typeof values, 'undefined', 'type of values'); - values.push('user@e\u000Dxample.com'); - assert_equals(values.length, 0); - }, 'User agents must not allow users to set any individual value to a string containing "CR" (U+000D) character'); + assert_equals(element.value, 'user1@example.com,user2@test.com,user3@test.com'); + }, 'Let the element\'s value be the result of concatenating all the values in latest values, separating each value from the next by a single "," (U+002C) character, maintaining the list\'s order.'); + })(); + + // When the multiple attribute is set, the user agent must run the value sanitization algorithm + (function(){ + element.value = ' user1@example.com , user2@test.com, user3@test.com '; + var values = element.values; + assert_not_equals(typeof values, 'undefined', 'type of values'); test(function(){ - element.value = ' user1@example.com , user2@test.com, user3@test.com '; - var values = element.values; - assert_not_equals(typeof values, 'undefined', 'type of values'); - test(function(){ - assert_equals(values.length, 3); - }, 'Let latest values be a copy of the element\'s values.'); - test(function(){ - assert_equals(values[0], 'user1@example.com'); - assert_equals(values[1], 'user2@test.com'); - assert_equals(values[2], 'user3@test.com'); - }, 'Strip leading and trailing whitespace from each value in latest values') - test(function(){ - assert_equals(element.value, 'user1@example.com,user2@test.com,user3@test.com'); - }, 'Let the element\'s value be the result of concatenating all the values in latest values, separating each value from the next by a single "," (U+002C) character, maintaining the list\'s order.'); - }, 'Whenever the user changes the element\'s values, the user agent must run the following steps'); + assert_equals(values[0], 'user1@example.com'); + assert_equals(values[1], 'user2@test.com'); + assert_equals(values[2], 'user3@test.com'); + }, 'Split on commas the element\'s value, strip leading and trailing whitespace from each resulting token, if any, and let the element\'s values be the (possibly empty) resulting list of (possibly empty) tokens, maintaining the original order.'); test(function(){ - element.value = ' user1@example.com , user2@test.com, user3@test.com '; - var values = element.values; - assert_not_equals(typeof values, 'undefined', 'type of values'); - test(function(){ - assert_equals(values[0], 'user1@example.com'); - assert_equals(values[1], 'user2@test.com'); - assert_equals(values[2], 'user3@test.com'); - }, 'Split on commas the element\'s value, strip leading and trailing whitespace from each resulting token, if any, and let the element\'s values be the (possibly empty) resulting list of (possibly empty) tokens, maintaining the original order.'); - test(function(){ - assert_equals(element.value, 'user1@example.com,user2@test.com,user3@test.com'); - }, 'Let the element\'s value be the result of concatenating the element\'s values, separating each value from the next by a single "," (U+002C) character, maintaining the list\'s order'); - }, 'When the multiple attribute is set, the user agent must run the value sanitization algorithm'); - }, 'When the mutiple attribute is specified on the element'); + assert_equals(element.value, 'user1@example.com,user2@test.com,user3@test.com'); + }, 'Let the element\'s value be the result of concatenating the element\'s values, separating each value from the next by a single "," (U+002C) character, maintaining the list\'s order'); + })();