summaryrefslogtreecommitdiffstats
path: root/browser/components/enterprisepolicies/tests/browser/show_home_button/browser_policy_show_home_button.js
blob: c1d7242dc0e2b06fdf5bfc91a43634a6a95dff6b (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
/* Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/ */

/* import-globals-from ../head.js */

"use strict";

add_task(async function test_home_button_shown_boolean() {
  await setupPolicyEngineWithJson({
    policies: {
      ShowHomeButton: true,
    },
  });

  // Since testing will apply the policy after the browser has already started,
  // we will need to open a new window to actually see the menu bar
  let newWin = await BrowserTestUtils.openNewBrowserWindow();
  let homeButton = newWin.document.getElementById("home-button");
  isnot(homeButton, null, "The home button should be visible");

  await BrowserTestUtils.closeWindow(newWin);
});

add_task(async function test_home_button_hidden_boolean() {
  await setupPolicyEngineWithJson({
    policies: {
      ShowHomeButton: false,
    },
  });

  // Since testing will apply the policy after the browser has already started,
  // we will need to open a new window to actually see the menu bar
  let newWin = await BrowserTestUtils.openNewBrowserWindow();
  let homeButton = newWin.document.getElementById("home-button");
  is(homeButton, null, "The home button should be gone");

  await BrowserTestUtils.closeWindow(newWin);
});