Skip to content

Commit

Permalink
Merge pull request #291 from dcastil/breaking-feature/216/make-confli…
Browse files Browse the repository at this point in the history
…ctingClassGroupModifiers-in-config-non-optional

Make `conflictingClassGroupModifiers` in config non-optional
  • Loading branch information
dcastil authored Aug 19, 2023
2 parents cf4cd80 + e868d9c commit b2d1c1b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
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

0 comments on commit b2d1c1b

Please sign in to comment.