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

Added support for custom CSS variable being a fallback for a custom CSS variable in transition property #245

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions src/supported-value.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ let el
function prefixTransitionCallback(match, p1, p2) {
if (p1 === 'var') return 'var'
if (p1 === 'all') return 'all'
if (p2 === 'var') return ', var'
if (p2 === 'all') return ', all'
const prefixedValue = p1 ? supportedProperty(p1) : `, ${supportedProperty(p2)}`
if (!prefixedValue) return p1 || p2
Expand Down
8 changes: 8 additions & 0 deletions src/supported-value.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ describe('css-vendor', () => {
expect(supportedValue('transition', 'var(--something)')).to.eql('var(--something)')
})

it('should return custom CSS variable with fallback CSS variable for transition property as it is', () => {
expect(supportedValue('transition', 'var(--something, var(--another-thing))')).to.eql('var(--something, var(--another-thing))')
})

it('should return custom CSS variable with fallback CSS variable having another CSS variable as fallback for transition property as it is', () => {
expect(supportedValue('transition', 'var(--something, var(--another-thing, var(--another-another-thing)))')).to.eql('var(--something, var(--another-thing, var(--another-another-thing)))')
})

it('should return custom CSS variables for transition property as they are', () => {
expect(supportedValue('transition', 'width var(--width), height var(--height)')).to.eql(
'width var(--width), height var(--height)'
Expand Down