-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add ring defaults Fixes #2911 * add tests for the ringWidth utility + defaults * update changelog
- Loading branch information
1 parent
d41ec71
commit d1ef88a
Showing
5 changed files
with
112 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
import invokePlugin from '../util/invokePlugin' | ||
import plugin from '../../src/plugins/ringWidth' | ||
|
||
test('ring widths', () => { | ||
const config = { | ||
theme: { | ||
ringWidth: { | ||
4: '4px', | ||
}, | ||
ringOffsetWidth: { | ||
4: '4px', | ||
}, | ||
ringColor: { | ||
black: '#000', | ||
}, | ||
ringOffsetColor: { | ||
white: '#fff', | ||
}, | ||
ringOpacity: { | ||
50: '.5', | ||
}, | ||
}, | ||
variants: { | ||
ringColor: [], | ||
}, | ||
} | ||
|
||
const { utilities } = invokePlugin(plugin(), config) | ||
expect(utilities).toEqual([ | ||
[ | ||
{ | ||
'*': { | ||
'--tw-ring-color': 'rgba(147, 197, 253, 0.5)', | ||
'--tw-ring-inset': 'var(--tw-empty,/*!*/ /*!*/)', | ||
'--tw-ring-offset-color': '#fff', | ||
'--tw-ring-offset-shadow': '0 0 #0000', | ||
'--tw-ring-offset-width': '0px', | ||
'--tw-ring-shadow': '0 0 #0000', | ||
}, | ||
}, | ||
{ | ||
respectImportant: false, | ||
}, | ||
], | ||
[ | ||
{ | ||
'.ring-4': { | ||
'--tw-ring-offset-shadow': | ||
'var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)', | ||
'--tw-ring-shadow': | ||
'var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color)', | ||
'box-shadow': | ||
'var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)', | ||
}, | ||
'.ring-inset': { | ||
'--tw-ring-inset': 'inset', | ||
}, | ||
}, | ||
undefined, | ||
], | ||
]) | ||
}) | ||
|
||
test('ring widths with defaults', () => { | ||
const config = { | ||
theme: { | ||
ringWidth: {}, | ||
ringOffsetWidth: { | ||
DEFAULT: '2px', | ||
}, | ||
ringOffsetColor: { | ||
DEFAULT: 'pink', | ||
}, | ||
}, | ||
variants: { | ||
ringColor: [], | ||
}, | ||
} | ||
|
||
const { utilities } = invokePlugin(plugin(), config) | ||
expect(utilities).toEqual([ | ||
[ | ||
{ | ||
'*': { | ||
'--tw-ring-color': 'rgba(147, 197, 253, 0.5)', | ||
'--tw-ring-inset': 'var(--tw-empty,/*!*/ /*!*/)', | ||
'--tw-ring-offset-color': 'pink', | ||
'--tw-ring-offset-shadow': '0 0 #0000', | ||
'--tw-ring-offset-width': '2px', | ||
'--tw-ring-shadow': '0 0 #0000', | ||
}, | ||
}, | ||
{ respectImportant: false }, | ||
], | ||
[ | ||
{ | ||
'.ring-inset': { | ||
'--tw-ring-inset': 'inset', | ||
}, | ||
}, | ||
undefined, | ||
], | ||
]) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters