Commit 186c25ac authored by tkent@chromium.org's avatar tkent@chromium.org

2010-02-02 Kent Tamura <tkent@chromium.org>

        Reviewed by Darin Adler.

        rangeOverflow/rangeUnderflow support for type=datetime, datetime-local,
        month, time and week
        https://bugs.webkit.org/show_bug.cgi?id=34483

        Add tests for datetime, datetime-local, month, time and week, and
        merge existing tests into one test file.

        * fast/forms/ValidityState-rangeOverflow-date-expected.txt: Removed.
        * fast/forms/ValidityState-rangeOverflow-date.html: Removed.
        * fast/forms/ValidityState-rangeOverflow-expected.txt: Added.
        * fast/forms/ValidityState-rangeOverflow-number-expected.txt: Removed.
        * fast/forms/ValidityState-rangeOverflow-number.html: Removed.
        * fast/forms/ValidityState-rangeOverflow-range-expected.txt: Removed.
        * fast/forms/ValidityState-rangeOverflow-range.html: Removed.
        * fast/forms/ValidityState-rangeOverflow.html: Added.
        * fast/forms/ValidityState-rangeUnderflow-date-expected.txt: Removed.
        * fast/forms/ValidityState-rangeUnderflow-date.html: Removed.
        * fast/forms/ValidityState-rangeUnderflow-expected.txt: Added.
        * fast/forms/ValidityState-rangeUnderflow-number-expected.txt: Removed.
        * fast/forms/ValidityState-rangeUnderflow-number.html: Removed.
        * fast/forms/ValidityState-rangeUnderflow-range-expected.txt: Removed.
        * fast/forms/ValidityState-rangeUnderflow-range.html: Removed.
        * fast/forms/ValidityState-rangeUnderflow.html: Added.
        * fast/forms/script-tests/ValidityState-rangeOverflow-date.js: Removed.
        * fast/forms/script-tests/ValidityState-rangeOverflow-number.js: Removed.
        * fast/forms/script-tests/ValidityState-rangeOverflow-range.js: Removed.
        * fast/forms/script-tests/ValidityState-rangeOverflow.js: Added.
        * fast/forms/script-tests/ValidityState-rangeUnderflow-date.js: Removed.
        * fast/forms/script-tests/ValidityState-rangeUnderflow-number.js: Removed.
        * fast/forms/script-tests/ValidityState-rangeUnderflow-range.js: Removed.
        * fast/forms/script-tests/ValidityState-rangeUnderflow.js: Added.

2010-02-02  Kent Tamura  <tkent@chromium.org>

        Reviewed by Darin Adler.

        rangeOverflow/rangeUnderflow support for type=datetime, datetime-local,
        month, time and week
        https://bugs.webkit.org/show_bug.cgi?id=34483

        Tests: fast/forms/ValidityState-rangeOverflow.html
               fast/forms/ValidityState-rangeUnderflow.html

        * html/HTMLInputElement.cpp:
          Defines the hard limits for the types as double values.
        (WebCore::HTMLInputElement::rangeUnderflow): Supports the types.
        (WebCore::HTMLInputElement::rangeOverflow): Supports the types.
        (WebCore::HTMLInputElement::minimum): Supports the types.
        (WebCore::HTMLInputElement::maximum): Supports the types.

git-svn-id: svn://svn.chromium.org/blink/trunk@54271 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent edc78202
2010-02-02 Kent Tamura <tkent@chromium.org>
Reviewed by Darin Adler.
rangeOverflow/rangeUnderflow support for type=datetime, datetime-local,
month, time and week
https://bugs.webkit.org/show_bug.cgi?id=34483
Add tests for datetime, datetime-local, month, time and week, and
merge existing tests into one test file.
* fast/forms/ValidityState-rangeOverflow-date-expected.txt: Removed.
* fast/forms/ValidityState-rangeOverflow-date.html: Removed.
* fast/forms/ValidityState-rangeOverflow-expected.txt: Added.
* fast/forms/ValidityState-rangeOverflow-number-expected.txt: Removed.
* fast/forms/ValidityState-rangeOverflow-number.html: Removed.
* fast/forms/ValidityState-rangeOverflow-range-expected.txt: Removed.
* fast/forms/ValidityState-rangeOverflow-range.html: Removed.
* fast/forms/ValidityState-rangeOverflow.html: Added.
* fast/forms/ValidityState-rangeUnderflow-date-expected.txt: Removed.
* fast/forms/ValidityState-rangeUnderflow-date.html: Removed.
* fast/forms/ValidityState-rangeUnderflow-expected.txt: Added.
* fast/forms/ValidityState-rangeUnderflow-number-expected.txt: Removed.
* fast/forms/ValidityState-rangeUnderflow-number.html: Removed.
* fast/forms/ValidityState-rangeUnderflow-range-expected.txt: Removed.
* fast/forms/ValidityState-rangeUnderflow-range.html: Removed.
* fast/forms/ValidityState-rangeUnderflow.html: Added.
* fast/forms/script-tests/ValidityState-rangeOverflow-date.js: Removed.
* fast/forms/script-tests/ValidityState-rangeOverflow-number.js: Removed.
* fast/forms/script-tests/ValidityState-rangeOverflow-range.js: Removed.
* fast/forms/script-tests/ValidityState-rangeOverflow.js: Added.
* fast/forms/script-tests/ValidityState-rangeUnderflow-date.js: Removed.
* fast/forms/script-tests/ValidityState-rangeUnderflow-number.js: Removed.
* fast/forms/script-tests/ValidityState-rangeUnderflow-range.js: Removed.
* fast/forms/script-tests/ValidityState-rangeUnderflow.js: Added.
2010-02-02 Fumitoshi Ukai <ukai@chromium.org>
Reviewed by Alexey Proskuryakov.
......
This test aims to check for rangeOverflow flag with type=date input fields
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS The value "2010-01-27" doesn't overflow the maximum value "".
PASS The value "2010-01-27" doesn't overflow the maximum value "".
PASS The value "2010-01-27" doesn't overflow the maximum value "foo".
PASS The value "2010-01-27" doesn't overflow the maximum value "2010-01-27".
PASS The value "2010-01-27" doesn't overflow the maximum value "2010-01-28".
PASS The value "2010-01-27" doesn't overflow the maximum value "2011-01-26".
PASS The value "foo" doesn't overflow the maximum value "2011-01-26".
PASS The value "2010-01-27" doesn't overflow the maximum value "1000-01-01".
PASS The value "2010-01-27" overflows the maximum value "2010-01-26".
PASS The value "9999-01-01" overflows the maximum value "2010-12-31".
PASS The value "2010-01-27" overflows the maximum value "2010-01-26".
PASS successfullyParsed is true
TEST COMPLETE
This test aims to check for rangeOverflow flag with input fields
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Type=text
PASS The value "101" doesn't overflow the maximum value "100".
Type=date
PASS The value "2010-01-27" doesn't overflow the maximum value "".
PASS The value "2010-01-27" doesn't overflow the maximum value "".
PASS The value "2010-01-27" doesn't overflow the maximum value "foo".
PASS The value "2010-01-27" doesn't overflow the maximum value "2010-01-27".
PASS The value "2010-01-27" doesn't overflow the maximum value "2010-01-28".
PASS The value "2010-01-27" doesn't overflow the maximum value "2011-01-26".
PASS The value "foo" doesn't overflow the maximum value "2011-01-26".
PASS The value "2010-01-27" doesn't overflow the maximum value "1000-01-01".
PASS The value "2010-01-27" overflows the maximum value "2010-01-26".
PASS The value "9999-01-01" overflows the maximum value "2010-12-31".
PASS The value "2010-01-27" overflows the maximum value "2010-01-26".
Type=datetime
PASS The value "2010-01-27T12:34Z" doesn't overflow the maximum value "".
PASS The value "2010-01-27T12:34Z" doesn't overflow the maximum value "".
PASS The value "2010-01-27T12:34Z" doesn't overflow the maximum value "foo".
PASS The value "2010-01-27T12:34Z" doesn't overflow the maximum value "2010-01-27T12:34Z".
PASS The value "2010-01-27T12:34Z" doesn't overflow the maximum value "2010-01-27T12:34:56Z".
PASS The value "2010-01-27T12:34Z" doesn't overflow the maximum value "2011-01-26T12:34Z".
PASS The value "foo" doesn't overflow the maximum value "2011-01-26T12:34Z".
PASS The value "2010-01-27T12:34Z" doesn't overflow the maximum value "1000-01-01T00:00Z".
PASS The value "2010-01-27T12:34Z" overflows the maximum value "2010-01-26T12:33:59.999Z".
PASS The value "9999-01-01T23:59Z" overflows the maximum value "2010-12-31T00:00Z".
PASS The value "2010-01-27T12:34Z" overflows the maximum value "2010-01-26T12:34Z".
Type=datetime-local
PASS The value "2010-01-27T12:34" doesn't overflow the maximum value "".
PASS The value "2010-01-27T12:34" doesn't overflow the maximum value "".
PASS The value "2010-01-27T12:34" doesn't overflow the maximum value "foo".
PASS The value "2010-01-27T12:34" doesn't overflow the maximum value "2010-01-27T12:34".
PASS The value "2010-01-27T12:34" doesn't overflow the maximum value "2010-01-27T12:34:56".
PASS The value "2010-01-27T12:34" doesn't overflow the maximum value "2011-01-26T12:34".
PASS The value "foo" doesn't overflow the maximum value "2011-01-26T12:34".
PASS The value "2010-01-27T12:34" doesn't overflow the maximum value "1000-01-01T00:00".
PASS The value "2010-01-27T12:34" overflows the maximum value "2010-01-26T12:33:59.999".
PASS The value "9999-01-01T23:59" overflows the maximum value "2010-12-31T00:00".
PASS The value "2010-01-27T12:34" overflows the maximum value "2010-01-26T12:34".
Type=month
PASS The value "2010-01" doesn't overflow the maximum value "".
PASS The value "2010-01" doesn't overflow the maximum value "".
PASS The value "2010-01" doesn't overflow the maximum value "foo".
PASS The value "2010-01" doesn't overflow the maximum value "2010-01".
PASS The value "2010-01" doesn't overflow the maximum value "2010-02".
PASS The value "2010-01" doesn't overflow the maximum value "2011-01".
PASS The value "foo" doesn't overflow the maximum value "2011-01".
PASS The value "2010-01" doesn't overflow the maximum value "1000-01".
PASS The value "2010-01" overflows the maximum value "2009-12".
PASS The value "9999-01" overflows the maximum value "2010-12".
PASS The value "2010-01" overflows the maximum value "2009-12".
Type=number
PASS The value "99" doesn't overflow the maximum value "100".
PASS The value "-101" doesn't overflow the maximum value "-100".
PASS The value "99" doesn't overflow the maximum value "1E+2".
PASS The value "0.99" doesn't overflow the maximum value "1.00".
PASS The value "abc" doesn't overflow the maximum value "100".
PASS The value "" doesn't overflow the maximum value "-1".
PASS The value "101" doesn't overflow the maximum value "".
PASS The value "101" doesn't overflow the maximum value "xxx".
PASS The value "0.999999999999999999999999999999999999999999" doesn't overflow the maximum value "0.999999999999999999999999999999999999999998".
PASS The value "101" overflows the maximum value "100".
PASS The value "-99" overflows the maximum value "-100".
PASS The value "101" overflows the maximum value "1E+2".
PASS The value "101" overflows the maximum value "100".
Type=range
PASS The value "99" doesn't overflow the maximum value "100".
PASS The value "-101" doesn't overflow the maximum value "-100".
PASS The value "99" doesn't overflow the maximum value "1E+2".
PASS The value "0.99" doesn't overflow the maximum value "1.00".
PASS The value "abc" doesn't overflow the maximum value "100".
PASS The value "" doesn't overflow the maximum value "-1".
PASS The value "0.999999999999999999999999999999999999999999" doesn't overflow the maximum value "0.999999999999999999999999999999999999999998".
PASS The value "101" doesn't overflow the maximum value "100".
PASS The value "101" overflows the maximum value "100".
PASS The value "-99" overflows the maximum value "-100".
PASS The value "101" overflows the maximum value "1E+2".
PASS The value "101" overflows the maximum value "".
PASS The value "101" overflows the maximum value "xxx".
Type=time
PASS The value "13:16" doesn't overflow the maximum value "".
PASS The value "13:16" doesn't overflow the maximum value "".
PASS The value "13:16" doesn't overflow the maximum value "foo".
PASS The value "13:16" doesn't overflow the maximum value "13:16".
PASS The value "13:16" doesn't overflow the maximum value "13:17".
PASS The value "13:16" doesn't overflow the maximum value "14:15".
PASS The value "foo" doesn't overflow the maximum value "13:16".
PASS The value "13:16" overflows the maximum value "13:15".
PASS The value "23:59:59.999" overflows the maximum value "13:16".
PASS The value "13:16" overflows the maximum value "12:00".
Type=week
PASS The value "2010-W01" doesn't overflow the maximum value "".
PASS The value "2010-W01" doesn't overflow the maximum value "".
PASS The value "2010-W01" doesn't overflow the maximum value "foo".
PASS The value "2010-W01" doesn't overflow the maximum value "2010-W01".
PASS The value "2010-W01" doesn't overflow the maximum value "2010-W02".
PASS The value "2010-W01" doesn't overflow the maximum value "2011-W01".
PASS The value "foo" doesn't overflow the maximum value "2011-W01".
PASS The value "2010-W01" doesn't overflow the maximum value "1582-W01".
PASS The value "2010-W01" overflows the maximum value "2009-W12".
PASS The value "9999-W01" overflows the maximum value "2010-W12".
PASS The value "2010-W01" overflows the maximum value "2009-W50".
PASS successfullyParsed is true
TEST COMPLETE
This test aims to check for rangeOverflow flag with type=number input fields
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS The value "101" doesn't overflow the maximum value "100".
PASS The value "99" doesn't overflow the maximum value "100".
PASS The value "-101" doesn't overflow the maximum value "-100".
PASS The value "99" doesn't overflow the maximum value "1E+2".
PASS The value "0.99" doesn't overflow the maximum value "1.00".
PASS The value "abc" doesn't overflow the maximum value "100".
PASS The value "" doesn't overflow the maximum value "-1".
PASS The value "101" doesn't overflow the maximum value "".
PASS The value "101" doesn't overflow the maximum value "xxx".
PASS The value "0.999999999999999999999999999999999999999999" doesn't overflow the maximum value "0.999999999999999999999999999999999999999998".
PASS The value "101" overflows the maximum value "100".
PASS The value "-99" overflows the maximum value "-100".
PASS The value "101" overflows the maximum value "1E+2".
PASS The value "101" overflows the maximum value "100".
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
<script src="../../fast/js/resources/js-test-pre.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script src="script-tests/ValidityState-rangeOverflow-number.js"></script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
This test aims to check for rangeOverflow flag with type=range input fields
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS The value "101" doesn't overflow the maximum value "100".
PASS The value "99" doesn't overflow the maximum value "100".
PASS The value "-101" doesn't overflow the maximum value "-100".
PASS The value "99" doesn't overflow the maximum value "1E+2".
PASS The value "0.99" doesn't overflow the maximum value "1.00".
PASS The value "abc" doesn't overflow the maximum value "100".
PASS The value "" doesn't overflow the maximum value "-1".
PASS The value "0.999999999999999999999999999999999999999999" doesn't overflow the maximum value "0.999999999999999999999999999999999999999998".
PASS The value "101" doesn't overflow the maximum value "100".
PASS The value "101" overflows the maximum value "100".
PASS The value "-99" overflows the maximum value "-100".
PASS The value "101" overflows the maximum value "1E+2".
PASS The value "101" overflows the maximum value "".
PASS The value "101" overflows the maximum value "xxx".
PASS successfullyParsed is true
TEST COMPLETE
......@@ -7,7 +7,7 @@
<body>
<p id="description"></p>
<div id="console"></div>
<script src="script-tests/ValidityState-rangeOverflow-date.js"></script>
<script src="script-tests/ValidityState-rangeOverflow.js"></script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
This test aims to check for rangeUnderflow flag with type=date input fields
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS The value "2010-01-27" doesn't underflow the minimum value "".
PASS The value "2010-01-27" doesn't underflow the minimum value "".
PASS The value "2010-01-27" doesn't underflow the minimum value "foo".
PASS The value "1000-01-01" doesn't underflow the minimum value "".
PASS The value "1582-10-15" doesn't underflow the minimum value "".
PASS The value "2010-01-27" doesn't underflow the minimum value "2010-01-26".
PASS The value "2010-01-27" doesn't underflow the minimum value "2009-01-28".
PASS The value "foo" doesn't underflow the minimum value "2011-01-26".
PASS The value "2010-01-27" undeflows the minimum value "2010-01-28".
PASS The value "9999-01-01" undeflows the minimum value "10000-12-31".
PASS The value "2010-01-27" undeflows the minimum value "2010-02-01".
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
<script src="../../fast/js/resources/js-test-pre.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script src="script-tests/ValidityState-rangeUnderflow-date.js"></script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
This test aims to check for rangeUnderflow flag with input fields
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Type=text
PASS The value "99" doesn't underflow the minimum value "100".
Type=date
PASS The value "2010-01-27" doesn't underflow the minimum value "".
PASS The value "2010-01-27" doesn't underflow the minimum value "".
PASS The value "2010-01-27" doesn't underflow the minimum value "foo".
PASS The value "1000-01-01" doesn't underflow the minimum value "".
PASS The value "1582-10-15" doesn't underflow the minimum value "".
PASS The value "2010-01-27" doesn't underflow the minimum value "2010-01-26".
PASS The value "2010-01-27" doesn't underflow the minimum value "2009-01-28".
PASS The value "foo" doesn't underflow the minimum value "2011-01-26".
PASS The value "2010-01-27" undeflows the minimum value "2010-01-28".
PASS The value "9999-01-01" undeflows the minimum value "10000-12-31".
PASS The value "2010-01-27" undeflows the minimum value "2010-02-01".
Type=datetime
PASS The value "2010-01-27T12:34Z" doesn't underflow the minimum value "".
PASS The value "2010-01-27T12:34Z" doesn't underflow the minimum value "".
PASS The value "2010-01-27T12:34Z" doesn't underflow the minimum value "foo".
PASS The value "1000-01-01T12:34Z" doesn't underflow the minimum value "".
PASS The value "1582-10-15T00:00Z" doesn't underflow the minimum value "".
PASS The value "2010-01-27T12:34Z" doesn't underflow the minimum value "2010-01-26T00:00Z".
PASS The value "2010-01-27T12:34Z" doesn't underflow the minimum value "2009-01-28T00:00Z".
PASS The value "foo" doesn't underflow the minimum value "2011-01-26T00:00Z".
PASS The value "2010-01-27T12:34Z" undeflows the minimum value "2010-01-27T13:00Z".
PASS The value "9999-01-01T12:00Z" undeflows the minimum value "10000-12-31T12:00Z".
PASS The value "2010-01-27T12:00Z" undeflows the minimum value "2010-02-01T12:00Z".
Type=datetime-local
PASS The value "2010-01-27T12:34" doesn't underflow the minimum value "".
PASS The value "2010-01-27T12:34" doesn't underflow the minimum value "".
PASS The value "2010-01-27T12:34" doesn't underflow the minimum value "foo".
PASS The value "1000-01-01T12:34" doesn't underflow the minimum value "".
PASS The value "1582-10-15T00:00" doesn't underflow the minimum value "".
PASS The value "2010-01-27T12:34" doesn't underflow the minimum value "2010-01-26T00:00".
PASS The value "2010-01-27T12:34" doesn't underflow the minimum value "2009-01-28T00:00".
PASS The value "foo" doesn't underflow the minimum value "2011-01-26T00:00".
PASS The value "2010-01-27T12:34" undeflows the minimum value "2010-01-27T13:00".
PASS The value "9999-01-01T12:00" undeflows the minimum value "10000-12-31T12:00".
PASS The value "2010-01-27T12:00" undeflows the minimum value "2010-02-01T12:00".
Type=month
PASS The value "2010-01" doesn't underflow the minimum value "".
PASS The value "2010-01" doesn't underflow the minimum value "".
PASS The value "2010-01" doesn't underflow the minimum value "foo".
PASS The value "1000-01" doesn't underflow the minimum value "".
PASS The value "1582-10" doesn't underflow the minimum value "".
PASS The value "2010-01" doesn't underflow the minimum value "2009-12".
PASS The value "2010-01" doesn't underflow the minimum value "2009-01".
PASS The value "foo" doesn't underflow the minimum value "2011-01".
PASS The value "2010-01" undeflows the minimum value "2010-02".
PASS The value "9999-01" undeflows the minimum value "10000-12".
PASS The value "2010-01" undeflows the minimum value "2010-02".
Type=number
PASS The value "101" doesn't underflow the minimum value "100".
PASS The value "-99" doesn't underflow the minimum value "-100".
PASS The value "101" doesn't underflow the minimum value "1E+2".
PASS The value "1.01" doesn't underflow the minimum value "1.00".
PASS The value "abc" doesn't underflow the minimum value "100".
PASS The value "" doesn't underflow the minimum value "1".
PASS The value "-1" doesn't underflow the minimum value "".
PASS The value "-1" doesn't underflow the minimum value "xxx".
PASS The value "0.999999999999999999999999999999999999999998" doesn't underflow the minimum value "0.999999999999999999999999999999999999999999".
PASS The value "99" undeflows the minimum value "100".
PASS The value "-101" undeflows the minimum value "-100".
PASS The value "99" undeflows the minimum value "1E+2".
PASS The value "101" undeflows the minimum value "200".
Type=range
PASS The value "101" doesn't underflow the minimum value "100".
PASS The value "-99" doesn't underflow the minimum value "-100".
PASS The value "101" doesn't underflow the minimum value "1E+2".
PASS The value "1.01" doesn't underflow the minimum value "1.00".
PASS The value "abc" doesn't underflow the minimum value "100".
PASS The value "" doesn't underflow the minimum value "1".
PASS The value "0.999999999999999999999999999999999999999998" doesn't underflow the minimum value "0.999999999999999999999999999999999999999999".
PASS The value "101" doesn't underflow the minimum value "100".
PASS The value "99" undeflows the minimum value "100".
PASS The value "-101" undeflows the minimum value "-100".
PASS The value "99" undeflows the minimum value "1E+2".
PASS The value "-1" undeflows the minimum value "".
PASS The value "-1" undeflows the minimum value "xxx".
Type=time
PASS The value "13:16" doesn't underflow the minimum value "".
PASS The value "13:16" doesn't underflow the minimum value "".
PASS The value "13:16" doesn't underflow the minimum value "foo".
PASS The value "00:00:00.000" doesn't underflow the minimum value "".
PASS The value "23:59:59.999" doesn't underflow the minimum value "".
PASS The value "13:16" doesn't underflow the minimum value "11:00".
PASS The value "13:16" doesn't underflow the minimum value "13:16".
PASS The value "foo" doesn't underflow the minimum value "11:00".
PASS The value "13:16" undeflows the minimum value "13:17".
PASS The value "23:59" undeflows the minimum value "23:59:30".
PASS The value "13:16" undeflows the minimum value "14:00".
Type=week
PASS The value "2010-W01" doesn't underflow the minimum value "".
PASS The value "2010-W01" doesn't underflow the minimum value "".
PASS The value "2010-W01" doesn't underflow the minimum value "foo".
PASS The value "1000-W01" doesn't underflow the minimum value "".
PASS The value "1583-W01" doesn't underflow the minimum value "".
PASS The value "2010-W01" doesn't underflow the minimum value "2009-W51".
PASS The value "2010-W01" doesn't underflow the minimum value "2009-W01".
PASS The value "foo" doesn't underflow the minimum value "2011-W01".
PASS The value "2010-W01" undeflows the minimum value "2010-W02".
PASS The value "9999-W01" undeflows the minimum value "10000-W12".
PASS The value "2010-W01" undeflows the minimum value "2010-W02".
PASS successfullyParsed is true
TEST COMPLETE
This test aims to check for rangeUnderflow flag with type=number input fields
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS The value "99" doesn't underflow the minimum value "100".
PASS The value "101" doesn't underflow the minimum value "100".
PASS The value "-99" doesn't underflow the minimum value "-100".
PASS The value "101" doesn't underflow the minimum value "1E+2".
PASS The value "1.01" doesn't underflow the minimum value "1.00".
PASS The value "abc" doesn't underflow the minimum value "100".
PASS The value "" doesn't underflow the minimum value "1".
PASS The value "-1" doesn't underflow the minimum value "".
PASS The value "-1" doesn't underflow the minimum value "xxx".
PASS The value "0.999999999999999999999999999999999999999998" doesn't underflow the minimum value "0.999999999999999999999999999999999999999999".
PASS The value "99" underflows the minimum value "100".
PASS The value "-101" underflows the minimum value "-100".
PASS The value "99" underflows the minimum value "1E+2".
PASS The value "101" underflows the minimum value "200".
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
<script src="../../fast/js/resources/js-test-pre.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script src="script-tests/ValidityState-rangeUnderflow-number.js"></script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
This test aims to check for rangeUnderflow flag with type=range input fields
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS The value "99" doesn't underflow the minimum value "100".
PASS The value "101" doesn't underflow the minimum value "100".
PASS The value "-99" doesn't underflow the minimum value "-100".
PASS The value "101" doesn't underflow the minimum value "1E+2".
PASS The value "1.01" doesn't underflow the minimum value "1.00".
PASS The value "abc" doesn't underflow the minimum value "100".
PASS The value "" doesn't underflow the minimum value "1".
PASS The value "0.999999999999999999999999999999999999999998" doesn't underflow the minimum value "0.999999999999999999999999999999999999999999".
PASS The value "101" doesn't underflow the minimum value "100".
PASS The value "99" underflows the minimum value "100".
PASS The value "-101" underflows the minimum value "-100".
PASS The value "99" underflows the minimum value "1E+2".
PASS The value "-1" underflows the minimum value "".
PASS The value "-1" underflows the minimum value "xxx".
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
<script src="../../fast/js/resources/js-test-pre.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script src="script-tests/ValidityState-rangeUnderflow-range.js"></script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
......@@ -7,7 +7,7 @@
<body>
<p id="description"></p>
<div id="console"></div>
<script src="script-tests/ValidityState-rangeOverflow-range.js"></script>
<script src="script-tests/ValidityState-rangeUnderflow.js"></script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
description('This test aims to check for rangeOverflow flag with type=date input fields');
var input = document.createElement('input');
input.type = 'date';
function checkOverflow(value, max)
{
input.value = value;
input.max = max;
var overflow = input.validity.rangeOverflow;
var resultText = 'The value "' + input.value + '" ' +
(overflow ? 'overflows' : 'doesn\'t overflow') +
' the maximum value "' + input.max + '".';
if (overflow)
testPassed(resultText);
else
testFailed(resultText);
}
function checkNotOverflow(value, max)
{
input.value = value;
input.max = max;
var overflow = input.validity.rangeOverflow;
var resultText = 'The value "' + input.value + '" ' +
(overflow ? 'overflows' : 'doesn\'t overflow') +
' the maximum value "' + input.max + '".';
if (overflow)
testFailed(resultText);
else
testPassed(resultText);
}
// No overflow cases
checkNotOverflow('2010-01-27', null);
checkNotOverflow('2010-01-27', '');
checkNotOverflow('2010-01-27', 'foo');
checkNotOverflow('2010-01-27', '2010-01-27');
checkNotOverflow('2010-01-27', '2010-01-28');
checkNotOverflow('2010-01-27', '2011-01-26');
checkNotOverflow('foo', '2011-01-26');
checkNotOverflow('2010-01-27', '1000-01-01'); // Too small max value.
// Overflow cases
checkOverflow('2010-01-27', '2010-01-26');
checkOverflow('9999-01-01', '2010-12-31');
input.min = '2010-01-28'; // value < min && value > max
checkOverflow('2010-01-27', '2010-01-26');
var successfullyParsed = true;
description('This test aims to check for rangeOverflow flag with type=number input fields');
var input = document.createElement('input');
function check(value, max, overflowExpected)
{
input.value = value;
input.max = max;
var actual = input.validity.rangeOverflow;
var didPass = actual == overflowExpected;
var resultText = 'The value "' + input.value + '" ' + (actual ? 'overflows' : 'doesn\'t overflow') + ' the maximum value "' + input.max + '".';
if (didPass)
testPassed(resultText);
else
testFailed(resultText);
}
// No overflow cases
input.type = 'text'; // No overflow for type=text.
check('101', '100', false);
input.type = 'number';
check('99', '100', false); // Very normal case.
check('-101', '-100', false);
check('99', '1E+2', false);
check('0.99', '1.00', false);
check('abc', '100', false); // Invalid value.
check('', '-1', false); // No value.
check('101', '', false); // No max.
check('101', 'xxx', false); // Invalid max.
// The following case should be rangeOverflow==true ideally. But the "double" type doesn't have enough precision.
check('0.999999999999999999999999999999999999999999', '0.999999999999999999999999999999999999999998', false);
// Overflow cases
check('101', '100', true);
check('-99', '-100', true);
check('101', '1E+2', true);
input.min = '200'; // value < min && value > max
check('101', '100', true);
var successfullyParsed = true;
description('This test aims to check for rangeOverflow flag with type=range input fields');
var input = document.createElement('input');
function check(value, max, overflowExpected)
{
input.value = value;
input.max = max;
var actual = input.validity.rangeOverflow;
var didPass = actual == overflowExpected;
var resultText = 'The value "' + input.value + '" ' + (actual ? 'overflows' : 'doesn\'t overflow') + ' the maximum value "' + input.max + '".';
if (didPass)
testPassed(resultText);
else
testFailed(resultText);
}
// No overflow cases
input.type = 'text'; // No overflow for type=text.
check('101', '100', false);
input.type = 'range';
check('99', '100', false); // Very normal case.
check('-101', '-100', false);
check('99', '1E+2', false);
check('0.99', '1.00', false);
check('abc', '100', false); // Invalid value.
check('', '-1', false); // No value.
// The following case should be rangeOverflow==true ideally. But the "double" type doesn't have enough precision.
check('0.999999999999999999999999999999999999999999', '0.999999999999999999999999999999999999999998', false);
input.min = '200'; // If min > max, max is reset to min.
check('101', '100', false);
input.min = '';
// Overflow cases
check('101', '100', true);
input.min = '-200';
check('-99', '-100', true);
input.min = '';
check('101', '1E+2', true);
check('101', '', true); // No max.
check('101', 'xxx', true); // Invalid max.
var successfullyParsed = true;
description('This test aims to check for rangeOverflow flag with input fields');
var input = document.createElement('input');
function checkOverflow(value, max)
{
input.value = value;
input.max = max;
var overflow = input.validity.rangeOverflow;
var resultText = 'The value "' + input.value + '" ' +
(overflow ? 'overflows' : 'doesn\'t overflow') +
' the maximum value "' + input.max + '".';
if (overflow)
testPassed(resultText);
else
testFailed(resultText);
}
function checkNotOverflow(value, max)
{
input.value = value;
input.max = max;
var overflow = input.validity.rangeOverflow;
var resultText = 'The value "' + input.value + '" ' +
(overflow ? 'overflows' : 'doesn\'t overflow') +
' the maximum value "' + input.max + '".';
if (overflow)
testFailed(resultText);
else
testPassed(resultText);
}
// ----------------------------------------------------------------
debug('Type=text');
input.type = 'text'; // No overflow for type=text.
checkNotOverflow('101', '100');
// ----------------------------------------------------------------
debug('');
debug('Type=date');
input.type = 'date';
input.min = '';
// No overflow cases
checkNotOverflow('2010-01-27', null);
checkNotOverflow('2010-01-27', '');
checkNotOverflow('2010-01-27', 'foo');
checkNotOverflow('2010-01-27', '2010-01-27');
checkNotOverflow('2010-01-27', '2010-01-28');
checkNotOverflow('2010-01-27', '2011-01-26');
checkNotOverflow('foo', '2011-01-26');
checkNotOverflow('2010-01-27', '1000-01-01'); // Too small max value.
// Overflow cases
checkOverflow('2010-01-27', '2010-01-26');
checkOverflow('9999-01-01', '2010-12-31');
input.min = '2010-01-28'; // value < min && value > max
checkOverflow('2010-01-27', '2010-01-26');
// ----------------------------------------------------------------
debug('');
debug('Type=datetime');
input.type = 'datetime';
input.min = '';
// No overflow cases
checkNotOverflow('2010-01-27T12:34Z', null);
checkNotOverflow('2010-01-27T12:34Z', '');
checkNotOverflow('2010-01-27T12:34Z', 'foo');
checkNotOverflow('2010-01-27T12:34Z', '2010-01-27T12:34Z');
checkNotOverflow('2010-01-27T12:34Z', '2010-01-27T12:34:56Z');
checkNotOverflow('2010-01-27T12:34Z', '2011-01-26T12:34Z');
checkNotOverflow('foo', '2011-01-26T12:34Z');
checkNotOverflow('2010-01-27T12:34Z', '1000-01-01T00:00Z'); // Too small max value.
// Overflow cases
checkOverflow('2010-01-27T12:34Z', '2010-01-26T12:33:59.999Z');
checkOverflow('9999-01-01T23:59Z', '2010-12-31T00:00Z');
input.min = '2010-01-28T12:00Z'; // value < min && value > max
checkOverflow('2010-01-27T12:34Z', '2010-01-26T12:34Z');
// ----------------------------------------------------------------
debug('');
debug('Type=datetime-local');
input.type = 'datetime-local';
input.min = '';
// No overflow cases
checkNotOverflow('2010-01-27T12:34', null);
checkNotOverflow('2010-01-27T12:34', '');
checkNotOverflow('2010-01-27T12:34', 'foo');
checkNotOverflow('2010-01-27T12:34', '2010-01-27T12:34');
checkNotOverflow('2010-01-27T12:34', '2010-01-27T12:34:56');
checkNotOverflow('2010-01-27T12:34', '2011-01-26T12:34');
checkNotOverflow('foo', '2011-01-26T12:34');
checkNotOverflow('2010-01-27T12:34', '1000-01-01T00:00'); // Too small max value.
// Overflow cases
checkOverflow('2010-01-27T12:34', '2010-01-26T12:33:59.999');
checkOverflow('9999-01-01T23:59', '2010-12-31T00:00');
input.min = '2010-01-28T12:00'; // value < min && value > max
checkOverflow('2010-01-27T12:34', '2010-01-26T12:34');
// ----------------------------------------------------------------
debug('');
debug('Type=month');
input.type = 'month';
input.min = '';
// No overflow cases
checkNotOverflow('2010-01', null);
checkNotOverflow('2010-01', '');
checkNotOverflow('2010-01', 'foo');
checkNotOverflow('2010-01', '2010-01');
checkNotOverflow('2010-01', '2010-02');
checkNotOverflow('2010-01', '2011-01');
checkNotOverflow('foo', '2011-01');
checkNotOverflow('2010-01', '1000-01'); // Too small max value.
// Overflow cases
checkOverflow('2010-01', '2009-12');
checkOverflow('9999-01', '2010-12');
input.min = '2010-02'; // value < min && value > max
checkOverflow('2010-01', '2009-12');
// ----------------------------------------------------------------
debug('');
debug('Type=number');
input.type = 'number';
input.min = '';
checkNotOverflow('99', '100'); // Very normal case.
checkNotOverflow('-101', '-100');
checkNotOverflow('99', '1E+2');
checkNotOverflow('0.99', '1.00');
checkNotOverflow('abc', '100'); // Invalid value.
checkNotOverflow('', '-1'); // No value.
checkNotOverflow('101', ''); // No max.
checkNotOverflow('101', 'xxx'); // Invalid max.
// The following case should be rangeOverflow==true ideally. But the "double" type doesn't have enough precision.
checkNotOverflow('0.999999999999999999999999999999999999999999', '0.999999999999999999999999999999999999999998');
// Overflow cases
checkOverflow('101', '100');
checkOverflow('-99', '-100');
checkOverflow('101', '1E+2');
input.min = '200'; // value < min && value > max
checkOverflow('101', '100');
// ----------------------------------------------------------------
debug('');
debug('Type=range');
input.type = 'range';
input.min = '';
checkNotOverflow('99', '100'); // Very normal case.
checkNotOverflow('-101', '-100');
checkNotOverflow('99', '1E+2');
checkNotOverflow('0.99', '1.00');
checkNotOverflow('abc', '100'); // Invalid value.
checkNotOverflow('', '-1'); // No value.
// The following case should be rangeOverflow==true ideally. But the "double" type doesn't have enough precision.
checkNotOverflow('0.999999999999999999999999999999999999999999', '0.999999999999999999999999999999999999999998');
input.min = '200'; // If min > max, max is reset to min.
checkNotOverflow('101', '100');
input.min = '';
// Overflow cases
checkOverflow('101', '100');
input.min = '-200';
checkOverflow('-99', '-100');
input.min = '';
checkOverflow('101', '1E+2');
checkOverflow('101', ''); // No max.
checkOverflow('101', 'xxx'); // Invalid max.
// ----------------------------------------------------------------
debug('');
debug('Type=time');
input.type = 'time';
input.min = '';
// No overflow cases
checkNotOverflow('13:16', null);
checkNotOverflow('13:16', '');
checkNotOverflow('13:16', 'foo');
checkNotOverflow('13:16', '13:16');
checkNotOverflow('13:16', '13:17');
checkNotOverflow('13:16', '14:15');
checkNotOverflow('foo', '13:16');
// Overflow cases
checkOverflow('13:16', '13:15');
checkOverflow('23:59:59.999', '13:16');
input.min = '14:00'; // value < min && value > max
checkOverflow('13:16', '12:00');
// ----------------------------------------------------------------
debug('');
debug('Type=week');
input.type = 'week';
input.min = '';
// No overflow cases
checkNotOverflow('2010-W01', null);
checkNotOverflow('2010-W01', '');
checkNotOverflow('2010-W01', 'foo');
checkNotOverflow('2010-W01', '2010-W01');
checkNotOverflow('2010-W01', '2010-W02');
checkNotOverflow('2010-W01', '2011-W01');
checkNotOverflow('foo', '2011-W01');
checkNotOverflow('2010-W01', '1582-W01'); // Too small max value.
// Overflow cases
checkOverflow('2010-W01', '2009-W12');
checkOverflow('9999-W01', '2010-W12');
input.min = '2010-W02'; // value < min && value > max
checkOverflow('2010-W01', '2009-W50');
var successfullyParsed = true;
description('This test aims to check for rangeUnderflow flag with type=date input fields');
var input = document.createElement('input');
input.type = 'date';
function checkUnderflow(value, min)
{
input.value = value;
input.min = min;
var underflow = input.validity.rangeUnderflow;
var resultText = 'The value "' + input.value + '" ' +
(underflow ? 'undeflows' : 'doesn\'t underflow') +
' the minimum value "' + input.min + '".';
if (underflow)
testPassed(resultText);
else
testFailed(resultText);
}
function checkNotUnderflow(value, min)
{
input.value = value;
input.min = min;
var underflow = input.validity.rangeUnderflow;
var resultText = 'The value "' + input.value + '" ' +
(underflow ? 'underflows' : 'doesn\'t underflow') +
' the minimum value "' + input.min + '".';
if (underflow)
testFailed(resultText);
else
testPassed(resultText);
}
// No underflow cases
checkNotUnderflow('2010-01-27', null);
checkNotUnderflow('2010-01-27', '');
checkNotUnderflow('2010-01-27', 'foo');
// 1000-01-01 is smaller than the implicit minimum value.
// But the date parser rejects it before comparing the minimum value.
checkNotUnderflow('1000-01-01', '');
checkNotUnderflow('1582-10-15', '');
checkNotUnderflow('2010-01-27', '2010-01-26');
checkNotUnderflow('2010-01-27', '2009-01-28');
checkNotUnderflow('foo', '2011-01-26');
// Underflow cases
checkUnderflow('2010-01-27', '2010-01-28');
checkUnderflow('9999-01-01', '10000-12-31');
input.max = '2010-01-01'; // value < min && value > max
checkUnderflow('2010-01-27', '2010-02-01');
var successfullyParsed = true;
description('This test aims to check for rangeUnderflow flag with type=number input fields');
var input = document.createElement('input');
function check(value, min, underflowExpected)
{
input.value = value;
input.min = min;
var actual = input.validity.rangeUnderflow;
var didPass = actual == underflowExpected;
var resultText = 'The value "' + input.value + '" ' + (actual ? 'underflows' : 'doesn\'t underflow') + ' the minimum value "' + input.min + '".';
if (didPass)
testPassed(resultText);
else
testFailed(resultText);
}
// No underflow cases
input.type = 'text'; // No underflow for type=text.
check('99', '100', false);
input.type = 'number';
check('101', '100', false); // Very normal case.
check('-99', '-100', false);
check('101', '1E+2', false);
check('1.01', '1.00', false);
check('abc', '100', false); // Invalid value.
check('', '1', false); // No value.
check('-1', '', false); // No min.
check('-1', 'xxx', false); // Invalid min.
// The following case should be rangeUnderflow==true ideally. But the "double" type doesn't have enough precision.
check('0.999999999999999999999999999999999999999998', '0.999999999999999999999999999999999999999999', false);
// Underflow cases
check('99', '100', true);
check('-101', '-100', true);
check('99', '1E+2', true);
input.max = '100'; // value < min && value > max
check('101', '200', true);
var successfullyParsed = true;
description('This test aims to check for rangeUnderflow flag with type=range input fields');
var input = document.createElement('input');
function check(value, min, underflowExpected)
{
input.value = value;
input.min = min;
var actual = input.validity.rangeUnderflow;
var didPass = actual == underflowExpected;
var resultText = 'The value "' + input.value + '" ' + (actual ? 'underflows' : 'doesn\'t underflow') + ' the minimum value "' + input.min + '".';
if (didPass)
testPassed(resultText);
else
testFailed(resultText);
}
// No underflow cases
input.type = 'text'; // No overflow for type=text.
check('99', '100', false);
input.type = 'range';
check('101', '100', false); // Very normal case.
check('-99', '-100', false);
check('101', '1E+2', false);
check('1.01', '1.00', false);
check('abc', '100', false); // Invalid value.
check('', '1', false); // No value.
// The following case should be rangeUnderflow==true ideally. But the "double" type doesn't have enough precision.
check('0.999999999999999999999999999999999999999998', '0.999999999999999999999999999999999999999999', false);
input.max = '0'; // If min > max, max is reset to min and min is not changed.
check('101', '100', false);
input.max = '';
// Underflow cases
check('99', '100', true);
check('-101', '-100', true);
check('99', '1E+2', true);
check('-1', '', true); // No min.
check('-1', 'xxx', true); // Invalid min.
var successfullyParsed = true;
description('This test aims to check for rangeUnderflow flag with input fields');
var input = document.createElement('input');
function checkUnderflow(value, min)
{
input.value = value;
input.min = min;
var underflow = input.validity.rangeUnderflow;
var resultText = 'The value "' + input.value + '" ' +
(underflow ? 'undeflows' : 'doesn\'t underflow') +
' the minimum value "' + input.min + '".';
if (underflow)
testPassed(resultText);
else
testFailed(resultText);
}
function checkNotUnderflow(value, min)
{
input.value = value;
input.min = min;
var underflow = input.validity.rangeUnderflow;
var resultText = 'The value "' + input.value + '" ' +
(underflow ? 'underflows' : 'doesn\'t underflow') +
' the minimum value "' + input.min + '".';
if (underflow)
testFailed(resultText);
else
testPassed(resultText);
}
// ----------------------------------------------------------------
debug('Type=text');
input.type = 'text'; // No underflow for type=text.
checkNotUnderflow('99', '100');
// ----------------------------------------------------------------
debug('');
debug('Type=date');
input.type = 'date';
input.max = '';
// No underflow cases
checkNotUnderflow('2010-01-27', null);
checkNotUnderflow('2010-01-27', '');
checkNotUnderflow('2010-01-27', 'foo');
// 1000-01-01 is smaller than the implicit minimum value.
// But the date parser rejects it before comparing the minimum value.
checkNotUnderflow('1000-01-01', '');
checkNotUnderflow('1582-10-15', '');
checkNotUnderflow('2010-01-27', '2010-01-26');
checkNotUnderflow('2010-01-27', '2009-01-28');
checkNotUnderflow('foo', '2011-01-26');
// Underflow cases
checkUnderflow('2010-01-27', '2010-01-28');
checkUnderflow('9999-01-01', '10000-12-31');
input.max = '2010-01-01'; // value < min && value > max
checkUnderflow('2010-01-27', '2010-02-01');
// ----------------------------------------------------------------
debug('');
debug('Type=datetime');
input.type = 'datetime';
input.max = '';
// No underflow cases
checkNotUnderflow('2010-01-27T12:34Z', null);
checkNotUnderflow('2010-01-27T12:34Z', '');
checkNotUnderflow('2010-01-27T12:34Z', 'foo');
// 1000-01-01 is smaller than the implicit minimum value.
// But the date parser rejects it before comparing the minimum value.
checkNotUnderflow('1000-01-01T12:34Z', '');
checkNotUnderflow('1582-10-15T00:00Z', '');
checkNotUnderflow('2010-01-27T12:34Z', '2010-01-26T00:00Z');
checkNotUnderflow('2010-01-27T12:34Z', '2009-01-28T00:00Z');
checkNotUnderflow('foo', '2011-01-26T00:00Z');
// Underflow cases
checkUnderflow('2010-01-27T12:34Z', '2010-01-27T13:00Z');
checkUnderflow('9999-01-01T12:00Z', '10000-12-31T12:00Z');
input.max = '2010-01-01T12:00Z'; // value < min && value > max
checkUnderflow('2010-01-27T12:00Z', '2010-02-01T12:00Z');
// ----------------------------------------------------------------
debug('');
debug('Type=datetime-local');
input.type = 'datetime-local';
input.max = '';
// No underflow cases
checkNotUnderflow('2010-01-27T12:34', null);
checkNotUnderflow('2010-01-27T12:34', '');
checkNotUnderflow('2010-01-27T12:34', 'foo');
// 1000-01-01 is smaller than the implicit minimum value.
// But the date parser rejects it before comparing the minimum value.
checkNotUnderflow('1000-01-01T12:34', '');
checkNotUnderflow('1582-10-15T00:00', '');
checkNotUnderflow('2010-01-27T12:34', '2010-01-26T00:00');
checkNotUnderflow('2010-01-27T12:34', '2009-01-28T00:00');
checkNotUnderflow('foo', '2011-01-26T00:00');
// Underflow cases
checkUnderflow('2010-01-27T12:34', '2010-01-27T13:00');
checkUnderflow('9999-01-01T12:00', '10000-12-31T12:00');
input.max = '2010-01-01T12:00'; // value < min && value > max
checkUnderflow('2010-01-27T12:00', '2010-02-01T12:00');
// ----------------------------------------------------------------
debug('');
debug('Type=month');
input.type = 'month';
input.max = '';
// No underflow cases
checkNotUnderflow('2010-01', null);
checkNotUnderflow('2010-01', '');
checkNotUnderflow('2010-01', 'foo');
// 1000-01 is smaller than the implicit minimum value.
// But the month parser rejects it before comparing the minimum value.
checkNotUnderflow('1000-01', '');
checkNotUnderflow('1582-10', '');
checkNotUnderflow('2010-01', '2009-12');
checkNotUnderflow('2010-01', '2009-01');
checkNotUnderflow('foo', '2011-01');
// Underflow cases
checkUnderflow('2010-01', '2010-02');
checkUnderflow('9999-01', '10000-12');
input.max = '2009-12'; // value < min && value > max
checkUnderflow('2010-01', '2010-02');
// ----------------------------------------------------------------
debug('');
debug('Type=number');
input.type = 'number';
input.max = '';
// No underflow cases
input.type = 'number';
checkNotUnderflow('101', '100'); // Very normal case.
checkNotUnderflow('-99', '-100');
checkNotUnderflow('101', '1E+2');
checkNotUnderflow('1.01', '1.00');
checkNotUnderflow('abc', '100'); // Invalid value.
checkNotUnderflow('', '1'); // No value.
checkNotUnderflow('-1', ''); // No min.
checkNotUnderflow('-1', 'xxx'); // Invalid min.
// The following case should be rangeUnderflow==true ideally. But the "double" type doesn't have enough precision.
checkNotUnderflow('0.999999999999999999999999999999999999999998', '0.999999999999999999999999999999999999999999');
// Underflow cases
checkUnderflow('99', '100');
checkUnderflow('-101', '-100');
checkUnderflow('99', '1E+2');
input.max = '100'; // value < min && value > max
checkUnderflow('101', '200');
// ----------------------------------------------------------------
debug('');
debug('Type=range');
input.type = 'range';
input.max = '';
// No underflow cases
checkNotUnderflow('101', '100'); // Very normal case.
checkNotUnderflow('-99', '-100');
checkNotUnderflow('101', '1E+2');
checkNotUnderflow('1.01', '1.00');
checkNotUnderflow('abc', '100'); // Invalid value.
checkNotUnderflow('', '1'); // No value.
// The following case should be rangeUnderflow==true ideally. But the "double" type doesn't have enough precision.
checkNotUnderflow('0.999999999999999999999999999999999999999998', '0.999999999999999999999999999999999999999999');
input.max = '0'; // If min > max, max is reset to min and min is not changed.
checkNotUnderflow('101', '100');
input.max = '';
// Underflow cases
checkUnderflow('99', '100');
checkUnderflow('-101', '-100');
checkUnderflow('99', '1E+2');
checkUnderflow('-1', ''); // No min.
checkUnderflow('-1', 'xxx'); // Invalid min.
// ----------------------------------------------------------------
debug('');
debug('Type=time');
input.type = 'time';
input.max = '';
// No underflow cases
checkNotUnderflow('13:16', null);
checkNotUnderflow('13:16', '');
checkNotUnderflow('13:16', 'foo');
checkNotUnderflow('00:00:00.000', '');
checkNotUnderflow('23:59:59.999', '');
checkNotUnderflow('13:16', '11:00');
checkNotUnderflow('13:16', '13:16');
checkNotUnderflow('foo', '11:00');
// Underflow cases
checkUnderflow('13:16', '13:17');
checkUnderflow('23:59', '23:59:30');
input.max = '11:00'; // value < min && value > max
checkUnderflow('13:16', '14:00');
// ----------------------------------------------------------------
debug('');
debug('Type=week');
input.type = 'week';
input.max = '';
// No underflow cases
checkNotUnderflow('2010-W01', null);
checkNotUnderflow('2010-W01', '');
checkNotUnderflow('2010-W01', 'foo');
// 1000-W01 is smaller than the implicit minimum value.
// But the month parser rejects it before comparing the minimum value.
checkNotUnderflow('1000-W01', '');
checkNotUnderflow('1583-W01', '');
checkNotUnderflow('2010-W01', '2009-W51');
checkNotUnderflow('2010-W01', '2009-W01');
checkNotUnderflow('foo', '2011-W01');
// Underflow cases
checkUnderflow('2010-W01', '2010-W02');
checkUnderflow('9999-W01', '10000-W12');
input.max = '2009-W52'; // value < min && value > max
checkUnderflow('2010-W01', '2010-W02');
var successfullyParsed = true;
2010-02-02 Kent Tamura <tkent@chromium.org>
Reviewed by Darin Adler.
rangeOverflow/rangeUnderflow support for type=datetime, datetime-local,
month, time and week
https://bugs.webkit.org/show_bug.cgi?id=34483
Tests: fast/forms/ValidityState-rangeOverflow.html
fast/forms/ValidityState-rangeUnderflow.html
* html/HTMLInputElement.cpp:
Defines the hard limits for the types as double values.
(WebCore::HTMLInputElement::rangeUnderflow): Supports the types.
(WebCore::HTMLInputElement::rangeOverflow): Supports the types.
(WebCore::HTMLInputElement::minimum): Supports the types.
(WebCore::HTMLInputElement::maximum): Supports the types.
2010-02-02 Fumitoshi Ukai <ukai@chromium.org>
Reviewed by Alexey Proskuryakov.
......
......@@ -80,12 +80,20 @@ static const double numberDefaultStep = 1.0;
static const double numberStepScaleFactor = 1.0;
// Constant values for minimum().
static const double dateDefaultMinimum = -12219292800000.0; // This means 1582-10-15T00:00Z.
static const double dateTimeDefaultMinimum = -12219292800000.0; // ditto.
static const double monthDefaultMinimum = (1582.0 - 1970) * 12 + 10 - 1; // 1582-10
static const double numberDefaultMinimum = -DBL_MAX;
static const double rangeDefaultMinimum = 0.0;
static const double timeDefaultMinimum = 0.0; // 00:00:00.000
static const double weekDefaultMinimum = -12212380800000.0; // 1583-01-03, the first Monday of 1583.
// Constant values for maximum().
static const double dateDefaultMaximum = DBL_MAX;
static const double dateTimeDefaultMaximum = DBL_MAX;
static const double monthDefaultMaximum = DBL_MAX;
static const double numberDefaultMaximum = DBL_MAX;
static const double rangeDefaultMaximum = 100.0;
static const double timeDefaultMaximum = 86399999.0; // 23:59:59.999
static const double weekDefaultMaximum = DBL_MAX;
HTMLInputElement::HTMLInputElement(const QualifiedName& tagName, Document* doc, HTMLFormElement* f)
: HTMLTextFormControlElement(tagName, doc, f)
......@@ -271,22 +279,24 @@ bool HTMLInputElement::rangeUnderflow() const
const double nan = numeric_limits<double>::quiet_NaN();
switch (inputType()) {
case DATE:
case DATETIME:
case DATETIMELOCAL:
case MONTH:
case NUMBER:
case RANGE: {
case RANGE:
case TIME:
case WEEK: {
double doubleValue = parseToDouble(value(), nan);
return isfinite(doubleValue) && doubleValue < minimum();
}
case BUTTON:
case CHECKBOX:
case COLOR:
case DATETIME:
case DATETIMELOCAL:
case EMAIL:
case FILE:
case HIDDEN:
case IMAGE:
case ISINDEX:
case MONTH:
case PASSWORD:
case RADIO:
case RESET:
......@@ -294,9 +304,7 @@ bool HTMLInputElement::rangeUnderflow() const
case SUBMIT:
case TELEPHONE:
case TEXT:
case TIME:
case URL:
case WEEK:
break;
}
return false;
......@@ -307,22 +315,24 @@ bool HTMLInputElement::rangeOverflow() const
const double nan = numeric_limits<double>::quiet_NaN();
switch (inputType()) {
case DATE:
case DATETIME:
case DATETIMELOCAL:
case MONTH:
case NUMBER:
case RANGE: {
case RANGE:
case TIME:
case WEEK: {
double doubleValue = parseToDouble(value(), nan);
return isfinite(doubleValue) && doubleValue > maximum();
}
case BUTTON:
case CHECKBOX:
case COLOR:
case DATETIME:
case DATETIMELOCAL:
case EMAIL:
case FILE:
case HIDDEN:
case IMAGE:
case ISINDEX:
case MONTH:
case PASSWORD:
case RADIO:
case RESET:
......@@ -330,9 +340,7 @@ bool HTMLInputElement::rangeOverflow() const
case SUBMIT:
case TELEPHONE:
case TEXT:
case TIME:
case URL:
case WEEK:
break;
}
return false;
......@@ -343,21 +351,27 @@ double HTMLInputElement::minimum() const
switch (inputType()) {
case DATE:
return parseToDouble(getAttribute(minAttr), dateDefaultMinimum);
case DATETIME:
case DATETIMELOCAL:
return parseToDouble(getAttribute(minAttr), dateTimeDefaultMinimum);
case MONTH:
return parseToDouble(getAttribute(minAttr), monthDefaultMinimum);
case NUMBER:
return parseToDouble(getAttribute(minAttr), numberDefaultMinimum);
case RANGE:
return parseToDouble(getAttribute(minAttr), rangeDefaultMinimum);
case TIME:
return parseToDouble(getAttribute(minAttr), timeDefaultMinimum);
case WEEK:
return parseToDouble(getAttribute(minAttr), weekDefaultMinimum);
case BUTTON:
case CHECKBOX:
case COLOR:
case DATETIME:
case DATETIMELOCAL:
case EMAIL:
case FILE:
case HIDDEN:
case IMAGE:
case ISINDEX:
case MONTH:
case PASSWORD:
case RADIO:
case RESET:
......@@ -365,9 +379,7 @@ double HTMLInputElement::minimum() const
case SUBMIT:
case TELEPHONE:
case TEXT:
case TIME:
case URL:
case WEEK:
break;
}
ASSERT_NOT_REACHED();
......@@ -379,6 +391,11 @@ double HTMLInputElement::maximum() const
switch (inputType()) {
case DATE:
return parseToDouble(getAttribute(maxAttr), dateDefaultMaximum);
case DATETIME:
case DATETIMELOCAL:
return parseToDouble(getAttribute(maxAttr), dateTimeDefaultMaximum);
case MONTH:
return parseToDouble(getAttribute(maxAttr), monthDefaultMaximum);
case NUMBER:
return parseToDouble(getAttribute(maxAttr), numberDefaultMaximum);
case RANGE: {
......@@ -390,17 +407,18 @@ double HTMLInputElement::maximum() const
max = std::max(min, rangeDefaultMaximum);
return max;
}
case TIME:
return parseToDouble(getAttribute(maxAttr), timeDefaultMaximum);
case WEEK:
return parseToDouble(getAttribute(maxAttr), weekDefaultMaximum);
case BUTTON:
case CHECKBOX:
case COLOR:
case DATETIME:
case DATETIMELOCAL:
case EMAIL:
case FILE:
case HIDDEN:
case IMAGE:
case ISINDEX:
case MONTH:
case PASSWORD:
case RADIO:
case RESET:
......@@ -408,9 +426,7 @@ double HTMLInputElement::maximum() const
case SUBMIT:
case TELEPHONE:
case TEXT:
case TIME:
case URL:
case WEEK:
break;
}
ASSERT_NOT_REACHED();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment