Add DateTime string attribute to Time

Also handle datetime content attribute when attribute is absent.

Rephrase terms used in the test: dateTime IDL property, datetime
attribute and datetime content attribute.

Remove failure expectations for time element.
This commit is contained in:
In-Ho Yi 2016-11-24 11:42:56 -08:00
parent 99c4821485
commit 25f0317a82
6 changed files with 33 additions and 247 deletions

View file

@ -47,21 +47,23 @@ test(function () {
//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');
}, 'the datetime attribute should be reflected by the dateTime IDL 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');
}, 'the dateTime IDL 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');
assert_equals( makeTime(false,'2000-02-01T03:04:05Z', '2000-02-01').dateTime, '2000-02-01' );
}, 'the datetime content attribute should not reflect the textContent when datetime attribute is present.');
test(function () {
assert_equals( makeTime(false,'2000-02-01T03:04:05Z').dateTime, '2000-02-01T03:04:05Z' );
}, 'the datetime content attribute should reflect the textContent when datetime attribute is absent.');
</script>
</body>