@activecollab/components
Version:
ActiveCollab Components
60 lines (59 loc) • 2.23 kB
JavaScript
;
var _themes = require("./themes");
describe("resolveTheme", function () {
it("should split the theme list into light and dark without overlap", function () {
expect(_themes.LIGHT_THEME_NAMES).toEqual(["indigo", "cupcake", "classic"]);
expect(_themes.DARK_THEME_NAMES).toEqual(["neon", "dracula", "one-dark"]);
});
it("should ignore the system appearance in single mode", function () {
var selection = {
mode: _themes.THEME_MODE_SINGLE,
theme: "dracula",
themeLight: "cupcake",
themeDark: "one-dark"
};
expect((0, _themes.resolveTheme)(selection, false)).toBe("dracula");
expect((0, _themes.resolveTheme)(selection, true)).toBe("dracula");
});
it("should follow the system appearance in system mode", function () {
var selection = {
mode: _themes.THEME_MODE_SYSTEM,
theme: "dracula",
themeLight: "cupcake",
themeDark: "one-dark"
};
expect((0, _themes.resolveTheme)(selection, false)).toBe("cupcake");
expect((0, _themes.resolveTheme)(selection, true)).toBe("one-dark");
});
it("should fall back to the defaults when a slot is missing or unknown", function () {
expect((0, _themes.resolveTheme)({
mode: _themes.THEME_MODE_SYSTEM
}, false)).toBe(_themes.DEFAULT_THEME);
expect((0, _themes.resolveTheme)({
mode: _themes.THEME_MODE_SYSTEM
}, true)).toBe(_themes.DEFAULT_DARK_THEME);
expect((0, _themes.resolveTheme)({
mode: _themes.THEME_MODE_SYSTEM,
themeLight: "solarized",
themeDark: "solarized"
}, false)).toBe(_themes.DEFAULT_THEME);
expect((0, _themes.resolveTheme)({
mode: _themes.THEME_MODE_SYSTEM,
themeLight: "solarized",
themeDark: "solarized"
}, true)).toBe(_themes.DEFAULT_DARK_THEME);
expect((0, _themes.resolveTheme)({
theme: "solarized"
}, false)).toBe(_themes.DEFAULT_THEME);
});
it("should treat an absent or unrecognised mode as single", function () {
expect((0, _themes.resolveTheme)({
theme: "neon"
}, false)).toBe("neon");
expect((0, _themes.resolveTheme)({
mode: "auto",
theme: "neon"
}, true)).toBe("neon");
});
});
//# sourceMappingURL=themes.test.js.map