-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CssVarsProvider] Always generate new
css
object (#36853)
- Loading branch information
1 parent
d30c1fc
commit 01f329a
Showing
3 changed files
with
50 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { expect } from 'chai'; | ||
import prepareCssVars from './prepareCssVars'; | ||
|
||
describe('prepareCssVars', () => { | ||
it('`generateCssVars` should always return a new object', () => { | ||
const result = prepareCssVars({ | ||
colorSchemes: { | ||
dark: { | ||
color: 'red', | ||
}, | ||
}, | ||
}); | ||
|
||
const { css: css1 } = result.generateCssVars('dark'); | ||
const { css: css2 } = result.generateCssVars('dark'); | ||
|
||
expect(css1).to.not.equal(css2); | ||
}); | ||
|
||
it('delete css fields should not affect the next call', () => { | ||
const result = prepareCssVars({ | ||
colorSchemes: { | ||
dark: { | ||
color: 'red', | ||
}, | ||
}, | ||
}); | ||
|
||
const { css: css1 } = result.generateCssVars('dark'); | ||
|
||
delete css1['--color']; | ||
|
||
expect(css1).to.deep.equal({}); | ||
|
||
const { css: css2 } = result.generateCssVars('dark'); | ||
|
||
expect(css2).to.deep.equal({ '--color': 'red' }); | ||
}); | ||
}); |
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