summaryrefslogtreecommitdiffstats
path: root/toolkit/components/printing/tests/browser_toolbar_button_toggle.js
blob: 0a644a1e57980060f5d5c2797691958511ce9601 (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
/* Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/
 */

add_task(async function testToggleToolbarButton() {
  await PrintHelper.withTestPage(async helper => {
    CustomizableUI.addWidgetToArea("print-button", CustomizableUI.AREA_NAVBAR);

    helper.assertDialogClosed();

    // get the button from the toolbar
    let button = document.getElementById("print-button");
    // click the toolbar button
    EventUtils.synthesizeMouseAtCenter(button, {});

    await helper.waitForDialog();

    // ensure dialog box is open
    helper.assertDialogOpen();

    // click toolbar button again to close dialog box
    EventUtils.synthesizeMouseAtCenter(button, {});

    helper.assertDialogClosed();
  });
});