summaryrefslogtreecommitdiffstats
path: root/browser/components/urlbar/tests/browser/browser_new_tab_urlbar_reset.js
blob: b2bce4b22e9249b73792c00e64ef1c78c3243d71 (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
35
36
37
38
39
/* Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/ */

"use strict";

/**
 * Verify that urlbar state is reset when opening a new tab, so searching for the
 * same text will reopen the results popup.
 */
add_task(async function () {
  let tab = await BrowserTestUtils.openNewForegroundTab(
    gBrowser,
    "about:blank",
    false
  );
  await UrlbarTestUtils.promiseAutocompleteResultPopup({
    window,
    value: "m",
  });
  assertOpen();

  let tab2 = await BrowserTestUtils.openNewForegroundTab(
    gBrowser,
    "about:blank",
    false
  );
  await UrlbarTestUtils.promiseAutocompleteResultPopup({
    window,
    value: "m",
  });
  assertOpen();

  BrowserTestUtils.removeTab(tab);
  BrowserTestUtils.removeTab(tab2);
});

function assertOpen() {
  Assert.equal(gURLBar.view.isOpen, true, "Should be showing the popup");
}