Skip to content

Commit 2882d4c

Browse files
Fix ring color utility generation when using respectDefaultRingColorOpacity (#9070)
* Correct ring color list when using `respectDefaultRingColorOpacity` * Update changelog
1 parent 2184903 commit 2882d4c

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414
### Fixed
1515

1616
- Use absolute paths when resolving changed files for resilience against working directory changes ([#9032](https://github.com/tailwindlabs/tailwindcss/pull/9032))
17+
- Fix ring color utility generation when using `respectDefaultRingColorOpacity` ([#9070](https://github.com/tailwindlabs/tailwindcss/pull/9070))
1718

1819
## [3.1.8] - 2022-08-05
1920

src/util/getAllConfigs.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ export default function getAllConfigs(config) {
1111
// Add experimental configs here...
1212
respectDefaultRingColorOpacity: {
1313
theme: {
14-
ringColor: {
14+
ringColor: ({ theme }) => ({
1515
DEFAULT: '#3b82f67f',
16-
},
16+
...theme('colors'),
17+
}),
1718
},
1819
},
1920
}

tests/basic-usage.test.js

+28
Original file line numberDiff line numberDiff line change
@@ -661,3 +661,31 @@ it('A bare ring-opacity utility is supported when using respectDefaultRingColorO
661661
`)
662662
})
663663
})
664+
665+
it('Ring color utilities are generated when using respectDefaultRingColorOpacity', () => {
666+
let config = {
667+
future: { respectDefaultRingColorOpacity: true },
668+
content: [{ raw: html`<div class="ring ring-blue-500"></div>` }],
669+
corePlugins: { preflight: false },
670+
}
671+
672+
let input = css`
673+
@tailwind utilities;
674+
`
675+
676+
return run(input, config).then((result) => {
677+
expect(result.css).toMatchFormattedCss(css`
678+
.ring {
679+
--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width)
680+
var(--tw-ring-offset-color);
681+
--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width))
682+
var(--tw-ring-color);
683+
box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
684+
}
685+
.ring-blue-500 {
686+
--tw-ring-opacity: 1;
687+
--tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity));
688+
}
689+
`)
690+
})
691+
})

0 commit comments

Comments
 (0)