blob: 0ffeefa00b22a2fefac9277d05eb1877e5cec19d (
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
|
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const { BUTTON_STYLE_MAP, BUTTON_STYLE_PREF } = ChromeUtils.importESModule(
"resource:///modules/ButtonStyle.mjs"
);
add_task(function test_buttonStyleMap() {
Assert.ok(Array.isArray(BUTTON_STYLE_MAP), "BUTTON_STYLE_MAP is an array");
Assert.ok(
BUTTON_STYLE_MAP.every(style => typeof style === "string"),
"All entries in the style map should be strings"
);
for (const style of BUTTON_STYLE_MAP) {
Assert.stringMatches(
style,
/[a-z-]/,
"Button style class should be formatted in kebab case"
);
}
});
add_task(function test_buttonStylePref() {
Assert.equal(
typeof BUTTON_STYLE_PREF,
"string",
"BUTTON_STYLE_PREF is a string"
);
const prefValue = Services.prefs.getIntPref(BUTTON_STYLE_PREF, 0);
Assert.ok(
Number.isInteger(prefValue),
"BUTTON_STYLE_PREF pref should hold an integer"
);
Assert.less(
prefValue,
BUTTON_STYLE_MAP.length,
"Value of BUTTON_STYLE_PREF should be within map"
);
});
|