зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1070778 - Selecting a moz-action: result then typing more can result in "Search X for moz-action:..." item. r=mak
--HG-- extra : transplant_source : P/b%9D%B6T%85%22%A8%1B%F0%18%3A%827%C2qx%F6%97
This commit is contained in:
Родитель
e499ce320f
Коммит
fcd3684965
|
@ -296,6 +296,8 @@ skip-if = e10s # Bug ?????? - test directly manipulates content (directly gets e
|
|||
[browser_bug1015721.js]
|
||||
skip-if = os == 'win' || e10s # Bug 1056146 - FullZoomHelper uses promiseTabLoadEvent() which isn't e10s friendly
|
||||
[browser_bug1064280_changeUrlInPinnedTab.js]
|
||||
[browser_bug1070778.js]
|
||||
skip-if = os == "linux" # Bug 1073339 - Investigate autocomplete test unreliability on Linux
|
||||
[browser_canonizeURL.js]
|
||||
skip-if = e10s # Bug ?????? - [JavaScript Error: "Error in AboutHome.sendAboutHomeData TypeError: target.messageManager is undefined" {file: "resource:///modules/AboutHome.jsm" line: 208}]
|
||||
[browser_contentAreaClick.js]
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
function* promiseAutoComplete(inputText) {
|
||||
gURLBar.focus();
|
||||
gURLBar.value = inputText.slice(0, -1);
|
||||
EventUtils.synthesizeKey(inputText.slice(-1) , {});
|
||||
yield promiseSearchComplete();
|
||||
}
|
||||
|
||||
function is_selected(index) {
|
||||
is(gURLBar.popup.richlistbox.selectedIndex, index, `Item ${index + 1} should be selected`);
|
||||
}
|
||||
|
||||
add_task(function*() {
|
||||
// This test is only relevant if UnifiedComplete is enabled.
|
||||
if (!Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete"))
|
||||
return;
|
||||
|
||||
let itemIds = [];
|
||||
registerCleanupFunction(() => {
|
||||
itemIds.forEach(PlacesUtils.bookmarks.removeItem);
|
||||
});
|
||||
|
||||
let itemId =
|
||||
PlacesUtils.bookmarks.insertBookmark(PlacesUtils.unfiledBookmarksFolderId,
|
||||
NetUtil.newURI("http://example.com/?q=%s"),
|
||||
PlacesUtils.bookmarks.DEFAULT_INDEX,
|
||||
"test");
|
||||
PlacesUtils.bookmarks.setKeywordForBookmark(itemId, "keyword");
|
||||
itemIds.push(itemId);
|
||||
|
||||
// This item only needed so we can select the keyword item, select something
|
||||
// else, then select the keyword item again.
|
||||
itemId =
|
||||
PlacesUtils.bookmarks.insertBookmark(PlacesUtils.unfiledBookmarksFolderId,
|
||||
NetUtil.newURI("http://example.com/keyword"),
|
||||
PlacesUtils.bookmarks.DEFAULT_INDEX,
|
||||
"keyword abc");
|
||||
itemIds.push(itemId);
|
||||
|
||||
yield promiseAutoComplete("keyword a");
|
||||
|
||||
// Select keyword item
|
||||
EventUtils.synthesizeKey("VK_DOWN", {});
|
||||
is_selected(0);
|
||||
// Select next one (important!)
|
||||
EventUtils.synthesizeKey("VK_DOWN", {});
|
||||
is_selected(1);
|
||||
// Re-select keyword item
|
||||
EventUtils.synthesizeKey("VK_UP", {});
|
||||
is_selected(0);
|
||||
|
||||
EventUtils.synthesizeKey("b", {});
|
||||
yield promiseSearchComplete();
|
||||
|
||||
is(gURLBar.value, "keyword ab", "urlbar should have expected input");
|
||||
|
||||
let result = gURLBar.popup.richlistbox.firstChild;
|
||||
isnot(result, null, "Should have first item");
|
||||
let uri = NetUtil.newURI(result.getAttribute("url"));
|
||||
is(uri.spec, makeActionURI("keyword", {url: "http://example.com/?q=ab", input: "keyword ab"}).spec, "Expect correct url");
|
||||
|
||||
EventUtils.synthesizeKey("VK_ESCAPE", {});
|
||||
yield promisePopupHidden(gURLBar.popup);
|
||||
});
|
|
@ -31,7 +31,8 @@ let tests = [
|
|||
setup: function() {
|
||||
gURLBar.value = testActionURL;
|
||||
gURLBar.valueIsTyped = true;
|
||||
is(gURLBar.value, testActionURL, "gURLBar.value starts with correct value");
|
||||
is(gURLBar._value, testActionURL, "gURLBar starts with the correct real value");
|
||||
is(gURLBar.value, testURL, "gURLBar starts with the correct display value");
|
||||
|
||||
// Focus the urlbar so we can select it all & copy
|
||||
gURLBar.focus();
|
||||
|
@ -39,7 +40,7 @@ let tests = [
|
|||
goDoCommand("cmd_copy");
|
||||
},
|
||||
success: function() {
|
||||
is(gURLBar.value, testActionURL, "gURLBar.value didn't change when copying");
|
||||
is(gURLBar._value, testActionURL, "gURLBar.value didn't change when copying");
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -51,7 +52,7 @@ let tests = [
|
|||
goDoCommand("cmd_copy");
|
||||
},
|
||||
success: function() {
|
||||
is(gURLBar.value, testActionURL, "gURLBar.value didn't change when copying");
|
||||
is(gURLBar._value, testActionURL, "gURLBar.value didn't change when copying");
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -73,7 +74,8 @@ let tests = [
|
|||
gURLBar.value = testActionURL;
|
||||
gURLBar.valueIsTyped = true;
|
||||
// Sanity check that we have the right value
|
||||
is(gURLBar.value, testActionURL, "gURLBar.value starts with correct value");
|
||||
is(gURLBar._value, testActionURL, "gURLBar starts with the correct real value");
|
||||
is(gURLBar.value, testURL, "gURLBar starts with the correct display value");
|
||||
|
||||
// Now just select part of the value & cut that.
|
||||
gURLBar.selectionStart = testURL.length - 10;
|
||||
|
|
|
@ -125,19 +125,6 @@
|
|||
|
||||
<field name="_value">""</field>
|
||||
|
||||
<!--
|
||||
onBeforeValueGet is called by the base-binding's .value getter.
|
||||
It can return an object with a "value" property, to override the
|
||||
return value of the getter.
|
||||
-->
|
||||
<method name="onBeforeValueGet">
|
||||
<body><![CDATA[
|
||||
if (this.hasAttribute("actiontype"))
|
||||
return {value: this._value};
|
||||
return null;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<!--
|
||||
onBeforeValueSet is called by the base-binding's .value setter.
|
||||
It should return the value that the setter should use.
|
||||
|
@ -728,8 +715,10 @@
|
|||
]]></body>
|
||||
</method>
|
||||
|
||||
<property name="textValue"
|
||||
onget="return this.value;">
|
||||
<property name="textValue">
|
||||
<getter><![CDATA[
|
||||
return this.inputField.value;
|
||||
]]></getter>
|
||||
<setter>
|
||||
<![CDATA[
|
||||
try {
|
||||
|
|
|
@ -260,11 +260,6 @@
|
|||
<field name="_disableTrim">false</field>
|
||||
<property name="value">
|
||||
<getter><![CDATA[
|
||||
if (typeof this.onBeforeValueGet == "function") {
|
||||
var result = this.onBeforeValueGet();
|
||||
if (result)
|
||||
return result.value;
|
||||
}
|
||||
return this.inputField.value;
|
||||
]]></getter>
|
||||
<setter><![CDATA[
|
||||
|
|
Загрузка…
Ссылка в новой задаче