forked from web-platform-tests/wpt
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce IdlInterface#should_have_interface_object() method (web-pla…
…tform-tests#23104) Resolves web-platform-tests#18827.
- Loading branch information
1 parent
b1d24b1
commit 2979a22
Showing
3 changed files
with
60 additions
and
24 deletions.
There are no files selected for viewing
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
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
30 changes: 30 additions & 0 deletions
30
resources/test/tests/unit/IdlInterface/should_have_interface_object.html
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,30 @@ | ||
<!DOCTYPE HTML> | ||
<title>IdlInterface.prototype.should_have_interface_object()</title> | ||
<div id="log"></div> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/resources/WebIDLParser.js"></script> | ||
<script src="/resources/idlharness.js"></script> | ||
<script src="../../../idl-helper.js"></script> | ||
<script> | ||
"use strict"; | ||
test(function() { | ||
var i = interfaceFrom("callback interface A { const unsigned short B = 0; };"); | ||
assert_true(i.should_have_interface_object()); | ||
}, "callback interface with a constant"); | ||
|
||
test(function() { | ||
var i = interfaceFrom("callback interface A { void b(); sequence<any> c(); };"); | ||
assert_false(i.should_have_interface_object()); | ||
}, "callback interface without a constant"); | ||
|
||
test(function() { | ||
var i = interfaceFrom("[NoInterfaceObject] interface A { };"); | ||
assert_false(i.should_have_interface_object()); | ||
}, "non-callback interface with [NoInterfaceObject]"); | ||
|
||
test(function() { | ||
var i = interfaceFrom("interface A { };"); | ||
assert_true(i.should_have_interface_object()); | ||
}, "non-callback interface without [NoInterfaceObject]"); | ||
</script> |