diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/html/semantics/text-level-semantics/the-time-element | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/web-platform/tests/html/semantics/text-level-semantics/the-time-element')
2 files changed, 68 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/semantics/text-level-semantics/the-time-element/.gitkeep b/testing/web-platform/tests/html/semantics/text-level-semantics/the-time-element/.gitkeep new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/testing/web-platform/tests/html/semantics/text-level-semantics/the-time-element/.gitkeep diff --git a/testing/web-platform/tests/html/semantics/text-level-semantics/the-time-element/001.html b/testing/web-platform/tests/html/semantics/text-level-semantics/the-time-element/001.html new file mode 100644 index 000000000..e1cd0480a --- /dev/null +++ b/testing/web-platform/tests/html/semantics/text-level-semantics/the-time-element/001.html @@ -0,0 +1,68 @@ +<!doctype html> +<html> + <head> + <meta charset=utf-8> + <title>HTML time element API</title> + <style> +#time { visibility: hidden; } + </style> + <link rel="help" href="https://html.spec.whatwg.org/multipage/#the-time-element"> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + </head> + <body> + <div id="log"></div> + <!-- intentionally nested to test parsing rules --> + <p id="time"><time pubdate datetime="2000-02-01T03:04:05Z">Dummy text <time>2001-06-07T<time>08:09<time></time></time>Z</time></time></p> + <script type="text/javascript"> +function makeTime(dateTime,contents,dateTimeProp) { + var timeEl = document.createElement('time'); + if( dateTime ) { + timeEl.setAttribute('datetime',dateTime); + } + if( contents ) { + timeEl.innerHTML = contents; + } + if( dateTimeProp ) { + timeEl.dateTime = dateTimeProp; + } + return timeEl; +} + +var timep = document.getElementById('time'); +var times = timep.getElementsByTagName('time'); + +//TIME elements +test(function () { + assert_equals( times.length, 4 ); +}, 'HTML parsing should locate 4 time elements in this document'); +test(function () { + assert_true( !!window.HTMLTimeElement ); +}, 'HTMLTimeElement should be exposed for prototyping'); +test(function () { + assert_true( makeTime() instanceof window.HTMLTimeElement, 'createElement variant' ); + assert_true( times[0] instanceof window.HTMLTimeElement, 'HTML parsing variant' ); +}, 'the time elements should be instanceof HTMLTimeElement'); + +//dateTime +test(function () { + assert_equals( makeTime('2000-02-01T03:04:05Z','2001-02-01T03:04:05Z').dateTime, '2000-02-01T03:04:05Z' ); +}, 'the datetime attribute should be reflected by the .dateTime property'); +test(function () { + assert_equals( typeof makeTime().dateTime, 'string', 'typeof test' ); + assert_equals( makeTime().dateTime, '', 'value test' ); +}, 'the dateTime IDL property should default to an empty string'); +test(function () { + assert_equals( makeTime(false,false,'2000-02-01T03:04:05Z').dateTime, '2000-02-01T03:04:05Z' ); +}, 'the dateTime property should be read/write'); +test(function () { + assert_equals( makeTime('go fish').dateTime, 'go fish' ); +}, 'the datetime attribute should be reflected by the .dateTime property even if it is invalid'); +test(function () { + assert_equals( makeTime(false,'2000-02-01T03:04:05Z').dateTime, '' ); +}, 'the datetime attribute should not reflect the textContent'); + + </script> + + </body> +</html> |