@scalar/use-hooks 0.2.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/useBindCx/cva.d.ts.map +1 -1
- package/dist/useBindCx/cva.js +2 -1
- package/dist/useBindCx/cva.js.map +2 -2
- package/dist/useBreakpoints/constants.d.ts +20 -0
- package/dist/useBreakpoints/constants.d.ts.map +1 -0
- package/dist/useBreakpoints/constants.js +18 -0
- package/dist/useBreakpoints/constants.js.map +7 -0
- package/dist/useBreakpoints/index.d.ts +2 -1
- package/dist/useBreakpoints/index.d.ts.map +1 -1
- package/dist/useBreakpoints/index.js +6 -1
- package/dist/useBreakpoints/index.js.map +2 -2
- package/dist/useBreakpoints/useBreakpoints.d.ts +1 -3
- package/dist/useBreakpoints/useBreakpoints.d.ts.map +1 -1
- package/dist/useBreakpoints/useBreakpoints.js +2 -6
- package/dist/useBreakpoints/useBreakpoints.js.map +2 -2
- package/package.json +2 -3
- package/dist/useBindCx/cva.test.js +0 -92
- package/dist/useBindCx/cva.test.js.map +0 -7
- package/dist/useBindCx/useBindCx.test.js +0 -173
- package/dist/useBindCx/useBindCx.test.js.map +0 -7
- package/dist/useBreakpoints/useBreakpoints.test.js +0 -49
- package/dist/useBreakpoints/useBreakpoints.test.js.map +0 -7
- package/dist/useClipboard/useClipboard.test.js +0 -70
- package/dist/useClipboard/useClipboard.test.js.map +0 -7
- package/dist/useColorMode/useColorMode.test.js +0 -171
- package/dist/useColorMode/useColorMode.test.js.map +0 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cva.d.ts","sourceRoot":"","sources":["../../src/useBindCx/cva.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,QAAA,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"cva.d.ts","sourceRoot":"","sources":["../../src/useBindCx/cva.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,QAAA,MAAM,EAAE,sEAON,CAAA;AAEF;;;;GAIG;AACH,QAAA,MAAQ,GAAG,qBAAE,EAAE,oBAAE,OAAO,uBAItB,CAAA;AAEF,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAA"}
|
package/dist/useBindCx/cva.js
CHANGED
|
@@ -3,7 +3,8 @@ import { extendTailwindMerge } from "tailwind-merge";
|
|
|
3
3
|
const tw = extendTailwindMerge({
|
|
4
4
|
extend: {
|
|
5
5
|
classGroups: {
|
|
6
|
-
"font-size": ["text-3xs", "text-xxs"]
|
|
6
|
+
"font-size": ["text-3xs", "text-xxs"],
|
|
7
|
+
"font-weight": ["font-sidebar", "font-sidebar-active"]
|
|
7
8
|
}
|
|
8
9
|
}
|
|
9
10
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/useBindCx/cva.ts"],
|
|
4
|
-
"sourcesContent": ["import { defineConfig } from 'cva'\nimport { extendTailwindMerge } from 'tailwind-merge'\n\n/**\n * Tailwind Merge Config\n *\n * By default tailwind merge only knows about the default tailwind classes\n * this is because it does not load in the tailwind config at runtime (perf reasons)\n * we must specify any custom classes if they are getting overwritten\n *\n * https://github.com/dcastil/tailwind-merge/blob/v2.0.0/docs/configuration.md#class-groups\n */\nconst tw = extendTailwindMerge({\n extend: {\n classGroups: {\n 'font-size': ['text-3xs', 'text-xxs'],\n },\n },\n})\n\n/**\n * CVA Config\n *\n * https://beta.cva.style/api-reference/#defineconfig\n */\nconst { cva, cx, compose } = defineConfig({\n hooks: {\n onComplete: (className) => tw(className),\n },\n})\n\nexport { cva, cx, compose, tw }\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,oBAAoB;AAC7B,SAAS,2BAA2B;AAWpC,MAAM,KAAK,oBAAoB;AAAA,EAC7B,QAAQ;AAAA,IACN,aAAa;AAAA,MACX,aAAa,CAAC,YAAY,UAAU;AAAA,
|
|
4
|
+
"sourcesContent": ["import { defineConfig } from 'cva'\nimport { extendTailwindMerge } from 'tailwind-merge'\n\n/**\n * Tailwind Merge Config\n *\n * By default tailwind merge only knows about the default tailwind classes\n * this is because it does not load in the tailwind config at runtime (perf reasons)\n * we must specify any custom classes if they are getting overwritten\n *\n * https://github.com/dcastil/tailwind-merge/blob/v2.0.0/docs/configuration.md#class-groups\n */\nconst tw = extendTailwindMerge({\n extend: {\n classGroups: {\n 'font-size': ['text-3xs', 'text-xxs'],\n 'font-weight': ['font-sidebar', 'font-sidebar-active'],\n },\n },\n})\n\n/**\n * CVA Config\n *\n * https://beta.cva.style/api-reference/#defineconfig\n */\nconst { cva, cx, compose } = defineConfig({\n hooks: {\n onComplete: (className) => tw(className),\n },\n})\n\nexport { cva, cx, compose, tw }\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,oBAAoB;AAC7B,SAAS,2BAA2B;AAWpC,MAAM,KAAK,oBAAoB;AAAA,EAC7B,QAAQ;AAAA,IACN,aAAa;AAAA,MACX,aAAa,CAAC,YAAY,UAAU;AAAA,MACpC,eAAe,CAAC,gBAAgB,qBAAqB;AAAA,IACvD;AAAA,EACF;AACF,CAAC;AAOD,MAAM,EAAE,KAAK,IAAI,QAAQ,IAAI,aAAa;AAAA,EACxC,OAAO;AAAA,IACL,YAAY,CAAC,cAAc,GAAG,SAAS;AAAA,EACzC;AACF,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Breakpoints for useBreakpoints hook
|
|
3
|
+
*
|
|
4
|
+
* Should match the tailwind breakpoints in \@scalar/themes
|
|
5
|
+
*/
|
|
6
|
+
export declare const screens: {
|
|
7
|
+
/** Mobile */
|
|
8
|
+
xs: string;
|
|
9
|
+
/** Large Mobile */
|
|
10
|
+
sm: string;
|
|
11
|
+
/** Tablet */
|
|
12
|
+
md: string;
|
|
13
|
+
/** Desktop */
|
|
14
|
+
lg: string;
|
|
15
|
+
/** Ultrawide and larger */
|
|
16
|
+
xl: string;
|
|
17
|
+
/** Custom breakpoint for zoomed in screens (should trigger at about 200% zoom) */
|
|
18
|
+
zoomed: string;
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/useBreakpoints/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,OAAO;IAClB,aAAa;;IAEb,mBAAmB;;IAEnB,aAAa;;IAEb,cAAc;;IAEd,2BAA2B;;IAE3B,kFAAkF;;CAEnF,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const screens = {
|
|
2
|
+
/** Mobile */
|
|
3
|
+
xs: "(min-width: 400px)",
|
|
4
|
+
/** Large Mobile */
|
|
5
|
+
sm: "(min-width: 600px)",
|
|
6
|
+
/** Tablet */
|
|
7
|
+
md: "(min-width: 800px)",
|
|
8
|
+
/** Desktop */
|
|
9
|
+
lg: "(min-width: 1000px)",
|
|
10
|
+
/** Ultrawide and larger */
|
|
11
|
+
xl: "(min-width: 1200px)",
|
|
12
|
+
/** Custom breakpoint for zoomed in screens (should trigger at about 200% zoom) */
|
|
13
|
+
zoomed: "(max-width: 720px) and (max-height: 480px)"
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
screens
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/useBreakpoints/constants.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Breakpoints for useBreakpoints hook\n *\n * Should match the tailwind breakpoints in \\@scalar/themes\n */\nexport const screens = {\n /** Mobile */\n xs: '(min-width: 400px)',\n /** Large Mobile */\n sm: '(min-width: 600px)',\n /** Tablet */\n md: '(min-width: 800px)',\n /** Desktop */\n lg: '(min-width: 1000px)',\n /** Ultrawide and larger */\n xl: '(min-width: 1200px)',\n /** Custom breakpoint for zoomed in screens (should trigger at about 200% zoom) */\n zoomed: '(max-width: 720px) and (max-height: 480px)',\n}\n"],
|
|
5
|
+
"mappings": "AAKO,MAAM,UAAU;AAAA;AAAA,EAErB,IAAI;AAAA;AAAA,EAEJ,IAAI;AAAA;AAAA,EAEJ,IAAI;AAAA;AAAA,EAEJ,IAAI;AAAA;AAAA,EAEJ,IAAI;AAAA;AAAA,EAEJ,QAAQ;AACV;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/useBreakpoints/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/useBreakpoints/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/useBreakpoints/index.ts"],
|
|
4
|
-
"sourcesContent": ["export
|
|
5
|
-
"mappings": "AAAA,
|
|
4
|
+
"sourcesContent": ["export { useBreakpoints } from './useBreakpoints'\nexport { screens } from './constants'\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,sBAAsB;AAC/B,SAAS,eAAe;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -12,9 +12,7 @@ export declare function useBreakpoints(): {
|
|
|
12
12
|
md: string;
|
|
13
13
|
lg: string;
|
|
14
14
|
xl: string;
|
|
15
|
-
zoomed:
|
|
16
|
-
raw: string;
|
|
17
|
-
};
|
|
15
|
+
zoomed: string;
|
|
18
16
|
};
|
|
19
17
|
/** Reactive media queries for each of the screen sizes */
|
|
20
18
|
mediaQueries: Record<"xs" | "sm" | "md" | "lg" | "xl" | "zoomed", Ref<boolean, boolean>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBreakpoints.d.ts","sourceRoot":"","sources":["../../src/useBreakpoints/useBreakpoints.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,GAAG,EAAmB,MAAM,KAAK,CAAA;AAI/C;;;;GAIG;AACH,wBAAgB,cAAc;
|
|
1
|
+
{"version":3,"file":"useBreakpoints.d.ts","sourceRoot":"","sources":["../../src/useBreakpoints/useBreakpoints.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,GAAG,EAAmB,MAAM,KAAK,CAAA;AAI/C;;;;GAIG;AACH,wBAAgB,cAAc;IAc1B,6CAA6C;;;;;;;;;IAE7C,0DAA0D;;IAE1D,gDAAgD;;EAGnD"}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { screens } from "./constants.js";
|
|
2
2
|
import { useMediaQuery } from "@vueuse/core";
|
|
3
3
|
import { computed, unref } from "vue";
|
|
4
4
|
function useBreakpoints() {
|
|
5
|
-
const screens = preset.theme.screens;
|
|
6
5
|
const mediaQueries = Object.fromEntries(
|
|
7
|
-
Object.entries(screens).map(([breakpoint, value]) => [
|
|
8
|
-
breakpoint,
|
|
9
|
-
useMediaQuery(typeof value === "string" ? `(min-width: ${value})` : value.raw)
|
|
10
|
-
])
|
|
6
|
+
Object.entries(screens).map(([breakpoint, value]) => [breakpoint, useMediaQuery(value)])
|
|
11
7
|
);
|
|
12
8
|
const breakpoints = computed(
|
|
13
9
|
() => Object.fromEntries(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/useBreakpoints/useBreakpoints.ts"],
|
|
4
|
-
"sourcesContent": ["import
|
|
5
|
-
"mappings": "AAAA,
|
|
4
|
+
"sourcesContent": ["import { screens } from './constants'\nimport { useMediaQuery } from '@vueuse/core'\nimport { type Ref, computed, unref } from 'vue'\n\ntype Screen = keyof typeof screens\n\n/**\n * Exposes Tailwind CSS breakpoints as reactive media queries\n *\n * **Warning:** This hook is not a replacement for Tailwind CSS breakpoints. Using breakpoints in Javascript can cause issues with Server Side Rendering (SSR) and the Tailwind CSS breakpoints should be used when possible.\n */\nexport function useBreakpoints() {\n const mediaQueries = Object.fromEntries(\n Object.entries(screens).map(([breakpoint, value]) => [breakpoint, useMediaQuery(value)]),\n ) as Record<Screen, Ref<boolean>>\n\n // We make the breakpoints a computed object so that we can use them in templates as `breakpoints.x` instead of `breakpoints.x.value`\n const breakpoints = computed(\n () =>\n Object.fromEntries(\n Object.entries(mediaQueries).map(([breakpoint, queryRef]) => [breakpoint, unref(queryRef)]),\n ) as Record<Screen, boolean>,\n )\n\n return {\n /** The screen sizes defined in the preset */\n screens,\n /** Reactive media queries for each of the screen sizes */\n mediaQueries,\n /** The breakpoints as reactive media queries */\n breakpoints,\n }\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,eAAe;AACxB,SAAS,qBAAqB;AAC9B,SAAmB,UAAU,aAAa;AASnC,SAAS,iBAAiB;AAC/B,QAAM,eAAe,OAAO;AAAA,IAC1B,OAAO,QAAQ,OAAO,EAAE,IAAI,CAAC,CAAC,YAAY,KAAK,MAAM,CAAC,YAAY,cAAc,KAAK,CAAC,CAAC;AAAA,EACzF;AAGA,QAAM,cAAc;AAAA,IAClB,MACE,OAAO;AAAA,MACL,OAAO,QAAQ,YAAY,EAAE,IAAI,CAAC,CAAC,YAAY,QAAQ,MAAM,CAAC,YAAY,MAAM,QAAQ,CAAC,CAAC;AAAA,IAC5F;AAAA,EACJ;AAEA,SAAO;AAAA;AAAA,IAEL;AAAA;AAAA,IAEA;AAAA;AAAA,IAEA;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"url": "git+https://github.com/scalar/scalar.git",
|
|
11
11
|
"directory": "packages/use-hooks"
|
|
12
12
|
},
|
|
13
|
-
"version": "0.2.
|
|
13
|
+
"version": "0.2.3",
|
|
14
14
|
"engines": {
|
|
15
15
|
"node": ">=20"
|
|
16
16
|
},
|
|
@@ -54,7 +54,6 @@
|
|
|
54
54
|
"tailwind-merge": "^2.5.5",
|
|
55
55
|
"vue": "^3.5.12",
|
|
56
56
|
"zod": "3.24.1",
|
|
57
|
-
"@scalar/themes": "0.12.1",
|
|
58
57
|
"@scalar/use-toasts": "0.8.0"
|
|
59
58
|
},
|
|
60
59
|
"devDependencies": {
|
|
@@ -62,7 +61,7 @@
|
|
|
62
61
|
"@vue/test-utils": "^2.4.1",
|
|
63
62
|
"vite": "5.4.19",
|
|
64
63
|
"zod-to-ts": "^1.2.0",
|
|
65
|
-
"@scalar/build-tooling": "0.2.
|
|
64
|
+
"@scalar/build-tooling": "0.2.3"
|
|
66
65
|
},
|
|
67
66
|
"scripts": {
|
|
68
67
|
"build": "scalar-build-esbuild",
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { cva, cx } from "./cva.js";
|
|
3
|
-
describe("cx utility", () => {
|
|
4
|
-
it("should merge classnames correctly", () => {
|
|
5
|
-
expect(cx("foo", "bar")).toBe("foo bar");
|
|
6
|
-
expect(cx("foo", void 0, "bar")).toBe("foo bar");
|
|
7
|
-
expect(cx("foo", null, "bar")).toBe("foo bar");
|
|
8
|
-
expect(cx("foo", false, "bar")).toBe("foo bar");
|
|
9
|
-
expect(cx("foo", "bar")).toBe("foo bar");
|
|
10
|
-
expect(cx("foo", false)).toBe("foo");
|
|
11
|
-
});
|
|
12
|
-
it("should de-dupe classses", () => {
|
|
13
|
-
expect(cx("mt-1", "mt-2")).toBe("mt-2");
|
|
14
|
-
expect(cx("bg-b-1 bg-b-1 bg-b-2 bg-b-1")).toBe("bg-b-1");
|
|
15
|
-
expect(cx("text-xxs text-3xs")).toBe("text-3xs");
|
|
16
|
-
});
|
|
17
|
-
it("should handle conditional classes", () => {
|
|
18
|
-
const isActive = true;
|
|
19
|
-
const isDisabled = false;
|
|
20
|
-
expect(cx("base", isActive && "active", isDisabled && "disabled")).toBe("base active");
|
|
21
|
-
});
|
|
22
|
-
it("should handle tailwind conflicts", () => {
|
|
23
|
-
expect(cx("p-4 px-6", "px-2")).toBe("p-4 px-2");
|
|
24
|
-
expect(cx("text-blue text-xl", "text-red")).toBe("text-xl text-red");
|
|
25
|
-
});
|
|
26
|
-
it("should handle arrays of classes", () => {
|
|
27
|
-
expect(cx(["foo", "bar"], "baz")).toBe("foo bar baz");
|
|
28
|
-
expect(cx(["foo", null, void 0], ["bar", false])).toBe("foo bar");
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
describe("cva utility", () => {
|
|
32
|
-
it("should create variant classes correctly", () => {
|
|
33
|
-
const button = cva({
|
|
34
|
-
base: "px-4 py-2 rounded",
|
|
35
|
-
variants: {
|
|
36
|
-
intent: {
|
|
37
|
-
primary: "bg-blue text-white",
|
|
38
|
-
secondary: "bg-gray text-black"
|
|
39
|
-
},
|
|
40
|
-
size: {
|
|
41
|
-
sm: "text-sm",
|
|
42
|
-
lg: "text-lg"
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
defaultVariants: {
|
|
46
|
-
intent: "primary",
|
|
47
|
-
size: "sm"
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
expect(button()).toBe("px-4 py-2 rounded bg-blue text-white text-sm");
|
|
51
|
-
expect(button({ intent: "secondary" })).toBe("px-4 py-2 rounded bg-gray text-black text-sm");
|
|
52
|
-
expect(button({ size: "lg" })).toBe("px-4 py-2 rounded bg-blue text-white text-lg");
|
|
53
|
-
});
|
|
54
|
-
it("should handle compound variants", () => {
|
|
55
|
-
const button = cva({
|
|
56
|
-
base: "base-style",
|
|
57
|
-
variants: {
|
|
58
|
-
intent: {
|
|
59
|
-
primary: "primary-style",
|
|
60
|
-
secondary: "secondary-style"
|
|
61
|
-
},
|
|
62
|
-
size: {
|
|
63
|
-
small: "small-style",
|
|
64
|
-
large: "large-style"
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
compoundVariants: [
|
|
68
|
-
{
|
|
69
|
-
intent: "primary",
|
|
70
|
-
size: "small",
|
|
71
|
-
class: "primary-small-style"
|
|
72
|
-
}
|
|
73
|
-
]
|
|
74
|
-
});
|
|
75
|
-
expect(button({ intent: "primary", size: "small" })).toBe(
|
|
76
|
-
"base-style primary-style small-style primary-small-style"
|
|
77
|
-
);
|
|
78
|
-
});
|
|
79
|
-
it("should handle undefined variant values", () => {
|
|
80
|
-
const button = cva({
|
|
81
|
-
base: "base-style",
|
|
82
|
-
variants: {
|
|
83
|
-
intent: {
|
|
84
|
-
primary: "primary-style",
|
|
85
|
-
secondary: "secondary-style"
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
expect(button({ intent: void 0 })).toBe("base-style");
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
//# sourceMappingURL=cva.test.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/useBindCx/cva.test.ts"],
|
|
4
|
-
"sourcesContent": ["import { describe, expect, it } from 'vitest'\n\nimport { cva, cx } from './cva'\n\ndescribe('cx utility', () => {\n it('should merge classnames correctly', () => {\n expect(cx('foo', 'bar')).toBe('foo bar')\n expect(cx('foo', undefined, 'bar')).toBe('foo bar')\n expect(cx('foo', null, 'bar')).toBe('foo bar')\n expect(cx('foo', false, 'bar')).toBe('foo bar')\n expect(cx('foo', true && 'bar')).toBe('foo bar')\n expect(cx('foo', false && 'bar')).toBe('foo')\n })\n\n it('should de-dupe classses', () => {\n expect(cx('mt-1', 'mt-2')).toBe('mt-2')\n expect(cx('bg-b-1 bg-b-1 bg-b-2 bg-b-1')).toBe('bg-b-1')\n expect(cx('text-xxs text-3xs')).toBe('text-3xs')\n })\n\n it('should handle conditional classes', () => {\n const isActive = true\n const isDisabled = false\n expect(cx('base', isActive && 'active', isDisabled && 'disabled')).toBe('base active')\n })\n\n it('should handle tailwind conflicts', () => {\n expect(cx('p-4 px-6', 'px-2')).toBe('p-4 px-2')\n expect(cx('text-blue text-xl', 'text-red')).toBe('text-xl text-red')\n })\n\n it('should handle arrays of classes', () => {\n expect(cx(['foo', 'bar'], 'baz')).toBe('foo bar baz')\n expect(cx(['foo', null, undefined], ['bar', false])).toBe('foo bar')\n })\n})\n\ndescribe('cva utility', () => {\n it('should create variant classes correctly', () => {\n const button = cva({\n base: 'px-4 py-2 rounded',\n variants: {\n intent: {\n primary: 'bg-blue text-white',\n secondary: 'bg-gray text-black',\n },\n size: {\n sm: 'text-sm',\n lg: 'text-lg',\n },\n },\n defaultVariants: {\n intent: 'primary',\n size: 'sm',\n },\n })\n\n expect(button()).toBe('px-4 py-2 rounded bg-blue text-white text-sm')\n expect(button({ intent: 'secondary' })).toBe('px-4 py-2 rounded bg-gray text-black text-sm')\n expect(button({ size: 'lg' })).toBe('px-4 py-2 rounded bg-blue text-white text-lg')\n })\n\n it('should handle compound variants', () => {\n const button = cva({\n base: 'base-style',\n variants: {\n intent: {\n primary: 'primary-style',\n secondary: 'secondary-style',\n },\n size: {\n small: 'small-style',\n large: 'large-style',\n },\n },\n compoundVariants: [\n {\n intent: 'primary',\n size: 'small',\n class: 'primary-small-style',\n },\n ],\n })\n\n expect(button({ intent: 'primary', size: 'small' })).toBe(\n 'base-style primary-style small-style primary-small-style',\n )\n })\n\n it('should handle undefined variant values', () => {\n const button = cva({\n base: 'base-style',\n variants: {\n intent: {\n primary: 'primary-style',\n secondary: 'secondary-style',\n },\n },\n })\n\n expect(button({ intent: undefined })).toBe('base-style')\n })\n})\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,UAAU,QAAQ,UAAU;AAErC,SAAS,KAAK,UAAU;AAExB,SAAS,cAAc,MA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from "@vue/test-utils";
|
|
2
|
-
import { describe, expect, it } from "vitest";
|
|
3
|
-
import { defineComponent } from "vue";
|
|
4
|
-
import { cva } from "./cva.js";
|
|
5
|
-
import { useBindCx } from "./useBindCx.js";
|
|
6
|
-
describe("useBindCx", () => {
|
|
7
|
-
const variants = cva({
|
|
8
|
-
base: "bg-base",
|
|
9
|
-
variants: {
|
|
10
|
-
active: { true: "bg-active" }
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
const TestComponent = defineComponent({
|
|
14
|
-
props: {
|
|
15
|
-
active: Boolean
|
|
16
|
-
},
|
|
17
|
-
inheritAttrs: false,
|
|
18
|
-
setup() {
|
|
19
|
-
const { cx } = useBindCx();
|
|
20
|
-
return { cx, variants };
|
|
21
|
-
},
|
|
22
|
-
template: '<div v-bind="cx(variants({ active }))">Test</div>'
|
|
23
|
-
});
|
|
24
|
-
it("should merge base classes correctly", () => {
|
|
25
|
-
const wrapper = mount(TestComponent);
|
|
26
|
-
expect(wrapper.attributes("class")).toBe("bg-base");
|
|
27
|
-
});
|
|
28
|
-
it("should apply variant tailwind classes", () => {
|
|
29
|
-
const wrapper = mount(TestComponent, {
|
|
30
|
-
props: { active: true }
|
|
31
|
-
});
|
|
32
|
-
expect(wrapper.attributes("class")).toBe("bg-active");
|
|
33
|
-
});
|
|
34
|
-
it("should merge external classes with internal classes", () => {
|
|
35
|
-
const wrapper = mount(TestComponent, {
|
|
36
|
-
attrs: { class: "external-class" }
|
|
37
|
-
});
|
|
38
|
-
expect(wrapper.attributes("class")).toBe("bg-base external-class");
|
|
39
|
-
});
|
|
40
|
-
it("should be reactive to prop changes", async () => {
|
|
41
|
-
const wrapper = mount(TestComponent, {
|
|
42
|
-
props: { active: false },
|
|
43
|
-
attrs: { class: "external-class" }
|
|
44
|
-
});
|
|
45
|
-
expect(wrapper.attributes("class")).toBe("bg-base external-class");
|
|
46
|
-
await wrapper.setProps({ active: true });
|
|
47
|
-
expect(wrapper.attributes("class")).toBe("bg-active external-class");
|
|
48
|
-
});
|
|
49
|
-
it("should be reactive to attribute changes", async () => {
|
|
50
|
-
const WrapperComponent = defineComponent({
|
|
51
|
-
props: { c: { type: String, default: "" } },
|
|
52
|
-
components: { TestComponent },
|
|
53
|
-
template: '<TestComponent :class="c" />'
|
|
54
|
-
});
|
|
55
|
-
const wrapper = mount(WrapperComponent, {
|
|
56
|
-
props: { c: "external-class" }
|
|
57
|
-
});
|
|
58
|
-
expect(wrapper.attributes("class")).toBe("bg-base external-class");
|
|
59
|
-
await wrapper.setProps({ c: "updated-class" });
|
|
60
|
-
expect(wrapper.attributes("class")).toBe("bg-base updated-class");
|
|
61
|
-
});
|
|
62
|
-
it("should handle multiple class combinations", () => {
|
|
63
|
-
const wrapper = mount(TestComponent, {
|
|
64
|
-
props: { active: true },
|
|
65
|
-
attrs: { class: "external-class another-class" }
|
|
66
|
-
});
|
|
67
|
-
expect(wrapper.attributes("class")).toBe("bg-active external-class another-class");
|
|
68
|
-
});
|
|
69
|
-
it("should apply external tailwind classes", () => {
|
|
70
|
-
const wrapper = mount(TestComponent, {
|
|
71
|
-
attrs: { class: "bg-external" }
|
|
72
|
-
});
|
|
73
|
-
expect(wrapper.attributes("class")).toBe("bg-external");
|
|
74
|
-
});
|
|
75
|
-
it("should apply classes in arrays", () => {
|
|
76
|
-
const wrapper = mount(TestComponent, {
|
|
77
|
-
attrs: { class: ["external-class", "another-class"] }
|
|
78
|
-
});
|
|
79
|
-
expect(wrapper.attributes("class")).toBe("bg-base external-class another-class");
|
|
80
|
-
});
|
|
81
|
-
it("should apply classes in objects", () => {
|
|
82
|
-
const wrapper = mount(TestComponent, {
|
|
83
|
-
attrs: { class: { "truthy-class": true, "falsy-class": false } }
|
|
84
|
-
});
|
|
85
|
-
expect(wrapper.attributes("class")).toBe("bg-base truthy-class");
|
|
86
|
-
});
|
|
87
|
-
it("should pass through other attributes", () => {
|
|
88
|
-
const wrapper = mount(TestComponent, {
|
|
89
|
-
attrs: { "data-testid": "test", "aria-label": "test label" }
|
|
90
|
-
});
|
|
91
|
-
expect(wrapper.attributes("class")).toBe("bg-base");
|
|
92
|
-
expect(wrapper.attributes("data-testid")).toBe("test");
|
|
93
|
-
expect(wrapper.attributes("aria-label")).toBe("test label");
|
|
94
|
-
});
|
|
95
|
-
it("should merge classes with classCx without other attributes", () => {
|
|
96
|
-
const ClassCxComponent = defineComponent({
|
|
97
|
-
props: { active: Boolean },
|
|
98
|
-
inheritAttrs: false,
|
|
99
|
-
setup() {
|
|
100
|
-
const { classCx } = useBindCx();
|
|
101
|
-
return { classCx };
|
|
102
|
-
},
|
|
103
|
-
template: `<div v-bind="classCx('internal-class')">Test</div>`
|
|
104
|
-
});
|
|
105
|
-
const wrapper = mount(ClassCxComponent, {
|
|
106
|
-
props: { active: true },
|
|
107
|
-
attrs: { "data-testid": "test", class: "external-class" }
|
|
108
|
-
});
|
|
109
|
-
expect(wrapper.attributes("class")).toBe("internal-class external-class");
|
|
110
|
-
expect(wrapper.attributes("data-testid")).toBeUndefined();
|
|
111
|
-
});
|
|
112
|
-
it("should provide other attributes via otherAttrs", () => {
|
|
113
|
-
const OtherAttrsComponent = defineComponent({
|
|
114
|
-
inheritAttrs: false,
|
|
115
|
-
setup() {
|
|
116
|
-
const { otherAttrs } = useBindCx();
|
|
117
|
-
return { otherAttrs };
|
|
118
|
-
},
|
|
119
|
-
template: '<div v-bind="otherAttrs">Test</div>'
|
|
120
|
-
});
|
|
121
|
-
const wrapper = mount(OtherAttrsComponent, {
|
|
122
|
-
attrs: {
|
|
123
|
-
class: "should-not-appear",
|
|
124
|
-
"data-testid": "test",
|
|
125
|
-
"aria-label": "test label"
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
expect(wrapper.attributes("class")).toBeUndefined();
|
|
129
|
-
expect(wrapper.attributes("data-testid")).toBe("test");
|
|
130
|
-
expect(wrapper.attributes("aria-label")).toBe("test label");
|
|
131
|
-
});
|
|
132
|
-
it("should handle reactive attribute changes with classCx and otherAttrs", async () => {
|
|
133
|
-
const WrapperComponent = defineComponent({
|
|
134
|
-
props: {
|
|
135
|
-
className: { type: String, default: "" },
|
|
136
|
-
testId: { type: String, default: "" }
|
|
137
|
-
},
|
|
138
|
-
components: {
|
|
139
|
-
InnerComponent: defineComponent({
|
|
140
|
-
inheritAttrs: false,
|
|
141
|
-
setup() {
|
|
142
|
-
const { classCx, otherAttrs } = useBindCx();
|
|
143
|
-
return { classCx, otherAttrs, variants };
|
|
144
|
-
},
|
|
145
|
-
template: `
|
|
146
|
-
<div>
|
|
147
|
-
<div data-test="class" v-bind="classCx(variants({}))">Class</div>
|
|
148
|
-
<div data-test="attrs" v-bind="otherAttrs">Attrs</div>
|
|
149
|
-
</div>
|
|
150
|
-
`
|
|
151
|
-
})
|
|
152
|
-
},
|
|
153
|
-
template: '<InnerComponent :class="className" :data-testid="testId" />'
|
|
154
|
-
});
|
|
155
|
-
const wrapper = mount(WrapperComponent, {
|
|
156
|
-
props: {
|
|
157
|
-
className: "initial-class",
|
|
158
|
-
testId: "initial-id"
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
const classDiv = wrapper.find('[data-test="class"]');
|
|
162
|
-
const attrsDiv = wrapper.find('[data-test="attrs"]');
|
|
163
|
-
expect(classDiv.attributes("class")).toBe("bg-base initial-class");
|
|
164
|
-
expect(attrsDiv.attributes("data-testid")).toBe("initial-id");
|
|
165
|
-
await wrapper.setProps({
|
|
166
|
-
className: "updated-class",
|
|
167
|
-
testId: "updated-id"
|
|
168
|
-
});
|
|
169
|
-
expect(classDiv.attributes("class")).toBe("bg-base updated-class");
|
|
170
|
-
expect(attrsDiv.attributes("data-testid")).toBe("updated-id");
|
|
171
|
-
});
|
|
172
|
-
});
|
|
173
|
-
//# sourceMappingURL=useBindCx.test.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/useBindCx/useBindCx.test.ts"],
|
|
4
|
-
"sourcesContent": ["import { mount } from '@vue/test-utils'\nimport { describe, expect, it } from 'vitest'\nimport { defineComponent } from 'vue'\n\nimport { cva } from './cva'\nimport { useBindCx } from './useBindCx'\n\ndescribe('useBindCx', () => {\n const variants = cva({\n base: 'bg-base',\n variants: {\n active: { true: 'bg-active' },\n },\n })\n\n const TestComponent = defineComponent({\n props: {\n active: Boolean,\n },\n inheritAttrs: false,\n setup() {\n const { cx } = useBindCx()\n return { cx, variants }\n },\n template: '<div v-bind=\"cx(variants({ active }))\">Test</div>',\n })\n\n it('should merge base classes correctly', () => {\n const wrapper = mount(TestComponent)\n expect(wrapper.attributes('class')).toBe('bg-base')\n })\n\n it('should apply variant tailwind classes', () => {\n const wrapper = mount(TestComponent, {\n props: { active: true },\n })\n expect(wrapper.attributes('class')).toBe('bg-active')\n })\n\n it('should merge external classes with internal classes', () => {\n const wrapper = mount(TestComponent, {\n attrs: { class: 'external-class' },\n })\n expect(wrapper.attributes('class')).toBe('bg-base external-class')\n })\n\n it('should be reactive to prop changes', async () => {\n const wrapper = mount(TestComponent, {\n props: { active: false },\n attrs: { class: 'external-class' },\n })\n expect(wrapper.attributes('class')).toBe('bg-base external-class')\n\n await wrapper.setProps({ active: true })\n expect(wrapper.attributes('class')).toBe('bg-active external-class')\n })\n\n it('should be reactive to attribute changes', async () => {\n const WrapperComponent = defineComponent({\n props: { c: { type: String, default: '' } },\n components: { TestComponent },\n template: '<TestComponent :class=\"c\" />',\n })\n\n const wrapper = mount(WrapperComponent, {\n props: { c: 'external-class' },\n })\n expect(wrapper.attributes('class')).toBe('bg-base external-class')\n\n await wrapper.setProps({ c: 'updated-class' })\n expect(wrapper.attributes('class')).toBe('bg-base updated-class')\n })\n\n it('should handle multiple class combinations', () => {\n const wrapper = mount(TestComponent, {\n props: { active: true },\n attrs: { class: 'external-class another-class' },\n })\n expect(wrapper.attributes('class')).toBe('bg-active external-class another-class')\n })\n\n it('should apply external tailwind classes', () => {\n const wrapper = mount(TestComponent, {\n attrs: { class: 'bg-external' },\n })\n expect(wrapper.attributes('class')).toBe('bg-external')\n })\n\n it('should apply classes in arrays', () => {\n const wrapper = mount(TestComponent, {\n attrs: { class: ['external-class', 'another-class'] },\n })\n expect(wrapper.attributes('class')).toBe('bg-base external-class another-class')\n })\n\n it('should apply classes in objects', () => {\n const wrapper = mount(TestComponent, {\n attrs: { class: { 'truthy-class': true, 'falsy-class': false } },\n })\n expect(wrapper.attributes('class')).toBe('bg-base truthy-class')\n })\n\n it('should pass through other attributes', () => {\n const wrapper = mount(TestComponent, {\n attrs: { 'data-testid': 'test', 'aria-label': 'test label' },\n })\n expect(wrapper.attributes('class')).toBe('bg-base')\n expect(wrapper.attributes('data-testid')).toBe('test')\n expect(wrapper.attributes('aria-label')).toBe('test label')\n })\n\n it('should merge classes with classCx without other attributes', () => {\n const ClassCxComponent = defineComponent({\n props: { active: Boolean },\n inheritAttrs: false,\n setup() {\n const { classCx } = useBindCx()\n return { classCx }\n },\n template: '<div v-bind=\"classCx(\\'internal-class\\')\">Test</div>',\n })\n\n const wrapper = mount(ClassCxComponent, {\n props: { active: true },\n attrs: { 'data-testid': 'test', class: 'external-class' },\n })\n\n expect(wrapper.attributes('class')).toBe('internal-class external-class')\n expect(wrapper.attributes('data-testid')).toBeUndefined()\n })\n\n it('should provide other attributes via otherAttrs', () => {\n const OtherAttrsComponent = defineComponent({\n inheritAttrs: false,\n setup() {\n const { otherAttrs } = useBindCx()\n return { otherAttrs }\n },\n template: '<div v-bind=\"otherAttrs\">Test</div>',\n })\n\n const wrapper = mount(OtherAttrsComponent, {\n attrs: {\n class: 'should-not-appear',\n 'data-testid': 'test',\n 'aria-label': 'test label',\n },\n })\n\n expect(wrapper.attributes('class')).toBeUndefined()\n expect(wrapper.attributes('data-testid')).toBe('test')\n expect(wrapper.attributes('aria-label')).toBe('test label')\n })\n\n it('should handle reactive attribute changes with classCx and otherAttrs', async () => {\n const WrapperComponent = defineComponent({\n props: {\n className: { type: String, default: '' },\n testId: { type: String, default: '' },\n },\n components: {\n InnerComponent: defineComponent({\n inheritAttrs: false,\n setup() {\n const { classCx, otherAttrs } = useBindCx()\n return { classCx, otherAttrs, variants }\n },\n template: `\n <div>\n <div data-test=\"class\" v-bind=\"classCx(variants({}))\">Class</div>\n <div data-test=\"attrs\" v-bind=\"otherAttrs\">Attrs</div>\n </div>\n `,\n }),\n },\n template: '<InnerComponent :class=\"className\" :data-testid=\"testId\" />',\n })\n\n const wrapper = mount(WrapperComponent, {\n props: {\n className: 'initial-class',\n testId: 'initial-id',\n },\n })\n\n const classDiv = wrapper.find('[data-test=\"class\"]')\n const attrsDiv = wrapper.find('[data-test=\"attrs\"]')\n\n expect(classDiv.attributes('class')).toBe('bg-base initial-class')\n expect(attrsDiv.attributes('data-testid')).toBe('initial-id')\n\n await wrapper.setProps({\n className: 'updated-class',\n testId: 'updated-id',\n })\n\n expect(classDiv.attributes('class')).toBe('bg-base updated-class')\n expect(attrsDiv.attributes('data-testid')).toBe('updated-id')\n })\n})\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,aAAa;AACtB,SAAS,UAAU,QAAQ,UAAU;AACrC,SAAS,uBAAuB;AAEhC,SAAS,WAAW;AACpB,SAAS,iBAAiB;AAE1B,SAAS,aAAa,MAAM;AAC1B,QAAM,WAAW,IAAI;AAAA,IACnB,MAAM;AAAA,IACN,UAAU;AAAA,MACR,QAAQ,EAAE,MAAM,YAAY;AAAA,IAC9B;AAAA,EACF,CAAC;AAED,QAAM,gBAAgB,gBAAgB;AAAA,IACpC,OAAO;AAAA,MACL,QAAQ;AAAA,IACV;AAAA,IACA,cAAc;AAAA,IACd,QAAQ;AACN,YAAM,EAAE,GAAG,IAAI,UAAU;AACzB,aAAO,EAAE,IAAI,SAAS;AAAA,IACxB;AAAA,IACA,UAAU;AAAA,EACZ,CAAC;AAED,KAAG,uCAAuC,MAAM;AAC9C,UAAM,UAAU,MAAM,aAAa;AACnC,WAAO,QAAQ,WAAW,OAAO,CAAC,EAAE,KAAK,SAAS;AAAA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AAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAMZ,CAAC;AAAA,MACH;AAAA,MACA,UAAU;AAAA,IACZ,CAAC;AAED,UAAM,UAAU,MAAM,kBAAkB;AAAA,MACtC,OAAO;AAAA,QACL,WAAW;AAAA,QACX,QAAQ;AAAA,MACV;AAAA,IACF,CAAC;AAED,UAAM,WAAW,QAAQ,KAAK,qBAAqB;AACnD,UAAM,WAAW,QAAQ,KAAK,qBAAqB;AAEnD,WAAO,SAAS,WAAW,OAAO,CAAC,EAAE,KAAK,uBAAuB;AACjE,WAAO,SAAS,WAAW,aAAa,CAAC,EAAE,KAAK,YAAY;AAE5D,UAAM,QAAQ,SAAS;AAAA,MACrB,WAAW;AAAA,MACX,QAAQ;AAAA,IACV,CAAC;AAED,WAAO,SAAS,WAAW,OAAO,CAAC,EAAE,KAAK,uBAAuB;AACjE,WAAO,SAAS,WAAW,aAAa,CAAC,EAAE,KAAK,YAAY;AAAA,EAC9D,CAAC;AACH,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import preset from "@scalar/themes/tailwind";
|
|
2
|
-
import { useMediaQuery } from "@vueuse/core";
|
|
3
|
-
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
4
|
-
import { ref } from "vue";
|
|
5
|
-
import { useBreakpoints } from "./useBreakpoints.js";
|
|
6
|
-
const screens = preset.theme.screens;
|
|
7
|
-
vi.mock("@vueuse/core", () => ({
|
|
8
|
-
useMediaQuery: vi.fn()
|
|
9
|
-
}));
|
|
10
|
-
describe("useBreakpoints", () => {
|
|
11
|
-
beforeEach(() => {
|
|
12
|
-
vi.resetAllMocks();
|
|
13
|
-
});
|
|
14
|
-
it("should expose the screen sizes", () => {
|
|
15
|
-
const { screens: exposedScreens } = useBreakpoints();
|
|
16
|
-
expect(exposedScreens).toEqual(screens);
|
|
17
|
-
});
|
|
18
|
-
it("should expose media queries for a given screen size", () => {
|
|
19
|
-
vi.mocked(useMediaQuery).mockImplementation((query) => ref(query === `(min-width: ${screens.md})`));
|
|
20
|
-
const { mediaQueries } = useBreakpoints();
|
|
21
|
-
expect(mediaQueries.sm.value).toEqual(false);
|
|
22
|
-
expect(mediaQueries.md.value).toEqual(true);
|
|
23
|
-
});
|
|
24
|
-
it("should update breakpoints when the media query changes", () => {
|
|
25
|
-
const mdQuery = ref(false);
|
|
26
|
-
vi.mocked(useMediaQuery).mockImplementation(
|
|
27
|
-
(query) => query === `(min-width: ${screens.md})` ? mdQuery : ref(false)
|
|
28
|
-
);
|
|
29
|
-
const { breakpoints } = useBreakpoints();
|
|
30
|
-
expect(breakpoints.value.md).toEqual(false);
|
|
31
|
-
mdQuery.value = true;
|
|
32
|
-
expect(breakpoints.value.md).toEqual(true);
|
|
33
|
-
});
|
|
34
|
-
it("works in SSG environment without window", () => {
|
|
35
|
-
const originalWindow = global.window;
|
|
36
|
-
delete global.window;
|
|
37
|
-
vi.mocked(useMediaQuery).mockImplementation(() => ref(false));
|
|
38
|
-
const { screens: exposedScreens, mediaQueries, breakpoints } = useBreakpoints();
|
|
39
|
-
expect(exposedScreens).toEqual(screens);
|
|
40
|
-
Object.values(mediaQueries).forEach((query) => {
|
|
41
|
-
expect(query.value).toBe(false);
|
|
42
|
-
});
|
|
43
|
-
Object.values(breakpoints.value).forEach((value) => {
|
|
44
|
-
expect(value).toBe(false);
|
|
45
|
-
});
|
|
46
|
-
global.window = originalWindow;
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
//# sourceMappingURL=useBreakpoints.test.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/useBreakpoints/useBreakpoints.test.ts"],
|
|
4
|
-
"sourcesContent": ["import preset from '@scalar/themes/tailwind'\nimport { useMediaQuery } from '@vueuse/core'\nimport { beforeEach, describe, expect, it, vi } from 'vitest'\nimport { ref } from 'vue'\n\nimport { useBreakpoints } from './useBreakpoints'\n\nconst screens = preset.theme.screens\n\nvi.mock('@vueuse/core', () => ({\n useMediaQuery: vi.fn(),\n}))\n\ndescribe('useBreakpoints', () => {\n beforeEach(() => {\n vi.resetAllMocks()\n })\n\n it('should expose the screen sizes', () => {\n const { screens: exposedScreens } = useBreakpoints()\n expect(exposedScreens).toEqual(screens)\n })\n\n it('should expose media queries for a given screen size', () => {\n vi.mocked(useMediaQuery).mockImplementation((query) => ref(query === `(min-width: ${screens.md})`))\n\n const { mediaQueries } = useBreakpoints()\n expect(mediaQueries.sm.value).toEqual(false)\n expect(mediaQueries.md.value).toEqual(true)\n })\n\n it('should update breakpoints when the media query changes', () => {\n const mdQuery = ref(false)\n vi.mocked(useMediaQuery).mockImplementation((query) =>\n query === `(min-width: ${screens.md})` ? mdQuery : ref(false),\n )\n\n const { breakpoints } = useBreakpoints()\n\n expect(breakpoints.value.md).toEqual(false)\n\n mdQuery.value = true\n\n expect(breakpoints.value.md).toEqual(true)\n })\n\n it('works in SSG environment without window', () => {\n const originalWindow = global.window\n\n // Mock SSG environment by removing window\n // @ts-expect-error\n delete global.window\n\n // Mock useMediaQuery to return false since there\u2019s no window\n vi.mocked(useMediaQuery).mockImplementation(() => ref(false))\n\n const { screens: exposedScreens, mediaQueries, breakpoints } = useBreakpoints()\n\n // Screens should still be exposed since they\u2019re static\n expect(exposedScreens).toEqual(screens)\n\n // Media queries should all be false without window\n Object.values(mediaQueries).forEach((query) => {\n expect(query.value).toBe(false)\n })\n\n // Breakpoints should all be false without window\n Object.values(breakpoints.value).forEach((value) => {\n expect(value).toBe(false)\n })\n\n // Restore window\n global.window = originalWindow\n })\n})\n"],
|
|
5
|
-
"mappings": "AAAA,OAAO,YAAY;AACnB,SAAS,qBAAqB;AAC9B,SAAS,YAAY,UAAU,QAAQ,IAAI,UAAU;AACrD,SAAS,WAAW;AAEpB,SAAS,sBAAsB;AAE/B,MAAM,UAAU,OAAO,MAAM;AAE7B,GAAG,KAAK,gBAAgB,OAAO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AO,YAAY,KAAK,EAAE,QAAQ,CAAC,UAAU;AAClD,aAAO,KAAK,EAAE,KAAK,KAAK;AAAA,IAC1B,CAAC;AAGD,WAAO,SAAS;AAAA,EAClB,CAAC;AACH,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { useToasts } from "@scalar/use-toasts";
|
|
2
|
-
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
3
|
-
import { useClipboard } from "./useClipboard.js";
|
|
4
|
-
vi.mock("@scalar/use-toasts", () => ({
|
|
5
|
-
useToasts: vi.fn().mockReturnValue({
|
|
6
|
-
toast: vi.fn(),
|
|
7
|
-
initializeToasts: vi.fn()
|
|
8
|
-
})
|
|
9
|
-
}));
|
|
10
|
-
describe("useClipboard", () => {
|
|
11
|
-
beforeEach(() => {
|
|
12
|
-
Object.defineProperty(navigator, "clipboard", {
|
|
13
|
-
value: {
|
|
14
|
-
writeText: vi.fn().mockResolvedValue(void 0)
|
|
15
|
-
},
|
|
16
|
-
writable: true
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
afterEach(() => {
|
|
20
|
-
vi.clearAllMocks();
|
|
21
|
-
vi.unstubAllGlobals();
|
|
22
|
-
});
|
|
23
|
-
it("copies text to clipboard", async () => {
|
|
24
|
-
const { copyToClipboard } = useClipboard();
|
|
25
|
-
await copyToClipboard("test text");
|
|
26
|
-
expect(navigator.clipboard.writeText).toHaveBeenCalledWith("test text");
|
|
27
|
-
});
|
|
28
|
-
it("shows a toast notification when text is copied", async () => {
|
|
29
|
-
const mockToast = vi.fn();
|
|
30
|
-
vi.mocked(useToasts).mockReturnValue({
|
|
31
|
-
toast: mockToast,
|
|
32
|
-
initializeToasts: vi.fn()
|
|
33
|
-
});
|
|
34
|
-
const { copyToClipboard } = useClipboard();
|
|
35
|
-
await copyToClipboard("test text");
|
|
36
|
-
expect(mockToast).toHaveBeenCalledWith("Copied to the clipboard", "info");
|
|
37
|
-
});
|
|
38
|
-
it("calls custom notify function when provided", async () => {
|
|
39
|
-
const customNotify = vi.fn();
|
|
40
|
-
const { copyToClipboard } = useClipboard({ notify: customNotify });
|
|
41
|
-
await copyToClipboard("test text");
|
|
42
|
-
expect(navigator.clipboard.writeText).toHaveBeenCalledWith("test text");
|
|
43
|
-
expect(customNotify).toHaveBeenCalledWith("Copied to the clipboard");
|
|
44
|
-
});
|
|
45
|
-
it("handles clipboard errors gracefully", async () => {
|
|
46
|
-
const mockConsole = vi.fn();
|
|
47
|
-
vi.stubGlobal("console", { error: mockConsole });
|
|
48
|
-
Object.defineProperty(navigator, "clipboard", {
|
|
49
|
-
value: {
|
|
50
|
-
writeText: vi.fn().mockRejectedValue(new Error("Clipboard error"))
|
|
51
|
-
},
|
|
52
|
-
writable: true
|
|
53
|
-
});
|
|
54
|
-
const notify = vi.fn();
|
|
55
|
-
const { copyToClipboard } = useClipboard({ notify });
|
|
56
|
-
await copyToClipboard("test text");
|
|
57
|
-
expect(notify).toHaveBeenCalledWith("Failed to copy to clipboard");
|
|
58
|
-
expect(mockConsole).toHaveBeenCalledWith("Clipboard error");
|
|
59
|
-
});
|
|
60
|
-
it("works in SSG environment without navigator", async () => {
|
|
61
|
-
const originalNavigator = global.navigator;
|
|
62
|
-
delete global.navigator;
|
|
63
|
-
const notify = vi.fn();
|
|
64
|
-
const { copyToClipboard } = useClipboard({ notify });
|
|
65
|
-
await copyToClipboard("test text");
|
|
66
|
-
expect(notify).toHaveBeenCalledWith("Failed to copy to clipboard");
|
|
67
|
-
global.navigator = originalNavigator;
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
//# sourceMappingURL=useClipboard.test.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/useClipboard/useClipboard.test.ts"],
|
|
4
|
-
"sourcesContent": ["import { useToasts } from '@scalar/use-toasts'\nimport { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'\n\nimport { useClipboard } from './useClipboard'\n\nvi.mock('@scalar/use-toasts', () => ({\n useToasts: vi.fn().mockReturnValue({\n toast: vi.fn(),\n initializeToasts: vi.fn(),\n }),\n}))\n\ndescribe('useClipboard', () => {\n beforeEach(() => {\n // Mock clipboard API\n Object.defineProperty(navigator, 'clipboard', {\n value: {\n writeText: vi.fn().mockResolvedValue(undefined),\n },\n writable: true,\n })\n })\n\n afterEach(() => {\n vi.clearAllMocks()\n vi.unstubAllGlobals()\n })\n\n it('copies text to clipboard', async () => {\n const { copyToClipboard } = useClipboard()\n\n await copyToClipboard('test text')\n\n expect(navigator.clipboard.writeText).toHaveBeenCalledWith('test text')\n })\n\n it('shows a toast notification when text is copied', async () => {\n const mockToast = vi.fn()\n vi.mocked(useToasts).mockReturnValue({\n toast: mockToast,\n initializeToasts: vi.fn(),\n })\n\n const { copyToClipboard } = useClipboard()\n await copyToClipboard('test text')\n\n expect(mockToast).toHaveBeenCalledWith('Copied to the clipboard', 'info')\n })\n\n it('calls custom notify function when provided', async () => {\n const customNotify = vi.fn()\n const { copyToClipboard } = useClipboard({ notify: customNotify })\n\n await copyToClipboard('test text')\n\n expect(navigator.clipboard.writeText).toHaveBeenCalledWith('test text')\n expect(customNotify).toHaveBeenCalledWith('Copied to the clipboard')\n })\n\n it('handles clipboard errors gracefully', async () => {\n const mockConsole = vi.fn()\n vi.stubGlobal('console', { error: mockConsole })\n\n // Mock clipboard failure\n Object.defineProperty(navigator, 'clipboard', {\n value: {\n writeText: vi.fn().mockRejectedValue(new Error('Clipboard error')),\n },\n writable: true,\n })\n\n const notify = vi.fn()\n const { copyToClipboard } = useClipboard({ notify })\n\n await copyToClipboard('test text')\n\n expect(notify).toHaveBeenCalledWith('Failed to copy to clipboard')\n expect(mockConsole).toHaveBeenCalledWith('Clipboard error')\n })\n\n it('works in SSG environment without navigator', async () => {\n const originalNavigator = global.navigator\n\n // Mock SSG environment by removing navigator\n // @ts-expect-error\n delete global.navigator\n\n const notify = vi.fn()\n const { copyToClipboard } = useClipboard({ notify })\n\n await copyToClipboard('test text')\n\n // Should show error notification since clipboard is not available\n expect(notify).toHaveBeenCalledWith('Failed to copy to clipboard')\n\n // Restore navigator\n global.navigator = originalNavigator\n })\n})\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,iBAAiB;AAC1B,SAAS,WAAW,YAAY,UAAU,QAAQ,IAAI,UAAU;AAEhE,SAAS,oBAAoB;AAE7B,GAAG,KAAK,sBAAsB,OAAO;AAAA,EACnC,WAAW,GAAG,GAAG,EAAE,gBAAgB;AAAA,IACjC,OAAO,GAAG,GAAG;AAAA,IACb,kBAAkB,GAAG,GAAG;AAAA,EAC1B,CAAC;AACH,EAAE;AAEF,SAAS,gBAAgB,MAAM;AAC7B,aAAW,MAAM;AAEf,WAAO,eAAe,WAAW,aAAa;AAAA,MAC5C,OAAO;AAAA,QACL,WAAW,GAAG,GAAG,EAAE,kBAAkB,MAAS;AAAA,MAChD;AAAA,MACA,UAAU;AAAA,IACZ,CAAC;AAAA,EACH,CAAC;AAED,YAAU,MAAM;AACd,OAAG,cAAc;AACjB,OAAG,iBAAiB;AAAA,EACtB,CAAC;AAED,KAAG,4BAA4B,YAAY;AACzC,UAAM,EAAE,gBAAgB,IAAI,aAAa;AAEzC,UAAM,gBAAgB,WAAW;AAEjC,WAAO,UAAU,UAAU,SAAS,EAAE,qBAAqB,WAAW;AAAA,EACxE,CAAC;AAED,KAAG,kDAAkD,YAAY;AAC/D,UAAM,YAAY,GAAG,GAAG;AACxB,OAAG,OAAO,SAAS,EAAE,gBAAgB;AAAA,MACnC,OAAO;AAAA,MACP,kBAAkB,GAAG,GAAG;AAAA,IAC1B,CAAC;AAED,UAAM,EAAE,gBAAgB,IAAI,aAAa;AACzC,UAAM,gBAAgB,WAAW;AAEjC,WAAO,SAAS,EAAE,qBAAqB,2BAA2B,MAAM;AAAA,EAC1E,CAAC;AAED,KAAG,8CAA8C,YAAY;AAC3D,UAAM,eAAe,GAAG,GAAG;AAC3B,UAAM,EAAE,gBAAgB,IAAI,aAAa,EAAE,QAAQ,aAAa,CAAC;AAEjE,UAAM,gBAAgB,WAAW;AAEjC,WAAO,UAAU,UAAU,SAAS,EAAE,qBAAqB,WAAW;AACtE,WAAO,YAAY,EAAE,qBAAqB,yBAAyB;AAAA,EACrE,CAAC;AAED,KAAG,uCAAuC,YAAY;AACpD,UAAM,cAAc,GAAG,GAAG;AAC1B,OAAG,WAAW,WAAW,EAAE,OAAO,YAAY,CAAC;AAG/C,WAAO,eAAe,WAAW,aAAa;AAAA,MAC5C,OAAO;AAAA,QACL,WAAW,GAAG,GAAG,EAAE,kBAAkB,IAAI,MAAM,iBAAiB,CAAC;AAAA,MACnE;AAAA,MACA,UAAU;AAAA,IACZ,CAAC;AAED,UAAM,SAAS,GAAG,GAAG;AACrB,UAAM,EAAE,gBAAgB,IAAI,aAAa,EAAE,OAAO,CAAC;AAEnD,UAAM,gBAAgB,WAAW;AAEjC,WAAO,MAAM,EAAE,qBAAqB,6BAA6B;AACjE,WAAO,WAAW,EAAE,qBAAqB,iBAAiB;AAAA,EAC5D,CAAC;AAED,KAAG,8CAA8C,YAAY;AAC3D,UAAM,oBAAoB,OAAO;AAIjC,WAAO,OAAO;AAEd,UAAM,SAAS,GAAG,GAAG;AACrB,UAAM,EAAE,gBAAgB,IAAI,aAAa,EAAE,OAAO,CAAC;AAEnD,UAAM,gBAAgB,WAAW;AAGjC,WAAO,MAAM,EAAE,qBAAqB,6BAA6B;AAGjE,WAAO,YAAY;AAAA,EACrB,CAAC;AACH,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
2
|
-
import { nextTick } from "vue";
|
|
3
|
-
import { useColorMode } from "./useColorMode.js";
|
|
4
|
-
vi.mock("vue", async () => {
|
|
5
|
-
const actual = await vi.importActual("vue");
|
|
6
|
-
return { ...actual, onMounted: vi.fn((fn) => fn()), onUnmounted: vi.fn() };
|
|
7
|
-
});
|
|
8
|
-
const actualMatchMedia = window.matchMedia;
|
|
9
|
-
describe("useColorMode", () => {
|
|
10
|
-
beforeEach(() => {
|
|
11
|
-
document.body.classList.remove("dark-mode", "light-mode");
|
|
12
|
-
localStorage.clear();
|
|
13
|
-
});
|
|
14
|
-
afterEach(() => {
|
|
15
|
-
vi.restoreAllMocks();
|
|
16
|
-
window.matchMedia = actualMatchMedia;
|
|
17
|
-
});
|
|
18
|
-
it("defaults to system mode preference", () => {
|
|
19
|
-
const { colorMode } = useColorMode();
|
|
20
|
-
expect(colorMode.value).toBe("system");
|
|
21
|
-
});
|
|
22
|
-
it.each(["light", "dark"])("respects localStorage value: %s", (mode) => {
|
|
23
|
-
localStorage.setItem("colorMode", mode);
|
|
24
|
-
const { colorMode } = useColorMode();
|
|
25
|
-
expect(colorMode.value).toBe(mode);
|
|
26
|
-
});
|
|
27
|
-
it("handles unknown localStorage values", () => {
|
|
28
|
-
localStorage.setItem("colorMode", "foobar");
|
|
29
|
-
expect(() => useColorMode()).not.toThrow();
|
|
30
|
-
});
|
|
31
|
-
it.each(["light", "dark"])("toggles between light and dark mode when system is %s", (mode) => {
|
|
32
|
-
window.matchMedia = vi.fn().mockImplementation((query) => ({
|
|
33
|
-
matches: query === `(prefers-color-scheme: ${mode})`,
|
|
34
|
-
addEventListener: vi.fn(),
|
|
35
|
-
removeEventListener: vi.fn()
|
|
36
|
-
}));
|
|
37
|
-
const { colorMode, darkLightMode, toggleColorMode } = useColorMode();
|
|
38
|
-
expect(colorMode.value).toBe("system");
|
|
39
|
-
expect(darkLightMode.value).toBe(mode);
|
|
40
|
-
toggleColorMode();
|
|
41
|
-
const inverted = mode === "light" ? "dark" : "light";
|
|
42
|
-
expect(colorMode.value).toBe(inverted);
|
|
43
|
-
expect(darkLightMode.value).toBe(inverted);
|
|
44
|
-
expect(localStorage.getItem("colorMode")).toBe(inverted);
|
|
45
|
-
toggleColorMode();
|
|
46
|
-
expect(colorMode.value).toBe(mode);
|
|
47
|
-
expect(darkLightMode.value).toBe(mode);
|
|
48
|
-
expect(localStorage.getItem("colorMode")).toBe(mode);
|
|
49
|
-
});
|
|
50
|
-
it("sets specific color mode", () => {
|
|
51
|
-
const { colorMode, darkLightMode, setColorMode } = useColorMode();
|
|
52
|
-
setColorMode("light");
|
|
53
|
-
expect(colorMode.value).toBe("light");
|
|
54
|
-
expect(darkLightMode.value).toBe("light");
|
|
55
|
-
expect(localStorage.getItem("colorMode")).toBe("light");
|
|
56
|
-
setColorMode("dark");
|
|
57
|
-
expect(colorMode.value).toBe("dark");
|
|
58
|
-
expect(darkLightMode.value).toBe("dark");
|
|
59
|
-
expect(localStorage.getItem("colorMode")).toBe("dark");
|
|
60
|
-
});
|
|
61
|
-
it("allows setting colorMode via the computed ref", () => {
|
|
62
|
-
const { colorMode } = useColorMode();
|
|
63
|
-
colorMode.value = "dark";
|
|
64
|
-
expect(colorMode.value).toBe("dark");
|
|
65
|
-
colorMode.value = "light";
|
|
66
|
-
expect(colorMode.value).toBe("light");
|
|
67
|
-
});
|
|
68
|
-
it.each(["light", "dark"])("isDarkMode is computed correctly when colorMode is %s", (mode) => {
|
|
69
|
-
const { isDarkMode, setColorMode } = useColorMode();
|
|
70
|
-
setColorMode(mode);
|
|
71
|
-
expect(isDarkMode.value).toBe(mode === "dark");
|
|
72
|
-
});
|
|
73
|
-
it("allows setting isDarkMode via the computed ref", () => {
|
|
74
|
-
const { isDarkMode } = useColorMode();
|
|
75
|
-
isDarkMode.value = true;
|
|
76
|
-
expect(isDarkMode.value).toBe(true);
|
|
77
|
-
isDarkMode.value = false;
|
|
78
|
-
expect(isDarkMode.value).toBe(false);
|
|
79
|
-
});
|
|
80
|
-
it.each(["light", "dark"])("detects system %s mode preference", (mode) => {
|
|
81
|
-
window.matchMedia = vi.fn().mockImplementation((query) => ({
|
|
82
|
-
matches: query === `(prefers-color-scheme: ${mode})`,
|
|
83
|
-
addEventListener: vi.fn(),
|
|
84
|
-
removeEventListener: vi.fn()
|
|
85
|
-
}));
|
|
86
|
-
const { getSystemModePreference, darkLightMode } = useColorMode();
|
|
87
|
-
expect(getSystemModePreference()).toBe(mode);
|
|
88
|
-
expect(darkLightMode.value).toBe(mode);
|
|
89
|
-
});
|
|
90
|
-
it("applies correct classes to body", async () => {
|
|
91
|
-
const { setColorMode } = useColorMode();
|
|
92
|
-
setColorMode("dark");
|
|
93
|
-
await nextTick();
|
|
94
|
-
expect(document.body.classList.contains("dark-mode")).toBe(true);
|
|
95
|
-
expect(document.body.classList.contains("light-mode")).toBe(false);
|
|
96
|
-
setColorMode("light");
|
|
97
|
-
await nextTick();
|
|
98
|
-
expect(document.body.classList.contains("light-mode")).toBe(true);
|
|
99
|
-
expect(document.body.classList.contains("dark-mode")).toBe(false);
|
|
100
|
-
});
|
|
101
|
-
it("listens to system preference changes", async () => {
|
|
102
|
-
let mediaQueryCallback = () => {
|
|
103
|
-
};
|
|
104
|
-
const mockMediaQuery = (matches) => ({
|
|
105
|
-
matches,
|
|
106
|
-
addEventListener: vi.fn((_, callback) => mediaQueryCallback = callback),
|
|
107
|
-
removeEventListener: vi.fn()
|
|
108
|
-
});
|
|
109
|
-
const mocked = mockMediaQuery(false);
|
|
110
|
-
window.matchMedia = vi.fn().mockReturnValue(mocked);
|
|
111
|
-
const { setColorMode } = useColorMode();
|
|
112
|
-
setColorMode("system");
|
|
113
|
-
expect(mocked.addEventListener).toHaveBeenCalledWith("change", expect.any(Function));
|
|
114
|
-
await nextTick();
|
|
115
|
-
expect(document.body.classList.contains("light-mode")).toBe(true);
|
|
116
|
-
expect(document.body.classList.contains("dark-mode")).toBe(false);
|
|
117
|
-
if (mediaQueryCallback) {
|
|
118
|
-
window.matchMedia = vi.fn().mockReturnValue(mockMediaQuery(true));
|
|
119
|
-
mediaQueryCallback();
|
|
120
|
-
await nextTick();
|
|
121
|
-
expect(document.body.classList.contains("light-mode")).toBe(false);
|
|
122
|
-
expect(document.body.classList.contains("dark-mode")).toBe(true);
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
it.each(["light", "dark", "system"])("respects initialColorMode option: %s", (initialColorMode) => {
|
|
126
|
-
const { colorMode } = useColorMode({ initialColorMode });
|
|
127
|
-
expect(colorMode.value).toBe(initialColorMode);
|
|
128
|
-
});
|
|
129
|
-
it("initialColorMode is overridden by localStorage value", () => {
|
|
130
|
-
localStorage.setItem("colorMode", "dark");
|
|
131
|
-
const { colorMode } = useColorMode({ initialColorMode: "light" });
|
|
132
|
-
expect(colorMode.value).toBe("dark");
|
|
133
|
-
});
|
|
134
|
-
it("respects overrideColorMode option", async () => {
|
|
135
|
-
const { setColorMode } = useColorMode({ overrideColorMode: "dark" });
|
|
136
|
-
setColorMode("light");
|
|
137
|
-
await nextTick();
|
|
138
|
-
expect(document.body.classList.contains("dark-mode")).toBe(true);
|
|
139
|
-
expect(document.body.classList.contains("light-mode")).toBe(false);
|
|
140
|
-
window.matchMedia = vi.fn().mockImplementation((query) => ({
|
|
141
|
-
matches: query === "(prefers-color-scheme: light)",
|
|
142
|
-
addEventListener: vi.fn(),
|
|
143
|
-
removeEventListener: vi.fn()
|
|
144
|
-
}));
|
|
145
|
-
setColorMode("system");
|
|
146
|
-
await nextTick();
|
|
147
|
-
expect(document.body.classList.contains("dark-mode")).toBe(true);
|
|
148
|
-
expect(document.body.classList.contains("light-mode")).toBe(false);
|
|
149
|
-
});
|
|
150
|
-
it("works in SSG environment without window/document", () => {
|
|
151
|
-
const originalWindow = global.window;
|
|
152
|
-
const originalDocument = global.document;
|
|
153
|
-
delete global.window;
|
|
154
|
-
delete global.document;
|
|
155
|
-
const { colorMode, darkLightMode, setColorMode, toggleColorMode } = useColorMode();
|
|
156
|
-
expect(colorMode.value).toBe("system");
|
|
157
|
-
expect(darkLightMode.value).toBe("light");
|
|
158
|
-
expect(() => setColorMode("dark")).not.toThrow();
|
|
159
|
-
expect(() => toggleColorMode()).not.toThrow();
|
|
160
|
-
global.window = originalWindow;
|
|
161
|
-
global.document = originalDocument;
|
|
162
|
-
});
|
|
163
|
-
it("handles missing matchMedia gracefully", () => {
|
|
164
|
-
const originalMatchMedia = window.matchMedia;
|
|
165
|
-
delete window.matchMedia;
|
|
166
|
-
const { darkLightMode } = useColorMode();
|
|
167
|
-
expect(darkLightMode.value).toBe("dark");
|
|
168
|
-
window.matchMedia = originalMatchMedia;
|
|
169
|
-
});
|
|
170
|
-
});
|
|
171
|
-
//# sourceMappingURL=useColorMode.test.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/useColorMode/useColorMode.test.ts"],
|
|
4
|
-
"sourcesContent": ["import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'\nimport { nextTick } from 'vue'\n\nimport { useColorMode } from './useColorMode'\n\n// Mock only onMounted, keep real nextTick\nvi.mock('vue', async () => {\n const actual = await vi.importActual('vue')\n return { ...actual, onMounted: vi.fn((fn) => fn()), onUnmounted: vi.fn() }\n})\n\nconst actualMatchMedia = window.matchMedia\n\ndescribe('useColorMode', () => {\n beforeEach(() => {\n // Reset the DOM\n document.body.classList.remove('dark-mode', 'light-mode')\n\n // Clear localStorage\n localStorage.clear()\n })\n\n afterEach(() => {\n // Restore all mocks\n vi.restoreAllMocks()\n\n // Restore the original matchMedia\n window.matchMedia = actualMatchMedia\n })\n\n it('defaults to system mode preference', () => {\n const { colorMode } = useColorMode()\n expect(colorMode.value).toBe('system')\n })\n\n it.each(['light', 'dark'] as const)('respects localStorage value: %s', (mode) => {\n localStorage.setItem('colorMode', mode)\n const { colorMode } = useColorMode()\n expect(colorMode.value).toBe(mode)\n })\n\n it('handles unknown localStorage values', () => {\n localStorage.setItem('colorMode', 'foobar')\n expect(() => useColorMode()).not.toThrow()\n })\n\n it.each(['light', 'dark'] as const)('toggles between light and dark mode when system is %s', (mode) => {\n // Mock the matchMedia to simulate system dark mode\n window.matchMedia = vi.fn().mockImplementation((query) => ({\n matches: query === `(prefers-color-scheme: ${mode})`,\n addEventListener: vi.fn(),\n removeEventListener: vi.fn(),\n }))\n\n const { colorMode, darkLightMode, toggleColorMode } = useColorMode()\n expect(colorMode.value).toBe('system')\n expect(darkLightMode.value).toBe(mode)\n\n toggleColorMode()\n const inverted = mode === 'light' ? 'dark' : 'light'\n expect(colorMode.value).toBe(inverted)\n expect(darkLightMode.value).toBe(inverted)\n expect(localStorage.getItem('colorMode')).toBe(inverted)\n\n toggleColorMode()\n expect(colorMode.value).toBe(mode)\n expect(darkLightMode.value).toBe(mode)\n expect(localStorage.getItem('colorMode')).toBe(mode)\n })\n\n it('sets specific color mode', () => {\n const { colorMode, darkLightMode, setColorMode } = useColorMode()\n\n setColorMode('light')\n expect(colorMode.value).toBe('light')\n expect(darkLightMode.value).toBe('light')\n expect(localStorage.getItem('colorMode')).toBe('light')\n\n setColorMode('dark')\n expect(colorMode.value).toBe('dark')\n expect(darkLightMode.value).toBe('dark')\n expect(localStorage.getItem('colorMode')).toBe('dark')\n })\n\n it('allows setting colorMode via the computed ref', () => {\n const { colorMode } = useColorMode()\n\n colorMode.value = 'dark'\n expect(colorMode.value).toBe('dark')\n\n colorMode.value = 'light'\n expect(colorMode.value).toBe('light')\n })\n\n it.each(['light', 'dark'] as const)('isDarkMode is computed correctly when colorMode is %s', (mode) => {\n const { isDarkMode, setColorMode } = useColorMode()\n\n setColorMode(mode)\n expect(isDarkMode.value).toBe(mode === 'dark')\n })\n\n it('allows setting isDarkMode via the computed ref', () => {\n const { isDarkMode } = useColorMode()\n\n isDarkMode.value = true\n expect(isDarkMode.value).toBe(true)\n\n isDarkMode.value = false\n expect(isDarkMode.value).toBe(false)\n })\n\n it.each(['light', 'dark'] as const)('detects system %s mode preference', (mode) => {\n window.matchMedia = vi.fn().mockImplementation((query) => ({\n matches: query === `(prefers-color-scheme: ${mode})`,\n addEventListener: vi.fn(),\n removeEventListener: vi.fn(),\n }))\n\n const { getSystemModePreference, darkLightMode } = useColorMode()\n expect(getSystemModePreference()).toBe(mode)\n expect(darkLightMode.value).toBe(mode)\n })\n\n it('applies correct classes to body', async () => {\n const { setColorMode } = useColorMode()\n\n setColorMode('dark')\n await nextTick()\n expect(document.body.classList.contains('dark-mode')).toBe(true)\n expect(document.body.classList.contains('light-mode')).toBe(false)\n\n setColorMode('light')\n await nextTick()\n expect(document.body.classList.contains('light-mode')).toBe(true)\n expect(document.body.classList.contains('dark-mode')).toBe(false)\n })\n\n it('listens to system preference changes', async () => {\n let mediaQueryCallback: () => void = () => {}\n\n const mockMediaQuery = (matches: boolean) => ({\n matches,\n addEventListener: vi.fn((_, callback) => (mediaQueryCallback = callback)),\n removeEventListener: vi.fn(),\n })\n\n // Set the mock to return false for '(prefers-color-scheme: dark)'\n const mocked = mockMediaQuery(false)\n window.matchMedia = vi.fn().mockReturnValue(mocked)\n\n const { setColorMode } = useColorMode()\n setColorMode('system')\n\n expect(mocked.addEventListener).toHaveBeenCalledWith('change', expect.any(Function))\n\n await nextTick()\n\n expect(document.body.classList.contains('light-mode')).toBe(true)\n expect(document.body.classList.contains('dark-mode')).toBe(false)\n\n // Simulate system preference change\n if (mediaQueryCallback) {\n window.matchMedia = vi.fn().mockReturnValue(mockMediaQuery(true))\n mediaQueryCallback()\n await nextTick()\n expect(document.body.classList.contains('light-mode')).toBe(false)\n expect(document.body.classList.contains('dark-mode')).toBe(true)\n }\n })\n\n it.each(['light', 'dark', 'system'] as const)('respects initialColorMode option: %s', (initialColorMode) => {\n const { colorMode } = useColorMode({ initialColorMode })\n expect(colorMode.value).toBe(initialColorMode)\n })\n\n it('initialColorMode is overridden by localStorage value', () => {\n localStorage.setItem('colorMode', 'dark')\n const { colorMode } = useColorMode({ initialColorMode: 'light' })\n expect(colorMode.value).toBe('dark')\n })\n\n it('respects overrideColorMode option', async () => {\n const { setColorMode } = useColorMode({ overrideColorMode: 'dark' })\n\n // Even when setting to light mode, it should stay dark due to override\n setColorMode('light')\n await nextTick()\n expect(document.body.classList.contains('dark-mode')).toBe(true)\n expect(document.body.classList.contains('light-mode')).toBe(false)\n\n // Should stay dark even when system preference is light\n window.matchMedia = vi.fn().mockImplementation((query) => ({\n matches: query === '(prefers-color-scheme: light)',\n addEventListener: vi.fn(),\n removeEventListener: vi.fn(),\n }))\n\n setColorMode('system')\n await nextTick()\n expect(document.body.classList.contains('dark-mode')).toBe(true)\n expect(document.body.classList.contains('light-mode')).toBe(false)\n })\n\n it('works in SSG environment without window/document', () => {\n const originalWindow = global.window\n const originalDocument = global.document\n\n // Mock SSG environment by removing window/document\n // @ts-expect-error\n delete global.window\n // @ts-expect-error\n delete global.document\n\n const { colorMode, darkLightMode, setColorMode, toggleColorMode } = useColorMode()\n\n // Should default to light mode in SSG\n expect(colorMode.value).toBe('system')\n expect(darkLightMode.value).toBe('light')\n\n // Methods should not throw without window/document\n expect(() => setColorMode('dark')).not.toThrow()\n expect(() => toggleColorMode()).not.toThrow()\n\n // Restore window/document/localStorage\n global.window = originalWindow\n global.document = originalDocument\n })\n\n it('handles missing matchMedia gracefully', () => {\n const originalMatchMedia = window.matchMedia\n // @ts-expect-error - Intentionally removing matchMedia\n delete window.matchMedia\n\n const { darkLightMode } = useColorMode()\n expect(darkLightMode.value).toBe('dark') // Should default to dark when matchMedia is unavailable\n\n window.matchMedia = originalMatchMedia\n })\n})\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,WAAW,YAAY,UAAU,QAAQ,IAAI,UAAU;AAChE,SAAS,gBAAgB;AAEzB,SAAS,oBAAoB;AAG7B,GAAG,KAAK,OAAO,YAAY;AACzB,QAAM,SAAS,MAAM,GAAG,aAAa,KAAK;AAC1C,SAAO,EAAE,GAAG,QAAQ,WAAW,GAAG,GAAG,CAAC,OAAO,GAAG,CAAC,GAAG,aAAa,GAAG,GAAG,EAAE;AAC3E,CAAC;AAED,MAAM,mBAAmB,OAAO;AAEhC,SAAS,gBAAgB,MAAM;AAC7B,aAAW,MAAM;AAEf,aAAS,KAAK,UAAU,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