summaryrefslogtreecommitdiffstats
path: root/browser/base/content/test/forms/browser_selectpopup_text_transform.js
blob: 671f39e2a6813b0880786fc289bb0d098bd329dd (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
40
const PAGE = `
<!doctype html>
<select style="text-transform: uppercase">
  <option>abc</option>
  <option>defg</option>
</select>
`;

add_task(async function () {
  await SpecialPowers.pushPrefEnv({
    set: [["dom.forms.select.customstyling", true]],
  });
  const url = "data:text/html," + encodeURI(PAGE);
  await BrowserTestUtils.withNewTab(
    {
      gBrowser,
      url,
    },
    async function (browser) {
      let popup = await openSelectPopup("click");
      let menuitems = popup.querySelectorAll("menuitem");
      is(menuitems[0].textContent, "abc", "Option text should be lowercase");
      is(menuitems[1].textContent, "defg", "Option text should be lowercase");

      let optionStyle = getComputedStyle(menuitems[0]);
      is(
        optionStyle.textTransform,
        "uppercase",
        "Option text should be transformed to uppercase"
      );

      optionStyle = getComputedStyle(menuitems[1]);
      is(
        optionStyle.textTransform,
        "uppercase",
        "Option text should be transformed to uppercase"
      );
    }
  );
});