Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1545618 [wpt PR 16278] - Add some binding tests for DOMStringMap.…
…, a=testonly Automatic update from web-platform-tests Add some binding tests for DOMStringMap. The specification was updated in whatwg/webidl#706. -- wpt-commits: 78193fbe36156498378dcd00ee6f1e28007ed355 wpt-pr: 16278 UltraBlame original commit: fd0d5d305b28fa2bb42346f07a37d9ca74db1533
- Loading branch information
Showing
1 changed file
with
364 additions
and
0 deletions.
There are no files selected for viewing
364 changes: 364 additions & 0 deletions
364
testing/web-platform/tests/html/dom/elements/global-attributes/dataset-binding.window.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,364 @@ | ||
[ | ||
9 | ||
" | ||
x | ||
" | ||
] | ||
. | ||
forEach | ||
( | ||
function | ||
( | ||
key | ||
) | ||
{ | ||
test | ||
( | ||
function | ||
( | ||
) | ||
{ | ||
var | ||
element | ||
= | ||
document | ||
. | ||
createElement | ||
( | ||
" | ||
div | ||
" | ||
) | ||
; | ||
var | ||
dataset | ||
= | ||
element | ||
. | ||
dataset | ||
; | ||
var | ||
value | ||
= | ||
" | ||
value | ||
for | ||
" | ||
+ | ||
this | ||
. | ||
name | ||
; | ||
assert_equals | ||
( | ||
dataset | ||
[ | ||
key | ||
] | ||
undefined | ||
) | ||
; | ||
element | ||
. | ||
setAttribute | ||
( | ||
" | ||
data | ||
- | ||
" | ||
+ | ||
key | ||
value | ||
) | ||
; | ||
assert_equals | ||
( | ||
element | ||
. | ||
getAttribute | ||
( | ||
" | ||
data | ||
- | ||
" | ||
+ | ||
key | ||
) | ||
value | ||
) | ||
; | ||
assert_equals | ||
( | ||
dataset | ||
[ | ||
key | ||
] | ||
value | ||
) | ||
; | ||
var | ||
propdesc | ||
= | ||
Object | ||
. | ||
getOwnPropertyDescriptor | ||
( | ||
dataset | ||
key | ||
) | ||
; | ||
assert_not_equals | ||
( | ||
propdesc | ||
undefined | ||
) | ||
; | ||
assert_equals | ||
( | ||
propdesc | ||
. | ||
value | ||
value | ||
) | ||
; | ||
assert_true | ||
( | ||
propdesc | ||
. | ||
writable | ||
) | ||
; | ||
assert_true | ||
( | ||
propdesc | ||
. | ||
enumerable | ||
) | ||
; | ||
assert_true | ||
( | ||
propdesc | ||
. | ||
configurable | ||
) | ||
; | ||
} | ||
" | ||
Getting | ||
property | ||
descriptor | ||
for | ||
key | ||
" | ||
+ | ||
key | ||
) | ||
; | ||
test | ||
( | ||
function | ||
( | ||
) | ||
{ | ||
var | ||
element | ||
= | ||
document | ||
. | ||
createElement | ||
( | ||
" | ||
div | ||
" | ||
) | ||
; | ||
var | ||
dataset | ||
= | ||
element | ||
. | ||
dataset | ||
; | ||
var | ||
proto | ||
= | ||
" | ||
proto | ||
getter | ||
for | ||
" | ||
+ | ||
this | ||
. | ||
name | ||
; | ||
var | ||
calledSetter | ||
= | ||
[ | ||
] | ||
; | ||
Object | ||
. | ||
defineProperty | ||
( | ||
DOMStringMap | ||
. | ||
prototype | ||
key | ||
{ | ||
" | ||
get | ||
" | ||
: | ||
function | ||
( | ||
) | ||
{ | ||
return | ||
proto | ||
; | ||
} | ||
" | ||
set | ||
" | ||
: | ||
this | ||
. | ||
unreached_func | ||
( | ||
" | ||
Should | ||
not | ||
call | ||
[ | ||
[ | ||
Set | ||
] | ||
] | ||
on | ||
prototype | ||
" | ||
) | ||
" | ||
configurable | ||
" | ||
: | ||
true | ||
} | ||
) | ||
; | ||
this | ||
. | ||
add_cleanup | ||
( | ||
function | ||
( | ||
) | ||
{ | ||
delete | ||
DOMStringMap | ||
. | ||
prototype | ||
[ | ||
key | ||
] | ||
; | ||
} | ||
) | ||
; | ||
var | ||
value | ||
= | ||
" | ||
value | ||
for | ||
" | ||
+ | ||
this | ||
. | ||
name | ||
; | ||
assert_equals | ||
( | ||
dataset | ||
[ | ||
key | ||
] | ||
proto | ||
) | ||
; | ||
assert_equals | ||
( | ||
element | ||
. | ||
getAttribute | ||
( | ||
" | ||
data | ||
- | ||
" | ||
+ | ||
key | ||
) | ||
null | ||
) | ||
; | ||
assert_equals | ||
( | ||
dataset | ||
[ | ||
key | ||
] | ||
= | ||
value | ||
value | ||
) | ||
; | ||
assert_equals | ||
( | ||
dataset | ||
[ | ||
key | ||
] | ||
value | ||
) | ||
; | ||
assert_equals | ||
( | ||
element | ||
. | ||
getAttribute | ||
( | ||
" | ||
data | ||
- | ||
" | ||
+ | ||
key | ||
) | ||
value | ||
) | ||
; | ||
} | ||
" | ||
Setting | ||
property | ||
for | ||
key | ||
" | ||
+ | ||
key | ||
+ | ||
" | ||
with | ||
accessor | ||
property | ||
on | ||
prototype | ||
" | ||
) | ||
; | ||
} | ||
) | ||
; |