Skip to content

Commit d92e142

Browse files
committed
Add test case
And fix typos that were definitely not there
1 parent cc2edce commit d92e142

File tree

1 file changed

+38
-6
lines changed

1 file changed

+38
-6
lines changed

tests/opacity.test.js

+38-6
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ test('Theme function in JS can apply alpha values to colors (1)', () => {
456456
})
457457
})
458458

459-
test('TTheme function in JS can apply alpha values to colors (2)', () => {
459+
test('Theme function in JS can apply alpha values to colors (2)', () => {
460460
let input = css`
461461
@tailwind utilities;
462462
`
@@ -484,7 +484,7 @@ test('TTheme function in JS can apply alpha values to colors (2)', () => {
484484
})
485485
})
486486

487-
test('TTheme function in JS can apply alpha values to colors (3)', () => {
487+
test('Theme function in JS can apply alpha values to colors (3)', () => {
488488
let input = css`
489489
@tailwind utilities;
490490
`
@@ -512,7 +512,7 @@ test('TTheme function in JS can apply alpha values to colors (3)', () => {
512512
})
513513
})
514514

515-
test('TTheme function in JS can apply alpha values to colors (4)', () => {
515+
test('Theme function in JS can apply alpha values to colors (4)', () => {
516516
let input = css`
517517
@tailwind utilities;
518518
`
@@ -540,7 +540,7 @@ test('TTheme function in JS can apply alpha values to colors (4)', () => {
540540
})
541541
})
542542

543-
test('TTheme function in JS can apply alpha values to colors (5)', () => {
543+
test('Theme function in JS can apply alpha values to colors (5)', () => {
544544
let input = css`
545545
@tailwind utilities;
546546
`
@@ -568,7 +568,7 @@ test('TTheme function in JS can apply alpha values to colors (5)', () => {
568568
})
569569
})
570570

571-
test('TTheme function in JS can apply alpha values to colors (6)', () => {
571+
test('Theme function in JS can apply alpha values to colors (6)', () => {
572572
let input = css`
573573
@tailwind utilities;
574574
`
@@ -596,7 +596,7 @@ test('TTheme function in JS can apply alpha values to colors (6)', () => {
596596
})
597597
})
598598

599-
test('TTheme function in JS can apply alpha values to colors (7)', () => {
599+
test('Theme function in JS can apply alpha values to colors (7)', () => {
600600
let input = css`
601601
@tailwind utilities;
602602
`
@@ -627,3 +627,35 @@ test('TTheme function in JS can apply alpha values to colors (7)', () => {
627627
expect(result.warnings().length).toBe(0)
628628
})
629629
})
630+
631+
test('Theme function prefers existing values in config', () => {
632+
let input = css`
633+
@tailwind utilities;
634+
`
635+
636+
let output = css`
637+
.text-foo {
638+
color: purple;
639+
}
640+
`
641+
642+
return run(input, {
643+
content: [{ raw: html`text-foo` }],
644+
corePlugins: { textOpacity: false },
645+
theme: {
646+
colors: {
647+
blue: {
648+
'500 / 50%': 'purple',
649+
},
650+
},
651+
extend: {
652+
textColor: ({ theme }) => ({
653+
foo: theme('colors.blue.500 / 50%'),
654+
}),
655+
},
656+
},
657+
}).then((result) => {
658+
expect(result.css).toMatchCss(output)
659+
expect(result.warnings().length).toBe(0)
660+
})
661+
})

0 commit comments

Comments
 (0)