mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1146566 - 2 - Avoid using CPOWs in test browser_markupview_tag_edit_03.js; r=bgrins
This change updates the browser_markupview_tag_edit_03.js test by making use of the getDomElementInfo message listener to retrieve information about the tested nodes without having to go through CPOWs.
This commit is contained in:
parent
080bdcd814
commit
2cee371113
@ -14,26 +14,37 @@ add_task(function*() {
|
||||
yield inspector.markup.expandAll();
|
||||
|
||||
info("Selecting the test node");
|
||||
let node = content.document.querySelector("#retag-me");
|
||||
let child = content.document.querySelector("#retag-me-2");
|
||||
yield selectNode("#retag-me", inspector);
|
||||
|
||||
info("Getting the markup-container for the test node");
|
||||
let container = yield getContainerForSelector("#retag-me", inspector);
|
||||
is(node.tagName, "DIV", "We've got #retag-me element, it's a DIV");
|
||||
ok(container.expanded, "It is expanded");
|
||||
is(child.parentNode, node, "Child #retag-me-2 is inside #retag-me");
|
||||
ok(container.expanded, "The container is expanded");
|
||||
|
||||
info("Changing the tagname");
|
||||
let parentInfo = yield getNodeInfo("#retag-me");
|
||||
is(parentInfo.tagName.toLowerCase(), "div",
|
||||
"We've got #retag-me element, it's a DIV");
|
||||
is(parentInfo.numChildren, 1, "#retag-me has one child");
|
||||
let childInfo = yield getNodeInfo("#retag-me > *");
|
||||
is(childInfo.attributes[0].value, "retag-me-2",
|
||||
"#retag-me's only child is #retag-me-2");
|
||||
|
||||
info("Changing #retag-me's tagname in the markup-view");
|
||||
let mutated = inspector.once("markupmutation");
|
||||
let tagEditor = container.editor.tag;
|
||||
setEditableFieldValue(tagEditor, "p", inspector);
|
||||
yield mutated;
|
||||
|
||||
info("Checking that the tagname change was done");
|
||||
node = content.document.querySelector("#retag-me");
|
||||
info("Checking that the markup-container exists and is correct");
|
||||
container = yield getContainerForSelector("#retag-me", inspector);
|
||||
is(node.tagName, "P", "We've got #retag-me, it should now be a P");
|
||||
ok(container.expanded, "It is still expanded");
|
||||
ok(container.selected, "It is still selected");
|
||||
is(child.parentNode, node, "Child #retag-me-2 is still inside #retag-me");
|
||||
ok(container.expanded, "The container is still expanded");
|
||||
ok(container.selected, "The container is still selected");
|
||||
|
||||
info("Checking that the tagname change was done");
|
||||
parentInfo = yield getNodeInfo("#retag-me");
|
||||
is(parentInfo.tagName.toLowerCase(), "p",
|
||||
"The #retag-me element is now a P");
|
||||
is(parentInfo.numChildren, 1, "#retag-me still has one child");
|
||||
childInfo = yield getNodeInfo("#retag-me > *");
|
||||
is(childInfo.attributes[0].value, "retag-me-2",
|
||||
"#retag-me's only child is #retag-me-2");
|
||||
});
|
||||
|
@ -200,6 +200,15 @@ function getNodeFront(selector, {walker}) {
|
||||
return walker.querySelector(walker.rootNode, selector);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get information about a DOM element, identified by its selector.
|
||||
* @param {String} selector.
|
||||
* @return {Promise} a promise that resolves to the element's information.
|
||||
*/
|
||||
function getNodeInfo(selector) {
|
||||
return executeInContent("devtools:test:getDomElementInfo", {selector});
|
||||
}
|
||||
|
||||
/**
|
||||
* Highlight a node and set the inspector's current selection to the node or
|
||||
* the first match of the given css selector.
|
||||
|
Loading…
Reference in New Issue
Block a user