Skip to content

Commit 583cbd4

Browse files
committed
Add failing tests for nested invocations
1 parent af848c6 commit 583cbd4

File tree

1 file changed

+92
-0
lines changed

1 file changed

+92
-0
lines changed

packages/tailwindcss-language-service/src/util/find.test.ts

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -904,6 +904,16 @@ test('Can find helper functions in CSS', async ({ expect }) => {
904904
.a { color: theme(foo / 0.5, default); }
905905
.a { color: theme("foo" / 0.5); }
906906
.a { color: theme("foo" / 0.5, default); }
907+
908+
/* nested invocations */
909+
.a { color: from-config(theme(foo)); }
910+
.a { color: from-config(theme(foo, default)); }
911+
.a { color: from-config(theme("foo")); }
912+
.a { color: from-config(theme("foo", default)); }
913+
.a { color: from-config(theme(foo / 0.5)); }
914+
.a { color: from-config(theme(foo / 0.5, default)); }
915+
.a { color: from-config(theme("foo" / 0.5)); }
916+
.a { color: from-config(theme("foo" / 0.5, default)); }
907917
`,
908918
})
909919

@@ -950,5 +960,87 @@ test('Can find helper functions in CSS', async ({ expect }) => {
950960
path: 'foo',
951961
ranges: { full: range(8, 24, 8, 44), path: range(8, 25, 8, 28) },
952962
},
963+
964+
// Nested
965+
{
966+
helper: 'config',
967+
path: 'theme(foo)',
968+
ranges: { full: range(11, 30, 11, 40), path: range(11, 30, 11, 40) },
969+
},
970+
{
971+
helper: 'theme',
972+
path: 'foo',
973+
ranges: { full: range(11, 36, 11, 39), path: range(11, 36, 11, 39) },
974+
},
975+
{
976+
helper: 'config',
977+
path: 'theme(foo, default)',
978+
ranges: { full: range(12, 30, 12, 49), path: range(12, 30, 12, 49) },
979+
},
980+
{
981+
helper: 'theme',
982+
path: 'foo',
983+
ranges: { full: range(12, 36, 12, 48), path: range(12, 36, 12, 39) },
984+
},
985+
{
986+
helper: 'config',
987+
path: 'theme("foo")',
988+
ranges: { full: range(13, 30, 13, 42), path: range(13, 30, 13, 42) },
989+
},
990+
{
991+
helper: 'theme',
992+
path: 'foo',
993+
ranges: { full: range(13, 36, 13, 41), path: range(13, 37, 13, 40) },
994+
},
995+
{
996+
helper: 'config',
997+
path: 'theme("foo", default)',
998+
ranges: { full: range(14, 30, 14, 51), path: range(14, 30, 14, 51) },
999+
},
1000+
{
1001+
helper: 'theme',
1002+
path: 'foo',
1003+
ranges: { full: range(14, 36, 14, 50), path: range(14, 37, 14, 40) },
1004+
},
1005+
{
1006+
helper: 'config',
1007+
path: 'theme(foo / 0.5)',
1008+
ranges: { full: range(15, 30, 15, 46), path: range(15, 30, 15, 46) },
1009+
},
1010+
{
1011+
helper: 'theme',
1012+
path: 'foo',
1013+
ranges: { full: range(15, 36, 15, 45), path: range(15, 36, 15, 39) },
1014+
},
1015+
{
1016+
helper: 'config',
1017+
path: 'theme(foo / 0.5, default)',
1018+
ranges: { full: range(16, 30, 16, 55), path: range(16, 30, 16, 55) },
1019+
},
1020+
{
1021+
helper: 'theme',
1022+
path: 'foo',
1023+
ranges: { full: range(16, 36, 16, 54), path: range(16, 36, 16, 39) },
1024+
},
1025+
{
1026+
helper: 'config',
1027+
path: 'theme("foo" / 0.5)',
1028+
ranges: { full: range(17, 30, 17, 48), path: range(17, 30, 17, 48) },
1029+
},
1030+
{
1031+
helper: 'theme',
1032+
path: 'foo',
1033+
ranges: { full: range(17, 36, 17, 47), path: range(17, 37, 17, 40) },
1034+
},
1035+
{
1036+
helper: 'config',
1037+
path: 'theme("foo" / 0.5, default)',
1038+
ranges: { full: range(18, 30, 18, 57), path: range(18, 30, 18, 57) },
1039+
},
1040+
{
1041+
helper: 'theme',
1042+
path: 'foo',
1043+
ranges: { full: range(18, 36, 18, 56), path: range(18, 37, 18, 40) },
1044+
},
9531045
])
9541046
})

0 commit comments

Comments
 (0)