Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/lib/utils/color_utils_spec.js')
-rw-r--r--spec/frontend/lib/utils/color_utils_spec.js27
1 files changed, 26 insertions, 1 deletions
diff --git a/spec/frontend/lib/utils/color_utils_spec.js b/spec/frontend/lib/utils/color_utils_spec.js
index 8c846abd77f..c6b88b2957c 100644
--- a/spec/frontend/lib/utils/color_utils_spec.js
+++ b/spec/frontend/lib/utils/color_utils_spec.js
@@ -1,4 +1,9 @@
-import { textColorForBackground, hexToRgb, validateHexColor } from '~/lib/utils/color_utils';
+import {
+ textColorForBackground,
+ hexToRgb,
+ validateHexColor,
+ darkModeEnabled,
+} from '~/lib/utils/color_utils';
describe('Color utils', () => {
describe('Converting hex code to rgb', () => {
@@ -47,4 +52,24 @@ describe('Color utils', () => {
expect(validateHexColor(color)).toEqual(output);
});
});
+
+ describe('darkModeEnabled', () => {
+ it.each`
+ page | bodyClass | ideTheme | expected
+ ${'ide:index'} | ${'gl-dark'} | ${'monokai-light'} | ${false}
+ ${'ide:index'} | ${'ui-light'} | ${'monokai'} | ${true}
+ ${'groups:issues:index'} | ${'ui-light'} | ${'monokai'} | ${false}
+ ${'groups:issues:index'} | ${'gl-dark'} | ${'monokai-light'} | ${true}
+ `(
+ 'is $expected on $page with $bodyClass body class and $ideTheme IDE theme',
+ async ({ page, bodyClass, ideTheme, expected }) => {
+ document.body.outerHTML = `<body class="${bodyClass}" data-page="${page}"></body>`;
+ window.gon = {
+ user_color_scheme: ideTheme,
+ };
+
+ expect(darkModeEnabled()).toBe(expected);
+ },
+ );
+ });
});