blob: 570a1c2c8c5499c5ff8dbada39f3b48ae68fa1c0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
add_task(async function noAutofillWhenCaretNotAtEnd() {
gURLBar.focus();
// Add a visit that can be autofilled.
await PlacesUtils.history.clear();
await PlacesTestUtils.addVisits([
{
uri: "http://example.com/",
},
]);
// Fill the input with xample.
gURLBar.inputField.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();
});
|