Update web-platform-tests to revision 0159b3ec9ba5355a3340621226e02ae026effd7f

This commit is contained in:
Ms2ger 2015-09-22 16:41:09 +02:00
parent d588ce8d85
commit 43a50e298a
37 changed files with 1341 additions and 62 deletions

View file

@ -23,7 +23,8 @@
{conditions: {maxLength: "4", value: "abc"}, expected: false, name: "[target] Dirty value - value is less than maxlength", dirty: true},
{conditions: {maxLength: "4", value: "\u0041\u0041\u0041"}, expected: false, name: "[target] Dirty value - length of value(AAA) in unicode is less than maxlength", dirty: true},
{conditions: {maxLength: "4", value: "abcd"}, expected: false, name: "[target] Dirty value - value equals to maxlength", dirty: true},
{conditions: {maxLength: "4", value: "abcde"}, expected: true, name: "[target] Dirty value - length of value is greater than maxlength", dirty: true}
// False due to lack of required interactive editing by the user
{conditions: {maxLength: "4", value: "abcde"}, expected: false, name: "[target] Dirty value - length of value is greater than maxlength", dirty: true}
]
},
{
@ -39,7 +40,8 @@
{conditions: {maxLength: "4", value: "abc"}, expected: false, name: "[target] Dirty value - value is less than maxlength", dirty: true},
{conditions: {maxLength: "4", value: "\u000D\u000A"}, expected: false, name: "[target] Dirty value - length of value(LF, CRLF) in unicode is less than maxlength", dirty: true},
{conditions: {maxLength: "4", value: "abcd"}, expected: false, name: "[target] Dirty value - length of value equals to maxlength", dirty: true},
{conditions: {maxLength: "4", value: "abcde"}, expected: true, name: "[target] Dirty value - length of value is greater than maxlength", dirty: true}
// False due to lack of required interactive editing by the user
{conditions: {maxLength: "4", value: "abcde"}, expected: false, name: "[target] Dirty value - length of value is greater than maxlength", dirty: true}
]
}
];

View file

@ -114,7 +114,7 @@
{conditions: {required: true, value: " 123 "}, expected: true, name: "[target] Value is a number with some white spaces"},
{conditions: {required: true, value: Math.pow(2, 1024)}, expected: true, name: "[target] Value is Math.pow(2, 1024)"},
{conditions: {required: true, value: Math.pow(-2, 1024)}, expected: true, name: "[target] Value is Math.pow(-2, 1024)"},
{conditions: {required: true, value: "abc"}, expected: true, name: "[target] Value is a string that can not be coverted to a number"},
{conditions: {required: true, value: "abc"}, expected: true, name: "[target] Value is a string that cannot be converted to a number"},
{conditions: {required: true, value: ""}, expected: true, name: "[target] The value attribute is empty string"}
]
},

View file

@ -52,7 +52,7 @@
types: ["text", "search", "tel", "url", "email", "password", "datetime", "date", "month", "week", "time", "color", "file", "submit"],
testData: [
{conditions: {disabled: true}, expected: false, name: "[target] Must be barred from the constraint validation if it is disabled"},
{conditions: {disabled: false, readOnly: false}, expected: true, name: "[target] The willValidate attribute must be true if an elment is mutable"},
{conditions: {disabled: false, readOnly: false}, expected: true, name: "[target] The willValidate attribute must be true if an element is mutable"},
{conditions: {readOnly: true}, expected: false, name: "[target] Must be barred from the constraint validation if it is readonly"},
{conditions: {disabled: false, readOnly: false}, expected: false, name: "[target] The willValidate attribute must be false if it has a datalist ancestor", ancestor: "datalist"},
]
@ -62,7 +62,7 @@
types: ["submit"],
testData: [
{conditions: {disabled: true}, expected: false, name: "[target] Must be barred from the constraint validation"},
{conditions: {disabled: false}, expected: true, name: "[target] The willValidate attribute must be true if an elment is mutable"},
{conditions: {disabled: false}, expected: true, name: "[target] The willValidate attribute must be true if an element is mutable"},
{conditions: {disabled: false}, expected: false, name: "[target] The willValidate attribute must be false if it has a datalist ancestor", ancestor: "datalist"}
]
},
@ -71,7 +71,7 @@
types: [],
testData: [
{conditions: {disabled: true}, expected: false, name: "[target] Must be barred from the constraint validation"},
{conditions: {disabled: false}, expected: true, name: "[target] The willValidate attribute must be true if an elment is mutable"},
{conditions: {disabled: false}, expected: true, name: "[target] The willValidate attribute must be true if an element is mutable"},
{conditions: {disabled: false}, expected: false, name: "[target] The willValidate attribute must be false if it has a datalist ancestor", ancestor: "datalist"}
]
},
@ -80,7 +80,7 @@
types: [],
testData: [,
{conditions: {disabled: true}, expected: false, name: "[target] Must be barred from the constraint validation"},
{conditions: {disabled: false}, expected: true, name: "[target] The willValidate attribute must be true if an elment is mutable"},
{conditions: {disabled: false}, expected: true, name: "[target] The willValidate attribute must be true if an element is mutable"},
{conditions: {disabled: false}, expected: false, name: "[target] The willValidate attribute must be false if it has a datalist ancestor", ancestor: "datalist"}
]
}

View file

@ -229,8 +229,8 @@ var validator = {
assert_true(ctl.reportValidity(), "The reportValidity method should be true.");
assert_false(eventFired, "The invalid event should not be fired.");
} else {
assert_true(eventFired, "The invalid event should be fired.");
assert_false(ctl.reportValidity(), "The reportValidity method should be false.");
assert_true(eventFired, "The invalid event should be fired.");
}
}, data.name);
@ -262,8 +262,20 @@ var validator = {
},
set_conditions: function (ctl, obj) {
["required", "pattern", "step", "max", "min", "maxlength",
"value", "multiple", "checked", "selected"].forEach(function(item) {
[
"checked",
"disabled",
"max",
"maxlength",
"min",
"minlength",
"multiple",
"pattern",
"required",
"selected",
"step",
"value"
].forEach(function(item) {
ctl.removeAttribute(item);
});
for (var attr in obj) {

View file

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>input[type="email"], ValidityState.tooLong and user editing</title>
<link rel="author" title="Chris Rebert" href="http://chrisrebert.com">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#limiting-user-input-length:-the-maxlength-attribute">
<meta name="flags" content="interact">
<meta name="assert" content="Per the 'Constraint validation' definition in the referenced section, an input whose value was edited by the user but still exceeds the input's maxlength should suffer from being too long.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>Delete one character from the following text input:</p>
<input type="email" value="jane.doe@example.com" maxlength="5" autocomplete="off" id="testinput">
<div id="log"></div>
<script>
var input = document.getElementById('testinput');
setup({explicit_timeout: true, explicit_done: true});
on_event(input, "input", function () {
test(function() {
assert_class_string(input.validity, 'ValidityState', 'HTMLInputElement.validity must be a ValidityState instance');
assert_true(input.validity.tooLong, "tooLong must be true since the user just changed the input's value and the value exceeds the maxlength");
});
done();
});
</script>
</body>
</html>

View file

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>input[type="password"], ValidityState.tooLong and user editing</title>
<link rel="author" title="Chris Rebert" href="http://chrisrebert.com">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#limiting-user-input-length:-the-maxlength-attribute">
<meta name="flags" content="interact">
<meta name="assert" content="Per the 'Constraint validation' definition in the referenced section, an input whose value was edited by the user but still exceeds the input's maxlength should suffer from being too long.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>Delete one character from the following text input:</p>
<input type="password" value="swordfish" maxlength="5" autocomplete="off" id="testinput">
<div id="log"></div>
<script>
var input = document.getElementById('testinput');
setup({explicit_timeout: true, explicit_done: true});
on_event(input, "input", function () {
test(function() {
assert_class_string(input.validity, 'ValidityState', 'HTMLInputElement.validity must be a ValidityState instance');
assert_true(input.validity.tooLong, "tooLong must be true since the user just changed the input's value and the value exceeds the maxlength");
});
done();
});
</script>
</body>
</html>

View file

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>input[type="search"], ValidityState.tooLong and user editing</title>
<link rel="author" title="Chris Rebert" href="http://chrisrebert.com">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#limiting-user-input-length:-the-maxlength-attribute">
<meta name="flags" content="interact">
<meta name="assert" content="Per the 'Constraint validation' definition in the referenced section, an input whose value was edited by the user but still exceeds the input's maxlength should suffer from being too long.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>Delete one character from the following text input:</p>
<input type="search" value="abcdefghi" maxlength="5" autocomplete="off" id="testinput">
<div id="log"></div>
<script>
var input = document.getElementById('testinput');
setup({explicit_timeout: true, explicit_done: true});
on_event(input, "input", function () {
test(function() {
assert_class_string(input.validity, 'ValidityState', 'HTMLInputElement.validity must be a ValidityState instance');
assert_true(input.validity.tooLong, "tooLong must be true since the user just changed the input's value and the value exceeds the maxlength");
});
done();
});
</script>
</body>
</html>

View file

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>input[type="tel"], ValidityState.tooLong and user editing</title>
<link rel="author" title="Chris Rebert" href="http://chrisrebert.com">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#limiting-user-input-length:-the-maxlength-attribute">
<meta name="flags" content="interact">
<meta name="assert" content="Per the 'Constraint validation' definition in the referenced section, an input whose value was edited by the user but still exceeds the input's maxlength should suffer from being too long.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>Delete one character from the following text input:</p>
<input type="tel" value="123-456-7890" maxlength="7" autocomplete="off" id="testinput">
<div id="log"></div>
<script>
var input = document.getElementById('testinput');
setup({explicit_timeout: true, explicit_done: true});
on_event(input, "input", function () {
test(function() {
assert_class_string(input.validity, 'ValidityState', 'HTMLInputElement.validity must be a ValidityState instance');
assert_true(input.validity.tooLong, "tooLong must be true since the user just changed the input's value and the value exceeds the maxlength");
});
done();
});
</script>
</body>
</html>

View file

@ -2,7 +2,7 @@
<html>
<head>
<meta charset="utf-8">
<title>ValidityState.tooLong and user editing</title>
<title>input[type="text"], ValidityState.tooLong and user editing</title>
<link rel="author" title="Chris Rebert" href="http://chrisrebert.com">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#limiting-user-input-length:-the-maxlength-attribute">
<meta name="flags" content="interact">

View file

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>input[type="url"], ValidityState.tooLong and user editing</title>
<link rel="author" title="Chris Rebert" href="http://chrisrebert.com">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#limiting-user-input-length:-the-maxlength-attribute">
<meta name="flags" content="interact">
<meta name="assert" content="Per the 'Constraint validation' definition in the referenced section, an input whose value was edited by the user but still exceeds the input's maxlength should suffer from being too long.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>Delete one character from the following text input:</p>
<input type="url" value="http://example.com/foo" maxlength="12" autocomplete="off" id="testinput">
<div id="log"></div>
<script>
var input = document.getElementById('testinput');
setup({explicit_timeout: true, explicit_done: true});
on_event(input, "input", function () {
test(function() {
assert_class_string(input.validity, 'ValidityState', 'HTMLInputElement.validity must be a ValidityState instance');
assert_true(input.validity.tooLong, "tooLong must be true since the user just changed the input's value and the value exceeds the maxlength");
});
done();
});
</script>
</body>
</html>

View file

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>textarea, ValidityState.tooLong and user editing</title>
<link rel="author" title="Chris Rebert" href="http://chrisrebert.com">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#limiting-user-input-length:-the-maxlength-attribute">
<meta name="flags" content="interact">
<meta name="assert" content="Per the 'Constraint validation' definition in the referenced section, a textarea whose value was edited by the user but still exceeds the textarea's maxlength should suffer from being too long.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>Delete one character from the following text area:</p>
<textarea maxlength="5" autocomplete="off" id="testinput">0123456789</textarea>
<div id="log"></div>
<script>
var input = document.getElementById('testinput');
setup({explicit_timeout: true, explicit_done: true});
on_event(input, "input", function () {
test(function() {
assert_class_string(input.validity, 'ValidityState', 'HTMLTextAreaElement.validity must be a ValidityState instance');
assert_true(input.validity.tooLong, "tooLong must be true since the user just changed the input's value and the value exceeds the maxlength");
});
done();
});
</script>
</body>
</html>

View file

@ -105,7 +105,7 @@
test(function () {
assert_equals(document.getElementById("test5").labels.length, 0,
"The number of labels should be 0 if the form control has an ancestor label elment that the for attribute points to another control.");
"The number of labels should be 0 if the form control has an ancestor label element that the for attribute points to another control.");
assert_equals(document.getElementById("lbl2").control, null,
"The labeled cotrol should be associated with the control whose ID is equal to the value of the 'for' attribute.");
}, "A form control has no label 2.");