Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 44 additions & 8 deletions __tests__/containerPlugin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function config(overrides) {
})
}

test.only('options are not required', () => {
test('options are not required', () => {
const { components } = processPlugins([container()], config())

expect(css(components)).toMatchCss(`
Expand All @@ -45,7 +45,7 @@ test.only('options are not required', () => {
`)
})

test.only('screens can be passed explicitly', () => {
test('screens can be passed explicitly', () => {
const { components } = processPlugins(
[container()],
config({
Expand All @@ -72,7 +72,7 @@ test.only('screens can be passed explicitly', () => {
`)
})

test.only('screens are ordered ascending by min-width', () => {
test('screens are ordered ascending by min-width', () => {
const { components } = processPlugins(
[container()],
config({
Expand All @@ -99,7 +99,7 @@ test.only('screens are ordered ascending by min-width', () => {
`)
})

test.only('screens are deduplicated by min-width', () => {
test('screens are deduplicated by min-width', () => {
const { components } = processPlugins(
[container()],
config({
Expand Down Expand Up @@ -130,7 +130,7 @@ test.only('screens are deduplicated by min-width', () => {
`)
})

test.only('the container can be centered by default', () => {
test('the container can be centered by default', () => {
const { components } = processPlugins(
[container()],
config({
Expand Down Expand Up @@ -167,7 +167,7 @@ test.only('the container can be centered by default', () => {
`)
})

test.only('horizontal padding can be included by default', () => {
test('horizontal padding can be included by default', () => {
const { components } = processPlugins(
[container()],
config({
Expand Down Expand Up @@ -204,7 +204,7 @@ test.only('horizontal padding can be included by default', () => {
`)
})

test.only('responsive horizontal padding can be included by default', () => {
test('responsive horizontal padding can be included by default', () => {
const { components } = processPlugins(
[container()],
config({
Expand Down Expand Up @@ -258,7 +258,7 @@ test.only('responsive horizontal padding can be included by default', () => {
`)
})

test.only('setting all options at once', () => {
test('setting all options at once', () => {
const { components } = processPlugins(
[container()],
config({
Expand Down Expand Up @@ -292,3 +292,39 @@ test.only('setting all options at once', () => {
}
`)
})

test('container can use variants', () => {
const { components } = processPlugins(
[container()],
config({
theme: {
container: {
screens: ['400px', '500px'],
},
},
variants: {
container: ['responsive', 'hover'],
},
})
)

expect(css(components)).toMatchCss(`
@layer components {
@variants responsive, hover {
.container {
width: 100%
}
@media (min-width: 400px) {
.container {
max-width: 400px
}
}
@media (min-width: 500px) {
.container {
max-width: 500px
}
}
}
}
`)
})
112 changes: 112 additions & 0 deletions __tests__/fixtures/tailwind-output-ie11.css
Original file line number Diff line number Diff line change
Expand Up @@ -10956,6 +10956,34 @@ video {
}

@media (min-width: 640px) {
.sm\:container {
width: 100%;
}

@media (min-width: 640px) {
.sm\:container {
max-width: 640px;
}
}

@media (min-width: 768px) {
.sm\:container {
max-width: 768px;
}
}

@media (min-width: 1024px) {
.sm\:container {
max-width: 1024px;
}
}

@media (min-width: 1280px) {
.sm\:container {
max-width: 1280px;
}
}

.sm\:space-y-0 > :not(template) ~ :not(template) {
margin-top: 0;
}
Expand Down Expand Up @@ -21308,6 +21336,34 @@ video {
}

@media (min-width: 768px) {
.md\:container {
width: 100%;
}

@media (min-width: 640px) {
.md\:container {
max-width: 640px;
}
}

@media (min-width: 768px) {
.md\:container {
max-width: 768px;
}
}

@media (min-width: 1024px) {
.md\:container {
max-width: 1024px;
}
}

@media (min-width: 1280px) {
.md\:container {
max-width: 1280px;
}
}

.md\:space-y-0 > :not(template) ~ :not(template) {
margin-top: 0;
}
Expand Down Expand Up @@ -31660,6 +31716,34 @@ video {
}

@media (min-width: 1024px) {
.lg\:container {
width: 100%;
}

@media (min-width: 640px) {
.lg\:container {
max-width: 640px;
}
}

@media (min-width: 768px) {
.lg\:container {
max-width: 768px;
}
}

@media (min-width: 1024px) {
.lg\:container {
max-width: 1024px;
}
}

@media (min-width: 1280px) {
.lg\:container {
max-width: 1280px;
}
}

.lg\:space-y-0 > :not(template) ~ :not(template) {
margin-top: 0;
}
Expand Down Expand Up @@ -42012,6 +42096,34 @@ video {
}

@media (min-width: 1280px) {
.xl\:container {
width: 100%;
}

@media (min-width: 640px) {
.xl\:container {
max-width: 640px;
}
}

@media (min-width: 768px) {
.xl\:container {
max-width: 768px;
}
}

@media (min-width: 1024px) {
.xl\:container {
max-width: 1024px;
}
}

@media (min-width: 1280px) {
.xl\:container {
max-width: 1280px;
}
}

.xl\:space-y-0 > :not(template) ~ :not(template) {
margin-top: 0;
}
Expand Down
112 changes: 112 additions & 0 deletions __tests__/fixtures/tailwind-output-important.css
Original file line number Diff line number Diff line change
Expand Up @@ -14342,6 +14342,34 @@ video {
}

@media (min-width: 640px) {
.sm\:container {
width: 100%;
}

@media (min-width: 640px) {
.sm\:container {
max-width: 640px;
}
}

@media (min-width: 768px) {
.sm\:container {
max-width: 768px;
}
}

@media (min-width: 1024px) {
.sm\:container {
max-width: 1024px;
}
}

@media (min-width: 1280px) {
.sm\:container {
max-width: 1280px;
}
}

.sm\:space-y-0 > :not(template) ~ :not(template) {
--space-y-reverse: 0 !important;
margin-top: calc(0px * calc(1 - var(--space-y-reverse))) !important;
Expand Down Expand Up @@ -28080,6 +28108,34 @@ video {
}

@media (min-width: 768px) {
.md\:container {
width: 100%;
}

@media (min-width: 640px) {
.md\:container {
max-width: 640px;
}
}

@media (min-width: 768px) {
.md\:container {
max-width: 768px;
}
}

@media (min-width: 1024px) {
.md\:container {
max-width: 1024px;
}
}

@media (min-width: 1280px) {
.md\:container {
max-width: 1280px;
}
}

.md\:space-y-0 > :not(template) ~ :not(template) {
--space-y-reverse: 0 !important;
margin-top: calc(0px * calc(1 - var(--space-y-reverse))) !important;
Expand Down Expand Up @@ -41818,6 +41874,34 @@ video {
}

@media (min-width: 1024px) {
.lg\:container {
width: 100%;
}

@media (min-width: 640px) {
.lg\:container {
max-width: 640px;
}
}

@media (min-width: 768px) {
.lg\:container {
max-width: 768px;
}
}

@media (min-width: 1024px) {
.lg\:container {
max-width: 1024px;
}
}

@media (min-width: 1280px) {
.lg\:container {
max-width: 1280px;
}
}

.lg\:space-y-0 > :not(template) ~ :not(template) {
--space-y-reverse: 0 !important;
margin-top: calc(0px * calc(1 - var(--space-y-reverse))) !important;
Expand Down Expand Up @@ -55556,6 +55640,34 @@ video {
}

@media (min-width: 1280px) {
.xl\:container {
width: 100%;
}

@media (min-width: 640px) {
.xl\:container {
max-width: 640px;
}
}

@media (min-width: 768px) {
.xl\:container {
max-width: 768px;
}
}

@media (min-width: 1024px) {
.xl\:container {
max-width: 1024px;
}
}

@media (min-width: 1280px) {
.xl\:container {
max-width: 1280px;
}
}

.xl\:space-y-0 > :not(template) ~ :not(template) {
--space-y-reverse: 0 !important;
margin-top: calc(0px * calc(1 - var(--space-y-reverse))) !important;
Expand Down
Loading