Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/external/wpt/WebIDL/ecmascript-binding/legacy-platform-object.html |
| diff --git a/third_party/WebKit/LayoutTests/external/wpt/WebIDL/ecmascript-binding/legacy-platform-object.html b/third_party/WebKit/LayoutTests/external/wpt/WebIDL/ecmascript-binding/legacy-platform-object.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..9c767928d2b3934baebf4bf507e52e5ce1045411 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/external/wpt/WebIDL/ecmascript-binding/legacy-platform-object.html |
| @@ -0,0 +1,43 @@ |
| +<!DOCTYPE html> |
| +<meta charset="utf-8"> |
| +<title>Legacy platform objects</title> |
| +<link rel="help" href="https://heycam.github.io/webidl/#es-legacy-platform-objects"> |
| +<script src="/resources/testharness.js"></script> |
| +<script src="/resources/testharnessreport.js"></script> |
| +<script> |
| +// https://heycam.github.io/webidl/#legacy-platform-object-defineownproperty |
| +// 3.9.3. [[DefineOwnProperty]] |
| + |
| +test(function() { |
| + let span = document.createElement("span"); |
| + // DOMTokenList supports an indexed property getter but not a setter. |
| + let domTokenList = span.classList; |
| + assert_throws(new TypeError(), () => { |
| + Object.defineProperty(domTokenList, "0", {value: true, writable: true}); |
| + }); |
| + assert_throws(new TypeError(), () => { |
| + Object.defineProperty(domTokenList, "0", { |
| + get: () => {}, |
| + set: () => {}, |
| + }); |
| + }); |
| + assert_equals(domTokenList[0], undefined); |
| + domTokenList[0] = true; |
| + assert_equals(domTokenList[0], undefined); |
| + assert_throws(new TypeError(), () => { |
| + "use strict"; |
| + domTokenList[0] = true; |
| + }); |
|
domenic
2017/07/05 20:12:26
Like below, it would be good to check that the pro
Yuki
2017/07/06 09:14:46
Done.
|
| +}, "Test [[DefineOwnProperty]] with no indexed property setter support."); |
| + |
| +test(function() { |
| + // HTMLSelectElement supports an indexed property setter. |
| + let select = document.createElement("select"); |
| + assert_throws(new TypeError(), () => { |
| + Object.defineProperty(select, "0", { |
| + get: () => {}, |
| + set: () => {}, |
| + }); |
|
domenic
2017/07/05 20:12:26
You should also test the success case. In particul
Yuki
2017/07/06 09:14:46
Done.
|
| + }); |
| +}, "Test [[DefineOwnProperty]] with indexed property setter support."); |
| +</script> |