@pyreon/coolgrid 0.11.5 → 0.11.7

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.
@@ -1,9 +1,9 @@
1
- import { describe, expect, it } from "vitest"
1
+ import { describe, expect, it } from 'vitest'
2
2
 
3
- describe("config", () => {
4
- describe("theme defaults", () => {
5
- it("has correct default theme", async () => {
6
- const theme = (await import("../theme")).default
3
+ describe('config', () => {
4
+ describe('theme defaults', () => {
5
+ it('has correct default theme', async () => {
6
+ const theme = (await import('../theme')).default
7
7
  expect(theme).toEqual({
8
8
  rootSize: 16,
9
9
  breakpoints: {
@@ -16,7 +16,7 @@ describe("config", () => {
16
16
  grid: {
17
17
  columns: 12,
18
18
  container: {
19
- xs: "100%",
19
+ xs: '100%',
20
20
  sm: 540,
21
21
  md: 720,
22
22
  lg: 960,
@@ -27,9 +27,9 @@ describe("config", () => {
27
27
  })
28
28
  })
29
29
 
30
- describe("defaultBreakpoints", () => {
31
- it("has all standard breakpoints", async () => {
32
- const { defaultBreakpoints } = await import("../theme")
30
+ describe('defaultBreakpoints', () => {
31
+ it('has all standard breakpoints', async () => {
32
+ const { defaultBreakpoints } = await import('../theme')
33
33
  expect(defaultBreakpoints).toEqual({
34
34
  xs: 0,
35
35
  sm: 576,
@@ -39,8 +39,8 @@ describe("config", () => {
39
39
  })
40
40
  })
41
41
 
42
- it("breakpoints are in ascending order", async () => {
43
- const { defaultBreakpoints } = await import("../theme")
42
+ it('breakpoints are in ascending order', async () => {
43
+ const { defaultBreakpoints } = await import('../theme')
44
44
  const values = Object.values(defaultBreakpoints)
45
45
  for (let i = 1; i < values.length; i++) {
46
46
  expect(values[i]).toBeGreaterThan(values[i - 1] as number)
@@ -48,11 +48,11 @@ describe("config", () => {
48
48
  })
49
49
  })
50
50
 
51
- describe("defaultContainerWidths", () => {
52
- it("has widths for all breakpoints", async () => {
53
- const { defaultContainerWidths } = await import("../theme")
51
+ describe('defaultContainerWidths', () => {
52
+ it('has widths for all breakpoints', async () => {
53
+ const { defaultContainerWidths } = await import('../theme')
54
54
  expect(defaultContainerWidths).toEqual({
55
- xs: "100%",
55
+ xs: '100%',
56
56
  sm: 540,
57
57
  md: 720,
58
58
  lg: 960,
@@ -60,17 +60,17 @@ describe("config", () => {
60
60
  })
61
61
  })
62
62
 
63
- it("xs is percentage, others are numbers", async () => {
64
- const { defaultContainerWidths } = await import("../theme")
65
- expect(typeof defaultContainerWidths.xs).toBe("string")
66
- expect(typeof defaultContainerWidths.sm).toBe("number")
67
- expect(typeof defaultContainerWidths.md).toBe("number")
68
- expect(typeof defaultContainerWidths.lg).toBe("number")
69
- expect(typeof defaultContainerWidths.xl).toBe("number")
63
+ it('xs is percentage, others are numbers', async () => {
64
+ const { defaultContainerWidths } = await import('../theme')
65
+ expect(typeof defaultContainerWidths.xs).toBe('string')
66
+ expect(typeof defaultContainerWidths.sm).toBe('number')
67
+ expect(typeof defaultContainerWidths.md).toBe('number')
68
+ expect(typeof defaultContainerWidths.lg).toBe('number')
69
+ expect(typeof defaultContainerWidths.xl).toBe('number')
70
70
  })
71
71
 
72
- it("numeric widths are in ascending order", async () => {
73
- const { defaultContainerWidths } = await import("../theme")
72
+ it('numeric widths are in ascending order', async () => {
73
+ const { defaultContainerWidths } = await import('../theme')
74
74
  const numericWidths = [
75
75
  defaultContainerWidths.sm,
76
76
  defaultContainerWidths.md,
@@ -83,38 +83,38 @@ describe("config", () => {
83
83
  })
84
84
  })
85
85
 
86
- describe("ContainerContext", () => {
87
- it("is created via createContext with an id", async () => {
88
- const { ContainerContext } = await import("../context")
89
- expect(ContainerContext).toHaveProperty("id")
86
+ describe('ContainerContext', () => {
87
+ it('is created via createContext with an id', async () => {
88
+ const { ContainerContext } = await import('../context')
89
+ expect(ContainerContext).toHaveProperty('id')
90
90
  })
91
91
  })
92
92
 
93
- describe("RowContext", () => {
94
- it("is created via createContext with an id", async () => {
95
- const { RowContext } = await import("../context")
96
- expect(RowContext).toHaveProperty("id")
93
+ describe('RowContext', () => {
94
+ it('is created via createContext with an id', async () => {
95
+ const { RowContext } = await import('../context')
96
+ expect(RowContext).toHaveProperty('id')
97
97
  })
98
98
  })
99
99
 
100
- describe("constants", () => {
101
- it("has correct PKG_NAME", async () => {
102
- const { PKG_NAME } = await import("../constants")
103
- expect(PKG_NAME).toBe("@pyreon/coolgrid")
100
+ describe('constants', () => {
101
+ it('has correct PKG_NAME', async () => {
102
+ const { PKG_NAME } = await import('../constants')
103
+ expect(PKG_NAME).toBe('@pyreon/coolgrid')
104
104
  })
105
105
 
106
- it("has CONTEXT_KEYS", async () => {
107
- const { CONTEXT_KEYS } = await import("../constants")
108
- expect(CONTEXT_KEYS).toContain("columns")
109
- expect(CONTEXT_KEYS).toContain("size")
110
- expect(CONTEXT_KEYS).toContain("gap")
111
- expect(CONTEXT_KEYS).toContain("padding")
112
- expect(CONTEXT_KEYS).toContain("gutter")
113
- expect(CONTEXT_KEYS).toContain("colCss")
114
- expect(CONTEXT_KEYS).toContain("colComponent")
115
- expect(CONTEXT_KEYS).toContain("rowCss")
116
- expect(CONTEXT_KEYS).toContain("rowComponent")
117
- expect(CONTEXT_KEYS).toContain("contentAlignX")
106
+ it('has CONTEXT_KEYS', async () => {
107
+ const { CONTEXT_KEYS } = await import('../constants')
108
+ expect(CONTEXT_KEYS).toContain('columns')
109
+ expect(CONTEXT_KEYS).toContain('size')
110
+ expect(CONTEXT_KEYS).toContain('gap')
111
+ expect(CONTEXT_KEYS).toContain('padding')
112
+ expect(CONTEXT_KEYS).toContain('gutter')
113
+ expect(CONTEXT_KEYS).toContain('colCss')
114
+ expect(CONTEXT_KEYS).toContain('colComponent')
115
+ expect(CONTEXT_KEYS).toContain('rowCss')
116
+ expect(CONTEXT_KEYS).toContain('rowComponent')
117
+ expect(CONTEXT_KEYS).toContain('contentAlignX')
118
118
  })
119
119
  })
120
120
  })
@@ -1,11 +1,11 @@
1
- import type { VNode } from "@pyreon/core"
2
- import { beforeEach, describe, expect, it, vi } from "vitest"
1
+ import type { VNode } from '@pyreon/core'
2
+ import { beforeEach, describe, expect, it, vi } from 'vitest'
3
3
 
4
4
  const mockProvide = vi.fn()
5
5
  const mockUseContext = vi.fn()
6
6
 
7
- vi.mock("@pyreon/core", async (importOriginal) => {
8
- const original = await importOriginal<typeof import("@pyreon/core")>()
7
+ vi.mock('@pyreon/core', async (importOriginal) => {
8
+ const original = await importOriginal<typeof import('@pyreon/core')>()
9
9
  return {
10
10
  ...original,
11
11
  provide: (...args: any[]) => {
@@ -19,17 +19,17 @@ vi.mock("@pyreon/core", async (importOriginal) => {
19
19
 
20
20
  const asVNode = (v: unknown) => v as VNode
21
21
 
22
- describe("Context cascading: Container -> Row -> Col", () => {
22
+ describe('Context cascading: Container -> Row -> Col', () => {
23
23
  beforeEach(() => {
24
24
  vi.clearAllMocks()
25
- // Default: unistyle theme context returns empty theme
26
- mockUseContext.mockReturnValue({ theme: {} })
25
+ // Default: unistyle theme context returns a ReactiveContext accessor
26
+ mockUseContext.mockReturnValue(() => ({ theme: {} }))
27
27
  })
28
28
 
29
- it("Container provides context with grid config", async () => {
30
- const Container = (await import("../Container")).default
29
+ it('Container provides context with grid config', async () => {
30
+ const Container = (await import('../Container')).default
31
31
  // Container calls useContext once (for unistyle theme)
32
- Container({ columns: 12, gap: 16, gutter: 8, padding: 4, children: "test" })
32
+ Container({ columns: 12, gap: 16, gutter: 8, padding: 4, children: 'test' })
33
33
 
34
34
  expect(mockProvide).toHaveBeenCalledTimes(1)
35
35
  const config = mockProvide.mock.calls[0]?.[1] as Record<string, unknown>
@@ -40,8 +40,8 @@ describe("Context cascading: Container -> Row -> Col", () => {
40
40
  expect(config.padding).toBe(4)
41
41
  })
42
42
 
43
- it("Row reads Container context and provides its own", async () => {
44
- const Row = (await import("../Row")).default
43
+ it('Row reads Container context and provides its own', async () => {
44
+ const Row = (await import('../Row')).default
45
45
 
46
46
  // Row calls useContext twice:
47
47
  // 1st: ContainerContext (grid config from parent)
@@ -53,9 +53,9 @@ describe("Context cascading: Container -> Row -> Col", () => {
53
53
  gutter: 8,
54
54
  padding: 4,
55
55
  })
56
- .mockReturnValueOnce({ theme: {} })
56
+ .mockReturnValueOnce(() => ({ theme: {} }))
57
57
 
58
- Row({ children: "test" })
58
+ Row({ children: 'test' })
59
59
 
60
60
  const rowConfig = mockProvide.mock.calls[0]?.[1] as Record<string, unknown>
61
61
 
@@ -65,13 +65,13 @@ describe("Context cascading: Container -> Row -> Col", () => {
65
65
  expect(rowConfig.padding).toBe(4)
66
66
  })
67
67
 
68
- it("Row can override Container values", async () => {
69
- const Row = (await import("../Row")).default
68
+ it('Row can override Container values', async () => {
69
+ const Row = (await import('../Row')).default
70
70
 
71
71
  // 1st call: ContainerContext, 2nd call: unistyle theme
72
- mockUseContext.mockReturnValueOnce({ columns: 12, gap: 8 }).mockReturnValueOnce({ theme: {} })
72
+ mockUseContext.mockReturnValueOnce({ columns: 12, gap: 8 }).mockReturnValueOnce(() => ({ theme: {} }))
73
73
 
74
- Row({ columns: 24, gap: 32, children: "test" })
74
+ Row({ columns: 24, gap: 32, children: 'test' })
75
75
 
76
76
  const rowConfig = mockProvide.mock.calls[0]?.[1] as Record<string, unknown>
77
77
 
@@ -79,35 +79,35 @@ describe("Context cascading: Container -> Row -> Col", () => {
79
79
  expect(rowConfig.gap).toBe(32)
80
80
  })
81
81
 
82
- it("Col reads Row context and passes $coolgrid", async () => {
83
- const Col = (await import("../Col")).default
82
+ it('Col reads Row context and passes $coolgrid', async () => {
83
+ const Col = (await import('../Col')).default
84
84
 
85
85
  // Col calls useContext twice:
86
86
  // 1st: RowContext, 2nd: unistyle theme inside useGridContext
87
- mockUseContext.mockReturnValueOnce({ columns: 12, gap: 20 }).mockReturnValueOnce({ theme: {} })
87
+ mockUseContext.mockReturnValueOnce({ columns: 12, gap: 20 }).mockReturnValueOnce(() => ({ theme: {} }))
88
88
 
89
- const result = asVNode(Col({ size: 4, children: "test" }))
89
+ const result = asVNode(Col({ size: 4, children: 'test' }))
90
90
  expect(result.props.$coolgrid).toBeDefined()
91
91
  expect((result.props.$coolgrid as Record<string, unknown>).size).toBe(4)
92
92
  })
93
93
 
94
- it("Col does not provide context", async () => {
95
- const Col = (await import("../Col")).default
94
+ it('Col does not provide context', async () => {
95
+ const Col = (await import('../Col')).default
96
96
 
97
- Col({ size: 6, children: "test" })
97
+ Col({ size: 6, children: 'test' })
98
98
  expect(mockProvide).not.toHaveBeenCalled()
99
99
  })
100
100
 
101
- it("Container calls provide", async () => {
102
- const Container = (await import("../Container")).default
103
- Container({ children: "test" })
101
+ it('Container calls provide', async () => {
102
+ const Container = (await import('../Container')).default
103
+ Container({ children: 'test' })
104
104
 
105
105
  expect(mockProvide).toHaveBeenCalledTimes(1)
106
106
  })
107
107
 
108
- it("Row calls provide", async () => {
109
- const Row = (await import("../Row")).default
110
- Row({ children: "test" })
108
+ it('Row calls provide', async () => {
109
+ const Row = (await import('../Row')).default
110
+ Row({ children: 'test' })
111
111
 
112
112
  expect(mockProvide).toHaveBeenCalledTimes(1)
113
113
  })
@@ -1,35 +1,35 @@
1
- import { describe, expect, it } from "vitest"
1
+ import { describe, expect, it } from 'vitest'
2
2
 
3
- describe("index exports", () => {
4
- it("exports Container", async () => {
5
- const mod = await import("../index")
3
+ describe('index exports', () => {
4
+ it('exports Container', async () => {
5
+ const mod = await import('../index')
6
6
  expect(mod.Container).toBeDefined()
7
- expect(typeof mod.Container).toBe("function")
7
+ expect(typeof mod.Container).toBe('function')
8
8
  })
9
9
 
10
- it("exports Row", async () => {
11
- const mod = await import("../index")
10
+ it('exports Row', async () => {
11
+ const mod = await import('../index')
12
12
  expect(mod.Row).toBeDefined()
13
- expect(typeof mod.Row).toBe("function")
13
+ expect(typeof mod.Row).toBe('function')
14
14
  })
15
15
 
16
- it("exports Col", async () => {
17
- const mod = await import("../index")
16
+ it('exports Col', async () => {
17
+ const mod = await import('../index')
18
18
  expect(mod.Col).toBeDefined()
19
- expect(typeof mod.Col).toBe("function")
19
+ expect(typeof mod.Col).toBe('function')
20
20
  })
21
21
 
22
- it("exports Provider", async () => {
23
- const mod = await import("../index")
22
+ it('exports Provider', async () => {
23
+ const mod = await import('../index')
24
24
  expect(mod.Provider).toBeDefined()
25
- expect(typeof mod.Provider).toBe("function")
25
+ expect(typeof mod.Provider).toBe('function')
26
26
  })
27
27
 
28
- it("exports theme", async () => {
29
- const mod = await import("../index")
28
+ it('exports theme', async () => {
29
+ const mod = await import('../index')
30
30
  expect(mod.theme).toBeDefined()
31
- expect(mod.theme).toHaveProperty("rootSize")
32
- expect(mod.theme).toHaveProperty("breakpoints")
33
- expect(mod.theme).toHaveProperty("grid")
31
+ expect(mod.theme).toHaveProperty('rootSize')
32
+ expect(mod.theme).toHaveProperty('breakpoints')
33
+ expect(mod.theme).toHaveProperty('grid')
34
34
  })
35
35
  })
@@ -1,92 +1,92 @@
1
- import { beforeEach, describe, expect, it, vi } from "vitest"
1
+ import { beforeEach, describe, expect, it, vi } from 'vitest'
2
2
 
3
3
  const mockUseContext = vi.fn()
4
4
 
5
- vi.mock("@pyreon/core", async (importOriginal) => {
6
- const original = await importOriginal<typeof import("@pyreon/core")>()
5
+ vi.mock('@pyreon/core', async (importOriginal) => {
6
+ const original = await importOriginal<typeof import('@pyreon/core')>()
7
7
  return {
8
8
  ...original,
9
9
  useContext: mockUseContext,
10
10
  }
11
11
  })
12
12
 
13
- describe("useGridContext", () => {
13
+ describe('useGridContext', () => {
14
14
  beforeEach(() => {
15
15
  vi.clearAllMocks()
16
- // Default: empty theme context
17
- mockUseContext.mockReturnValue({ theme: {} })
16
+ // Default: coreContext is ReactiveContext — mock returns () => value
17
+ mockUseContext.mockReturnValue(() => ({ theme: {} }))
18
18
  })
19
19
 
20
- it("returns props merged with theme grid context", async () => {
21
- mockUseContext.mockReturnValue({
20
+ it('returns props merged with theme grid context', async () => {
21
+ mockUseContext.mockReturnValue(() => ({
22
22
  theme: {
23
23
  grid: {
24
24
  columns: 12,
25
- container: { xs: "100%", md: 720 },
25
+ container: { xs: '100%', md: 720 },
26
26
  },
27
27
  },
28
- })
29
- const useGridContext = (await import("../useContext")).default
28
+ }))
29
+ const useGridContext = (await import('../useContext')).default
30
30
  const result = useGridContext({ gap: 16 })
31
31
  expect(result.gap).toBe(16)
32
32
  expect(result.columns).toBe(12)
33
33
  })
34
34
 
35
- it("props override theme values", async () => {
36
- mockUseContext.mockReturnValue({
35
+ it('props override theme values', async () => {
36
+ mockUseContext.mockReturnValue(() => ({
37
37
  theme: {
38
38
  grid: { columns: 12 },
39
39
  },
40
- })
41
- const useGridContext = (await import("../useContext")).default
40
+ }))
41
+ const useGridContext = (await import('../useContext')).default
42
42
  const result = useGridContext({ columns: 24 })
43
43
  expect(result.columns).toBe(24)
44
44
  })
45
45
 
46
- it("falls back to coolgrid namespace in theme", async () => {
47
- mockUseContext.mockReturnValue({
46
+ it('falls back to coolgrid namespace in theme', async () => {
47
+ mockUseContext.mockReturnValue(() => ({
48
48
  theme: {
49
49
  coolgrid: {
50
50
  columns: 16,
51
- container: { xs: "100%" },
51
+ container: { xs: '100%' },
52
52
  },
53
53
  },
54
- })
55
- const useGridContext = (await import("../useContext")).default
54
+ }))
55
+ const useGridContext = (await import('../useContext')).default
56
56
  const result = useGridContext({})
57
57
  expect(result.columns).toBe(16)
58
58
  })
59
59
 
60
- it("returns empty context when no theme or props", async () => {
61
- mockUseContext.mockReturnValue({ theme: {} })
62
- const useGridContext = (await import("../useContext")).default
60
+ it('returns empty context when no theme or props', async () => {
61
+ mockUseContext.mockReturnValue(() => ({ theme: {} }))
62
+ const useGridContext = (await import('../useContext')).default
63
63
  const result = useGridContext({})
64
64
  expect(result).toBeDefined()
65
65
  })
66
66
  })
67
67
 
68
- describe("getGridContext", () => {
69
- it("resolves columns from props first", async () => {
70
- const { getGridContext } = await import("../useContext")
68
+ describe('getGridContext', () => {
69
+ it('resolves columns from props first', async () => {
70
+ const { getGridContext } = await import('../useContext')
71
71
  const result = getGridContext({ columns: 24 }, { grid: { columns: 12 } })
72
72
  expect(result.columns).toBe(24)
73
73
  })
74
74
 
75
- it("resolves columns from theme.grid", async () => {
76
- const { getGridContext } = await import("../useContext")
75
+ it('resolves columns from theme.grid', async () => {
76
+ const { getGridContext } = await import('../useContext')
77
77
  const result = getGridContext({}, { grid: { columns: 12 } })
78
78
  expect(result.columns).toBe(12)
79
79
  })
80
80
 
81
- it("resolves columns from theme.coolgrid", async () => {
82
- const { getGridContext } = await import("../useContext")
81
+ it('resolves columns from theme.coolgrid', async () => {
82
+ const { getGridContext } = await import('../useContext')
83
83
  const result = getGridContext({}, { coolgrid: { columns: 16 } })
84
84
  expect(result.columns).toBe(16)
85
85
  })
86
86
 
87
- it("resolves containerWidth from theme.grid.container", async () => {
88
- const { getGridContext } = await import("../useContext")
89
- const result = getGridContext({}, { grid: { container: { xs: "100%" } } })
90
- expect(result.containerWidth).toEqual({ xs: "100%" })
87
+ it('resolves containerWidth from theme.grid.container', async () => {
88
+ const { getGridContext } = await import('../useContext')
89
+ const result = getGridContext({}, { grid: { container: { xs: '100%' } } })
90
+ expect(result.containerWidth).toEqual({ xs: '100%' })
91
91
  })
92
92
  })
@@ -1,143 +1,143 @@
1
- import { describe, expect, it } from "vitest"
2
- import { getContainerWidth } from "../Container/utils"
3
- import { hasValue, hasWidth, isNumber, isVisible, omitCtxKeys } from "../utils"
1
+ import { describe, expect, it } from 'vitest'
2
+ import { getContainerWidth } from '../Container/utils'
3
+ import { hasValue, hasWidth, isNumber, isVisible, omitCtxKeys } from '../utils'
4
4
 
5
- describe("isNumber", () => {
6
- it("returns true for finite numbers", () => {
5
+ describe('isNumber', () => {
6
+ it('returns true for finite numbers', () => {
7
7
  expect(isNumber(0)).toBe(true)
8
8
  expect(isNumber(1)).toBe(true)
9
9
  expect(isNumber(-1)).toBe(true)
10
10
  expect(isNumber(3.14)).toBe(true)
11
11
  })
12
12
 
13
- it("returns false for non-finite values", () => {
13
+ it('returns false for non-finite values', () => {
14
14
  expect(isNumber(Infinity)).toBe(false)
15
15
  expect(isNumber(-Infinity)).toBe(false)
16
16
  expect(isNumber(NaN)).toBe(false)
17
17
  })
18
18
 
19
- it("returns false for non-number types", () => {
19
+ it('returns false for non-number types', () => {
20
20
  expect(isNumber(null)).toBe(false)
21
21
  expect(isNumber(undefined)).toBe(false)
22
- expect(isNumber("5")).toBe(false)
22
+ expect(isNumber('5')).toBe(false)
23
23
  expect(isNumber(true)).toBe(false)
24
24
  })
25
25
  })
26
26
 
27
- describe("hasValue", () => {
28
- it("returns true for positive finite numbers", () => {
27
+ describe('hasValue', () => {
28
+ it('returns true for positive finite numbers', () => {
29
29
  expect(hasValue(1)).toBe(true)
30
30
  expect(hasValue(12)).toBe(true)
31
31
  expect(hasValue(0.5)).toBe(true)
32
32
  })
33
33
 
34
- it("returns false for zero", () => {
34
+ it('returns false for zero', () => {
35
35
  expect(hasValue(0)).toBe(false)
36
36
  })
37
37
 
38
- it("returns false for negative numbers", () => {
38
+ it('returns false for negative numbers', () => {
39
39
  expect(hasValue(-1)).toBe(false)
40
40
  })
41
41
 
42
- it("returns false for non-numbers", () => {
42
+ it('returns false for non-numbers', () => {
43
43
  expect(hasValue(null)).toBe(false)
44
44
  expect(hasValue(undefined)).toBe(false)
45
- expect(hasValue("5")).toBe(false)
45
+ expect(hasValue('5')).toBe(false)
46
46
  })
47
47
  })
48
48
 
49
- describe("isVisible", () => {
50
- it("returns true for positive numbers", () => {
49
+ describe('isVisible', () => {
50
+ it('returns true for positive numbers', () => {
51
51
  expect(isVisible(1)).toBe(true)
52
52
  expect(isVisible(12)).toBe(true)
53
53
  })
54
54
 
55
- it("returns true for negative numbers", () => {
55
+ it('returns true for negative numbers', () => {
56
56
  expect(isVisible(-1)).toBe(true)
57
57
  })
58
58
 
59
- it("returns false for zero", () => {
59
+ it('returns false for zero', () => {
60
60
  expect(isVisible(0)).toBe(false)
61
61
  })
62
62
 
63
- it("returns true for undefined (default visibility)", () => {
63
+ it('returns true for undefined (default visibility)', () => {
64
64
  expect(isVisible(undefined)).toBe(true)
65
65
  })
66
66
 
67
- it("returns false for non-number truthy values", () => {
68
- expect(isVisible("5")).toBe(false)
67
+ it('returns false for non-number truthy values', () => {
68
+ expect(isVisible('5')).toBe(false)
69
69
  expect(isVisible(null)).toBe(false)
70
70
  })
71
71
  })
72
72
 
73
- describe("hasWidth", () => {
74
- it("returns true when both size and columns are positive numbers", () => {
73
+ describe('hasWidth', () => {
74
+ it('returns true when both size and columns are positive numbers', () => {
75
75
  expect(hasWidth(6, 12)).toBe(true)
76
76
  expect(hasWidth(1, 1)).toBe(true)
77
77
  })
78
78
 
79
- it("returns false when size is 0", () => {
79
+ it('returns false when size is 0', () => {
80
80
  expect(hasWidth(0, 12)).toBe(false)
81
81
  })
82
82
 
83
- it("returns false when columns is 0", () => {
83
+ it('returns false when columns is 0', () => {
84
84
  expect(hasWidth(6, 0)).toBe(false)
85
85
  })
86
86
 
87
- it("returns false when either is not a number", () => {
87
+ it('returns false when either is not a number', () => {
88
88
  expect(hasWidth(null, 12)).toBe(false)
89
89
  expect(hasWidth(6, null)).toBe(false)
90
90
  expect(hasWidth(undefined, undefined)).toBe(false)
91
91
  })
92
92
  })
93
93
 
94
- describe("omitCtxKeys", () => {
95
- it("strips context keys from props", () => {
94
+ describe('omitCtxKeys', () => {
95
+ it('strips context keys from props', () => {
96
96
  const props = {
97
97
  columns: 12,
98
98
  size: 6,
99
99
  gap: 16,
100
100
  padding: 4,
101
101
  gutter: 8,
102
- colCss: "color: red;",
102
+ colCss: 'color: red;',
103
103
  colComponent: () => null,
104
- rowCss: "color: blue;",
104
+ rowCss: 'color: blue;',
105
105
  rowComponent: () => null,
106
- contentAlignX: "center",
107
- className: "my-class",
108
- id: "my-id",
106
+ contentAlignX: 'center',
107
+ className: 'my-class',
108
+ id: 'my-id',
109
109
  }
110
110
  const result = omitCtxKeys(props)
111
111
  expect(result).toEqual({
112
- className: "my-class",
113
- id: "my-id",
112
+ className: 'my-class',
113
+ id: 'my-id',
114
114
  })
115
115
  })
116
116
 
117
- it("returns all props when no context keys present", () => {
118
- const props = { className: "test", style: "color: red;" }
117
+ it('returns all props when no context keys present', () => {
118
+ const props = { className: 'test', style: 'color: red;' }
119
119
  const result = omitCtxKeys(props)
120
120
  expect(result).toEqual(props)
121
121
  })
122
122
  })
123
123
 
124
- describe("getContainerWidth", () => {
125
- it("returns width from props", () => {
124
+ describe('getContainerWidth', () => {
125
+ it('returns width from props', () => {
126
126
  const result = getContainerWidth({ width: { xs: 600 } }, {})
127
127
  expect(result).toEqual({ xs: 600 })
128
128
  })
129
129
 
130
- it("falls back to theme.grid.container", () => {
131
- const result = getContainerWidth({}, { grid: { container: { xs: "100%" } } })
132
- expect(result).toEqual({ xs: "100%" })
130
+ it('falls back to theme.grid.container', () => {
131
+ const result = getContainerWidth({}, { grid: { container: { xs: '100%' } } })
132
+ expect(result).toEqual({ xs: '100%' })
133
133
  })
134
134
 
135
- it("falls back to theme.coolgrid.container", () => {
135
+ it('falls back to theme.coolgrid.container', () => {
136
136
  const result = getContainerWidth({}, { coolgrid: { container: { md: 720 } } })
137
137
  expect(result).toEqual({ md: 720 })
138
138
  })
139
139
 
140
- it("returns undefined when nothing matches", () => {
140
+ it('returns undefined when nothing matches', () => {
141
141
  const result = getContainerWidth({}, {})
142
142
  expect(result).toBeFalsy()
143
143
  })