Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make conflictingClassGroupModifiers in config non-optional #291

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export interface Config {
* A class group ID is the key of a class group in classGroups object.
* @example { 'font-size': ['leading'] }
*/
conflictingClassGroupModifiers?: Record<ClassGroupId, readonly ClassGroupId[]>
conflictingClassGroupModifiers: Record<ClassGroupId, readonly ClassGroupId[]>
}

export type ThemeObject = Record<string, ClassGroup>
Expand Down
2 changes: 2 additions & 0 deletions tests/create-tailwind-merge.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ test('createTailwindMerge works with single config function', () => {
fooKey: ['otherKey'],
otherKey: ['fooKey', 'fooKey2'],
},
conflictingClassGroupModifiers: {},
}))

expect(tailwindMerge('')).toBe('')
Expand Down Expand Up @@ -54,6 +55,7 @@ test('createTailwindMerge works with multiple config functions', () => {
fooKey: ['otherKey'],
otherKey: ['fooKey', 'fooKey2'],
},
conflictingClassGroupModifiers: {},
}),
(config) => ({
...config,
Expand Down
9 changes: 9 additions & 0 deletions tests/merge-configs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ test('mergeConfigs has correct behavior', () => {
bla: [{ bli: ['blub', 'blublub'] }],
},
conflictingClassGroups: {},
conflictingClassGroupModifiers: {
hello: ['world'],
},
},
{
classGroups: {
Expand All @@ -25,6 +28,9 @@ test('mergeConfigs has correct behavior', () => {
fooKey: ['otherKey'],
otherKey: ['fooKey', 'fooKey2'],
},
conflictingClassGroupModifiers: {
hello: ['world2'],
},
},
),
).toEqual({
Expand All @@ -43,5 +49,8 @@ test('mergeConfigs has correct behavior', () => {
fooKey: ['otherKey'],
otherKey: ['fooKey', 'fooKey2'],
},
conflictingClassGroupModifiers: {
hello: ['world', 'world2'],
},
})
})
3 changes: 3 additions & 0 deletions tests/public-api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ test('createTailwindMerge() has correct inputs and outputs', () => {
theme: {},
classGroups: {},
conflictingClassGroups: {},
conflictingClassGroupModifiers: {},
})),
).toStrictEqual(expect.any(Function))

Expand All @@ -104,6 +105,7 @@ test('createTailwindMerge() has correct inputs and outputs', () => {
fooKey: ['otherKey'],
otherKey: ['fooKey', 'fooKey2'],
},
conflictingClassGroupModifiers: {},
}))

expect(tailwindMerge).toStrictEqual(expect.any(Function))
Expand Down Expand Up @@ -165,6 +167,7 @@ test('mergeConfigs has correct inputs and outputs', () => {
bla: [{ bli: ['blub', 'blublub'] }],
},
conflictingClassGroups: {},
conflictingClassGroupModifiers: {},
},
{},
),
Expand Down
Loading