зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1540722 - Copy link location should work for learn-more links. r=nchevobbe
Support for coping link location from within the Console panel (through the context menu) can be extended and cover learn more links too. Differential Revision: https://phabricator.services.mozilla.com/D38546 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
7fd5fb983a
Коммит
237ff71915
|
@ -144,6 +144,7 @@ class Message extends Component {
|
||||||
onLearnMoreClick(e) {
|
onLearnMoreClick(e) {
|
||||||
const { exceptionDocURL } = this.props;
|
const { exceptionDocURL } = this.props;
|
||||||
this.props.serviceContainer.openLink(exceptionDocURL, e);
|
this.props.serviceContainer.openLink(exceptionDocURL, e);
|
||||||
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleMessage(e) {
|
toggleMessage(e) {
|
||||||
|
@ -428,6 +429,7 @@ class Message extends Component {
|
||||||
learnMore = dom.a(
|
learnMore = dom.a(
|
||||||
{
|
{
|
||||||
className: "learn-more-link webconsole-learn-more-link",
|
className: "learn-more-link webconsole-learn-more-link",
|
||||||
|
href: exceptionDocURL,
|
||||||
title: exceptionDocURL.split("?")[0],
|
title: exceptionDocURL.split("?")[0],
|
||||||
onClick: this.onLearnMoreClick,
|
onClick: this.onLearnMoreClick,
|
||||||
},
|
},
|
||||||
|
|
|
@ -31,7 +31,8 @@ async function performTests() {
|
||||||
for (const [errorMessageName, expression] of Object.entries(
|
for (const [errorMessageName, expression] of Object.entries(
|
||||||
ErrorDocStatements
|
ErrorDocStatements
|
||||||
)) {
|
)) {
|
||||||
const title = ErrorDocs.GetURL({ errorMessageName }).split("?")[0];
|
const errorUrl = ErrorDocs.GetURL({ errorMessageName });
|
||||||
|
const title = errorUrl.split("?")[0];
|
||||||
|
|
||||||
hud.ui.clearOutput();
|
hud.ui.clearOutput();
|
||||||
const onMessage = waitForMessage(hud, "RangeError:");
|
const onMessage = waitForMessage(hud, "RangeError:");
|
||||||
|
@ -47,5 +48,10 @@ async function performTests() {
|
||||||
title,
|
title,
|
||||||
`The link has the expected "${title}" title`
|
`The link has the expected "${title}" title`
|
||||||
);
|
);
|
||||||
|
is(
|
||||||
|
learnMoreLink.href,
|
||||||
|
errorUrl,
|
||||||
|
`The link has the expected "${errorUrl}" href value`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,5 +72,30 @@ add_task(async function() {
|
||||||
await waitForClipboardPromise(() => copyURLItem.click(), TEST_URI);
|
await waitForClipboardPromise(() => copyURLItem.click(), TEST_URI);
|
||||||
ok(true, "Expected text was copied to the clipboard.");
|
ok(true, "Expected text was copied to the clipboard.");
|
||||||
|
|
||||||
|
await hideContextMenu(hud);
|
||||||
|
hud.ui.clearOutput();
|
||||||
|
|
||||||
|
info("Test Copy URL menu item from [Learn More] link");
|
||||||
|
|
||||||
|
info("Generate a Reference Error in the JS Console");
|
||||||
|
message = await executeAndWaitForMessage(
|
||||||
|
hud,
|
||||||
|
"area51.aliens",
|
||||||
|
"ReferenceError:"
|
||||||
|
);
|
||||||
|
ok(message, "Error log found in the console");
|
||||||
|
|
||||||
|
const learnMoreElement = message.node.querySelector(".learn-more-link");
|
||||||
|
menuPopup = await openContextMenu(hud, learnMoreElement);
|
||||||
|
copyURLItem = menuPopup.querySelector(CONTEXT_MENU_ID);
|
||||||
|
ok(copyURLItem, "Copy url menu item is available in context menu");
|
||||||
|
|
||||||
|
info("Click on Copy URL menu item and wait for clipboard to be updated");
|
||||||
|
await waitForClipboardPromise(
|
||||||
|
() => copyURLItem.click(),
|
||||||
|
learnMoreElement.href
|
||||||
|
);
|
||||||
|
ok(true, "Expected text was copied to the clipboard.");
|
||||||
|
|
||||||
await hideContextMenu(hud);
|
await hideContextMenu(hud);
|
||||||
});
|
});
|
||||||
|
|
Загрузка…
Ссылка в новой задаче