summaryrefslogtreecommitdiffstats
path: root/toolkit/content/tests/browser/datetime/browser_datetime_toplevel.js
blob: 2e97e4d2daeaed17bc6e4611acb78c1264f7314c (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
/* Any copyright is dedicated to the Public Domain.
 * https://creativecommons.org/publicdomain/zero/1.0/ */

add_task(async function () {
  let input = document.createElement("input");
  input.type = "date";
  registerCleanupFunction(() => input.remove());
  document.body.appendChild(input);

  let shown = BrowserTestUtils.waitForDateTimePickerPanelShown(window);

  const shadowRoot = SpecialPowers.wrap(input).openOrClosedShadowRoot;

  EventUtils.synthesizeMouseAtCenter(
    shadowRoot.getElementById("calendar-button"),
    {}
  );

  let popup = await shown;
  ok(!!popup, "Should've shown the popup");

  let hidden = BrowserTestUtils.waitForPopupEvent(popup, "hidden");
  popup.hidePopup();

  await hidden;
  popup.remove();
});