summaryrefslogtreecommitdiffstats
path: root/browser/components/urlbar/tests/browser/browser_autocomplete_no_title.js
blob: fa30a7608a32ada7f954db6511c7e25cc87b71db (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";

/**
 * This test ensures that we display just the domain name when a URL result doesn't
 * have a title.
 */

add_task(async function () {
  let tab = await BrowserTestUtils.openNewForegroundTab(
    gBrowser,
    "about:mozilla"
  );
  await PlacesUtils.history.clear();
  const uri = "http://bug1060642.example.com/beards/are/pretty/great";
  await PlacesTestUtils.addVisits([{ uri, title: "" }]);
  registerCleanupFunction(async function () {
    await PlacesUtils.history.clear();
    BrowserTestUtils.removeTab(tab);
  });

  await UrlbarTestUtils.promiseAutocompleteResultPopup({
    window,
    value: "bug1060642",
  });
  let result = await UrlbarTestUtils.getDetailsOfResultAt(window, 1);
  Assert.equal(
    result.displayed.title,
    "bug1060642.example.com",
    "Result title should be as expected"
  );
});