Skip to content

Commit 6786b5d

Browse files
committed
minor #1734 [Twig] add additional CVA boolean tests (kbond)
This PR was merged into the 2.x branch. Discussion ---------- [Twig] add additional CVA boolean tests | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | Issues | Fix #1710 (comment) | License | MIT Some additional tests for using booleans with compounds and defaultVariables. Commits ------- 8a49bc9 [Twig] add additional CVA boolean tests
2 parents d8e0173 + 8a49bc9 commit 6786b5d

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

src/TwigComponent/tests/Unit/CVATest.php

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,30 @@ public static function recipeProvider(): iterable
236236
'font-semibold border rounded text-primary text-sm text-red-100',
237237
];
238238

239+
yield 'compound variants with true' => [
240+
[
241+
'base' => 'button',
242+
'variants' => [
243+
'colors' => [
244+
'blue' => 'btn-blue',
245+
'red' => 'btn-red',
246+
],
247+
'disabled' => [
248+
'true' => 'disabled',
249+
],
250+
],
251+
'compounds' => [
252+
[
253+
'colors' => 'blue',
254+
'disabled' => ['true'],
255+
'class' => 'font-bold',
256+
],
257+
],
258+
],
259+
['colors' => 'blue', 'disabled' => 'true'],
260+
'button btn-blue disabled font-bold',
261+
];
262+
239263
yield 'compound variants as array' => [
240264
[
241265
'base' => 'font-semibold border rounded',
@@ -450,6 +474,28 @@ public static function recipeProvider(): iterable
450474
'font-semibold border rounded text-primary text-sm rounded-md',
451475
];
452476

477+
yield 'default variables with boolean' => [
478+
[
479+
'base' => 'button',
480+
'variants' => [
481+
'colors' => [
482+
'blue' => 'btn-blue',
483+
'red' => 'btn-red',
484+
],
485+
'disabled' => [
486+
'true' => 'disabled',
487+
'false' => 'opacity-100',
488+
],
489+
],
490+
'defaultVariants' => [
491+
'colors' => 'blue',
492+
'disabled' => 'false',
493+
],
494+
],
495+
[],
496+
'button btn-blue opacity-100',
497+
];
498+
453499
yield 'boolean string variants true / true' => [
454500
[
455501
'variants' => [

0 commit comments

Comments
 (0)