зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1461742, test for getCustomInterfaceCallback, r=bgrins
This commit is contained in:
Родитель
c68cebacd6
Коммит
a9bdfae60b
|
@ -12,6 +12,8 @@
|
|||
<!-- test results are displayed in the html:body -->
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<simpleelement id="simple"/>
|
||||
|
||||
<!-- test code goes here -->
|
||||
<script type="application/javascript"><![CDATA[
|
||||
|
||||
|
@ -20,6 +22,7 @@
|
|||
function runTests() {
|
||||
ok(MozXULElement, "MozXULElement defined on the window");
|
||||
testParseXULToFragment();
|
||||
testCustomInterface();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
|
@ -39,6 +42,39 @@
|
|||
deck.remove();
|
||||
}
|
||||
|
||||
function testCustomInterface() {
|
||||
class SimpleElement extends MozXULElement {
|
||||
get disabled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
set disabled(val) {
|
||||
}
|
||||
|
||||
get tabIndex() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
set tabIndex(val) {
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define("simpleelement", SimpleElement);
|
||||
MozXULElement.implementCustomInterface(SimpleElement, [Ci.nsIDOMXULControlElement]);
|
||||
|
||||
is(document.documentElement.getCustomInterfaceCallback, undefined,
|
||||
"No getCustomInterfaceCallback on non-custom element");
|
||||
is(typeof document.getElementById("simple").getCustomInterfaceCallback, "function",
|
||||
"getCustomInterfaceCallback available on custom element when set");
|
||||
try {
|
||||
document.documentElement.QueryInterface(Ci.nsIDOMXULControlElement)
|
||||
ok(false, "Non-custom element implements custom interface");
|
||||
} catch (ex) {
|
||||
ok(true, "Non-custom element implements custom interface");
|
||||
}
|
||||
ok(document.getElementById("simple").QueryInterface(Ci.nsIDOMXULControlElement),
|
||||
"Implements custom interface");
|
||||
}
|
||||
]]>
|
||||
</script>
|
||||
</window>
|
||||
|
|
Загрузка…
Ссылка в новой задаче