custom-properties.test.scss 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. @use 'true' as test;
  2. @use '../custom-properties';
  3. @include test.describe('custom-properties') {
  4. @include test.describe('get-declaration-value()') {
  5. @include test.describe('when emit-custom-properties is false ') {
  6. @include custom-properties.configure($emit-custom-properties: false) {
  7. @include test.it('returns null when fallback is null') {
  8. $input: (
  9. varname: --test-property,
  10. fallback: null,
  11. );
  12. @include test.assert-equal(
  13. custom-properties.get-declaration-value($input),
  14. null
  15. );
  16. }
  17. @include test.it('dos not return a custom property') {
  18. $input: (
  19. varname: --test-property,
  20. fallback: 'blue',
  21. );
  22. @include test.assert-equal(
  23. custom-properties.get-declaration-value($input),
  24. 'blue'
  25. );
  26. }
  27. }
  28. @include test.it('return a custom property') {
  29. $input: (
  30. varname: --test-property,
  31. fallback: 'blue',
  32. );
  33. @include test.assert-equal(
  34. custom-properties.get-declaration-value($input),
  35. var(--test-property, 'blue')
  36. );
  37. }
  38. @include test.it(
  39. 'returns just the custom property when fallback is null'
  40. ) {
  41. $input: (
  42. varname: --test-property,
  43. fallback: null,
  44. );
  45. @include test.assert-equal(
  46. custom-properties.get-declaration-value($input),
  47. var(--test-property)
  48. );
  49. }
  50. }
  51. }
  52. }