Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Selection API idlharness.js test #9024

Merged
merged 1 commit into from
Mar 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions interfaces/selection-api.idl
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// http://w3c.github.io/selection-api/#selection-interface
interface Selection {
readonly attribute Node? anchorNode;
readonly attribute unsigned long anchorOffset;
readonly attribute Node? focusNode;
readonly attribute unsigned long focusOffset;
readonly attribute boolean isCollapsed;
readonly attribute unsigned long rangeCount;
readonly attribute DOMString type;
Range getRangeAt(unsigned long index);
void addRange(Range range);
void removeRange(Range range);
void removeAllRanges();
void empty();
void collapse(Node? node, optional unsigned long offset = 0);
void setPosition(Node? node, optional unsigned long offset = 0);
void collapseToStart();
void collapseToEnd();
void extend(Node node, optional unsigned long offset = 0);
void setBaseAndExtent(Node anchorNode,
unsigned long anchorOffset,
Node focusNode,
unsigned long focusOffset);
void selectAllChildren(Node node);
[CEReactions]
void deleteFromDocument();
boolean containsNode(Node node,
optional boolean allowPartialContainment = false);
stringifier DOMString ();
};

partial interface Document {
Selection? getSelection();
};

partial interface Window {
Selection? getSelection();
};

partial interface GlobalEventHandlers {
attribute EventHandler onselectstart;
attribute EventHandler onselectionchange;
};
53 changes: 5 additions & 48 deletions selection/interfaces.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,58 +5,14 @@
<script src=/resources/testharnessreport.js></script>
<script src=/resources/WebIDLParser.js></script>
<script src=/resources/idlharness.js></script>
<script type=text/plain>
// http://w3c.github.io/selection-api/#selection-interface
interface Selection {
readonly attribute Node? anchorNode;
readonly attribute unsigned long anchorOffset;
readonly attribute Node? focusNode;
readonly attribute unsigned long focusOffset;
readonly attribute boolean isCollapsed;
readonly attribute unsigned long rangeCount;
readonly attribute DOMString type;
Range getRangeAt(unsigned long index);
void addRange(Range range);
void removeRange(Range range);
void removeAllRanges();
void empty();
void collapse(Node? node, optional unsigned long offset = 0);
void setPosition(Node? node, optional unsigned long offset = 0);
void collapseToStart();
void collapseToEnd();
void extend(Node node, optional unsigned long offset = 0);
void setBaseAndExtent(Node anchorNode,
unsigned long anchorOffset,
Node focusNode,
unsigned long focusOffset);
void selectAllChildren(Node node);
[CEReactions]
void deleteFromDocument();
boolean containsNode(Node node,
optional boolean allowPartialContainment = false);
stringifier DOMString ();
};

partial interface Document {
Selection? getSelection();
};

partial interface Window {
Selection? getSelection();
};

partial interface GlobalEventHandlers {
attribute EventHandler onselectstart;
attribute EventHandler onselectionchange;
};
</script>
<script>
"use strict";

function doTest([dom, cssom, touchevents, uievents, html]) {
function doTest([selection, dom, cssom, touchevents, uievents, html]) {
var idlArray = new IdlArray();
idlArray.add_untested_idls('interface SVGElement {};');
idlArray.add_untested_idls(dom + cssom + touchevents + uievents + html);
idlArray.add_idls(document.querySelector("script[type=text\\/plain]").textContent);
idlArray.add_idls(selection);
idlArray.add_objects({Selection: ['getSelection()']});
idlArray.test();
}
Expand All @@ -66,7 +22,8 @@
}

promise_test(function() {
return Promise.all([fetchData("/interfaces/dom.idl"),
return Promise.all([fetchData("/interfaces/selection-api.idl"),
fetchData("/interfaces/dom.idl"),
fetchData("/interfaces/cssom.idl"),
fetchData("/interfaces/touchevents.idl"),
fetchData("/interfaces/uievents.idl"),
Expand Down