зеркало из https://github.com/mozilla/gecko-dev.git
Bug 985824 - Search for link text context menu item should pay attention to selection. r=Unfocused
This commit is contained in:
Родитель
7ce174faf5
Коммит
179f4cb0aa
|
@ -1668,7 +1668,7 @@ nsContextMenu.prototype = {
|
|||
// Formats the 'Search <engine> for "<selection or link text>"' context menu.
|
||||
formatSearchContextItem: function() {
|
||||
var menuItem = document.getElementById("context-searchselect");
|
||||
var selectedText = this.onLink ? this.linkText() : this.textSelected;
|
||||
var selectedText = this.isTextSelected ? this.textSelected : this.linkText();
|
||||
|
||||
// Store searchTerms in context menu item so we know what to search onclick
|
||||
menuItem.searchTerms = selectedText;
|
||||
|
|
|
@ -94,6 +94,20 @@ function test() {
|
|||
shouldBeShown: false,
|
||||
});
|
||||
|
||||
testElement({
|
||||
id: "partialLink",
|
||||
isSelected: true,
|
||||
shouldBeShown: true,
|
||||
expectedLabelContents: "link selection",
|
||||
});
|
||||
|
||||
testElement({
|
||||
id: "partialLink",
|
||||
isSelected: false,
|
||||
shouldBeShown: true,
|
||||
expectedLabelContents: "A partial link " + ellipsis,
|
||||
});
|
||||
|
||||
// cleanup
|
||||
document.popupNode = null;
|
||||
gBrowser.removeCurrentTab();
|
||||
|
|
|
@ -10,5 +10,7 @@
|
|||
<span id="mixedContent">
|
||||
I'm some text, and <a href="http://mozilla.org">I'm a link!</a>
|
||||
</span>
|
||||
|
||||
<a href="http://mozilla.org">A partial <span id="partialLink">link selection</span></a>
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче