Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test gets skipped with pattern: os == 'linux' && os_version == '18.04' && asan OR os == 'linux' && os_version == '18.04' && tsan OR win11_2009 && asan
- Manifest: browser/components/urlbar/tests/browser/browser.toml
/* Any copyright is dedicated to the Public Domain.
"use strict";
add_task(async function noAutofillWhenCaretNotAtEnd() {
gURLBar.focus();
// Add a visit that can be autofilled.
await PlacesUtils.history.clear();
await PlacesTestUtils.addVisits([
{
},
]);
// Fill the input with xample.
gURLBar.value = "xample";
// Move the caret to the beginning and type e.
gURLBar.selectionStart = 0;
gURLBar.selectionEnd = 0;
EventUtils.sendString("e");
// Check the first result and input.
let result = await UrlbarTestUtils.getDetailsOfResultAt(window, 0);
Assert.ok(!result.autofill, "The first result should not be autofill");
Assert.equal(gURLBar.value, "example");
Assert.equal(gURLBar.selectionStart, 1);
Assert.equal(gURLBar.selectionEnd, 1);
await PlacesUtils.history.clear();
});