Write a test for HTMLDialogElement#open

These changes fix #12574
This commit is contained in:
vrod 2016-07-26 02:26:10 -03:00
parent 4e18c230d0
commit 9b7e38e95d
2 changed files with 36 additions and 0 deletions

View file

@ -37205,6 +37205,12 @@
"deleted_reftests": {}, "deleted_reftests": {},
"items": { "items": {
"testharness": { "testharness": {
"html/semantics/interactive-elements/the-dialog-element/dialog-open.html": [
{
"path": "html/semantics/interactive-elements/the-dialog-element/dialog-open.html",
"url": "/html/semantics/interactive-elements/the-dialog-element/dialog-open.html"
}
],
"html/semantics/scripting-1/the-script-element/script-charset-03.html": [ "html/semantics/scripting-1/the-script-element/script-charset-03.html": [
{ {
"path": "html/semantics/scripting-1/the-script-element/script-charset-03.html", "path": "html/semantics/scripting-1/the-script-element/script-charset-03.html",

View file

@ -0,0 +1,30 @@
<!doctype html>
<meta charset="utf-8">
<title>dialog element: open</title>
<link rel=help href="https://html.spec.whatwg.org/multipage/forms.html#dom-dialog-open">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<dialog id="d1">
<p>foobar</p>
<button>OK</button>
</dialog>
<dialog id="d2" open>
<p>foobar</p>
<button>OK</button>
</dialog>
<script>
var d1 = document.getElementById('d1');
var d2 = document.getElementById('d2');
test(function(){
assert_false(d1.open);
assert_true(d2.open);
}, "On getting, the IDL open attribute must return true if the content open attribute is set, and false if it is absent.");
test(function(){
d1.open = true;
assert_true(d1.hasAttribute("open"));
d2.open = false;
assert_false(d2.hasAttribute("open"));
}, "On setting, the content open attribute must be removed if the IDL open attribute is set to false, and must be present if the IDL open attribute is set to true.");
</script>