This repository has been archived by the owner on Jan 13, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: allow
null
as a fallback value in custom-property mixins
PiperOrigin-RevId: 487307936
- Loading branch information
1 parent
5e5c2af
commit 3e3f433
Showing
2 changed files
with
63 additions
and
12 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,61 @@ | ||
@use 'true' as test; | ||
|
||
@use '../custom-properties'; | ||
|
||
@include test.describe('custom-properties') { | ||
@include test.describe('get-declaration-value()') { | ||
@include test.describe('when emit-custom-properties is false ') { | ||
@include custom-properties.configure($emit-custom-properties: false) { | ||
@include test.it('returns null when fallback is null') { | ||
$input: ( | ||
varname: --test-property, | ||
fallback: null, | ||
); | ||
|
||
@include test.assert-equal( | ||
custom-properties.get-declaration-value($input), | ||
null | ||
); | ||
} | ||
|
||
@include test.it('dos not return a custom property') { | ||
$input: ( | ||
varname: --test-property, | ||
fallback: 'blue', | ||
); | ||
|
||
@include test.assert-equal( | ||
custom-properties.get-declaration-value($input), | ||
'blue' | ||
); | ||
} | ||
} | ||
|
||
@include test.it('return a custom property') { | ||
$input: ( | ||
varname: --test-property, | ||
fallback: 'blue', | ||
); | ||
|
||
@include test.assert-equal( | ||
custom-properties.get-declaration-value($input), | ||
var(--test-property, 'blue') | ||
); | ||
} | ||
|
||
@include test.it( | ||
'returns just the custom property when fallback is null' | ||
) { | ||
$input: ( | ||
varname: --test-property, | ||
fallback: null, | ||
); | ||
|
||
@include test.assert-equal( | ||
custom-properties.get-declaration-value($input), | ||
var(--test-property) | ||
); | ||
} | ||
} | ||
} | ||
} |