diff options
Diffstat (limited to 'comm/mail/components/unifiedtoolbar/test/unit/test_buttonStyle.js')
-rw-r--r-- | comm/mail/components/unifiedtoolbar/test/unit/test_buttonStyle.js | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/comm/mail/components/unifiedtoolbar/test/unit/test_buttonStyle.js b/comm/mail/components/unifiedtoolbar/test/unit/test_buttonStyle.js new file mode 100644 index 0000000000..0ffeefa00b --- /dev/null +++ b/comm/mail/components/unifiedtoolbar/test/unit/test_buttonStyle.js @@ -0,0 +1,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" + ); +}); |