OLD | NEW |
1 /* | 1 /* |
2 Distributed under both the W3C Test Suite License [1] and the W3C | 2 Distributed under both the W3C Test Suite License [1] and the W3C |
3 3-clause BSD License [2]. To contribute to a W3C Test Suite, see the | 3 3-clause BSD License [2]. To contribute to a W3C Test Suite, see the |
4 policies and contribution forms [3]. | 4 policies and contribution forms [3]. |
5 | 5 |
6 [1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license | 6 [1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license |
7 [2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license | 7 [2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license |
8 [3] http://www.w3.org/2004/10/27-testcases | 8 [3] http://www.w3.org/2004/10/27-testcases |
9 */ | 9 */ |
10 | 10 |
(...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 assert_false(desc.enumerable, this.name + ".length is enumerable"); | 765 assert_false(desc.enumerable, this.name + ".length is enumerable"); |
766 assert_true(desc.configurable, this.name + ".length is not configura
ble"); | 766 assert_true(desc.configurable, this.name + ".length is not configura
ble"); |
767 | 767 |
768 var constructors = this.extAttrs | 768 var constructors = this.extAttrs |
769 .filter(function(attr) { return attr.name == "Constructor"; }); | 769 .filter(function(attr) { return attr.name == "Constructor"; }); |
770 var expected_length = minOverloadLength(constructors); | 770 var expected_length = minOverloadLength(constructors); |
771 assert_equals(self[this.name].length, expected_length, "wrong value
for " + this.name + ".length"); | 771 assert_equals(self[this.name].length, expected_length, "wrong value
for " + this.name + ".length"); |
772 }.bind(this), this.name + " interface object length"); | 772 }.bind(this), this.name + " interface object length"); |
773 } | 773 } |
774 | 774 |
| 775 if (!this.is_callback() || this.has_constants()) { |
| 776 test(function() { |
| 777 // This function tests WebIDL as of 2015-11-17. |
| 778 // https://heycam.github.io/webidl/#interface-object |
| 779 |
| 780 assert_own_property(self, this.name, |
| 781 "self does not have own property " + format_valu
e(this.name)); |
| 782 |
| 783 // "All interface objects must have a property named “name” with |
| 784 // attributes { [[Writable]]: false, [[Enumerable]]: false, |
| 785 // [[Configurable]]: true } whose value is the identifier of the |
| 786 // corresponding interface." |
| 787 |
| 788 assert_own_property(self[this.name], "name"); |
| 789 var desc = Object.getOwnPropertyDescriptor(self[this.name], "name"); |
| 790 assert_false("get" in desc, this.name + ".name has getter"); |
| 791 assert_false("set" in desc, this.name + ".name has setter"); |
| 792 assert_false(desc.writable, this.name + ".name is writable"); |
| 793 assert_false(desc.enumerable, this.name + ".name is enumerable"); |
| 794 assert_true(desc.configurable, this.name + ".name is not configurabl
e"); |
| 795 assert_equals(self[this.name].name, this.name, "wrong value for " +
this.name + ".name"); |
| 796 }.bind(this), this.name + " interface object name"); |
| 797 } |
| 798 |
775 // TODO: Test named constructors if I find any interfaces that have them. | 799 // TODO: Test named constructors if I find any interfaces that have them. |
776 | 800 |
777 test(function() | 801 test(function() |
778 { | 802 { |
779 // This function tests WebIDL as of 2015-01-21. | 803 // This function tests WebIDL as of 2015-01-21. |
780 // https://heycam.github.io/webidl/#interface-object | 804 // https://heycam.github.io/webidl/#interface-object |
781 | 805 |
782 if (this.is_callback() && !this.has_constants()) { | 806 if (this.is_callback() && !this.has_constants()) { |
783 return; | 807 return; |
784 } | 808 } |
(...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1692 /** An array of values produced by the "typedef" production. */ | 1716 /** An array of values produced by the "typedef" production. */ |
1693 this.values = obj.values; | 1717 this.values = obj.values; |
1694 | 1718 |
1695 } | 1719 } |
1696 //@} | 1720 //@} |
1697 | 1721 |
1698 IdlTypedef.prototype = Object.create(IdlObject.prototype); | 1722 IdlTypedef.prototype = Object.create(IdlObject.prototype); |
1699 | 1723 |
1700 }()); | 1724 }()); |
1701 // vim: set expandtab shiftwidth=4 tabstop=4 foldmarker=@{,@} foldmethod=marker: | 1725 // vim: set expandtab shiftwidth=4 tabstop=4 foldmarker=@{,@} foldmethod=marker: |
OLD | NEW |