Auto merge of #14086 - chajath:time-datetime-attribute, r=ConnorGBrewster

Add DateTime string attribute to Time

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix part of #12967, content parsing will come as a separate PR.

<!-- Either: -->
- [X] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->

---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14086)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-12-03 13:23:27 -08:00 committed by GitHub
commit 8992b65410
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>