Skip to content

Commit

Permalink
add tests from prettier#6259 and prettier#7883
Browse files Browse the repository at this point in the history
  • Loading branch information
thorn0 committed Apr 23, 2020
1 parent ab1ea71 commit 9db1d9f
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 0 deletions.
70 changes: 70 additions & 0 deletions tests/multiparser_js_css/__snapshots__/jsfmt.spec.js.snap
Expand Up @@ -103,6 +103,64 @@ const Icon3 = styled.div\`
================================================================================
`;

exports[`issue-6259.js format 1`] = `
====================================options=====================================
parsers: ["babel"]
printWidth: 80
| printWidth
=====================================input======================================
export const Group = styled.div\`
margin: 0;
.input {
margin: 0;
}
\${StyledInput}:not(:first-child) {
margin: 0;
}
& > :not(.\${inputWrap}):not(\${Button}) {
display: flex;
}
\`
const yesFrame = (
...args: Interpolation<ThemedStyledProps<{}, Theme>>[]
) => css\`
\${ChatRoot}[data-frame="yes"] & {
\${css({}, ...args)}
}
\`
=====================================output=====================================
export const Group = styled.div\`
margin: 0;
.input {
margin: 0;
}
\${StyledInput}:not(:first-child) {
margin: 0;
}
& > :not(.\${inputWrap}):not(\${Button}) {
display: flex;
}
\`;
const yesFrame = (
...args: Interpolation<ThemedStyledProps<{}, Theme>>[]
) => css\`
\${ChatRoot}[data-frame="yes"] & {
\${css({}, ...args)}
}
\`;
================================================================================
`;

exports[`styled-components.js format 1`] = `
====================================options=====================================
parsers: ["babel"]
Expand Down Expand Up @@ -625,11 +683,23 @@ const Something = styled.div\`
border: 1px solid var(--\${two}); /* ... */
\`;
const StyledPurchaseCard = styled(Card)\`
min-width: 200px;
background-color: var(--\${props => props.color});
color: #fff;
\`;
=====================================output=====================================
const Something = styled.div\`
background: var(--\${one}); /* ... */
border: 1px solid var(--\${two}); /* ... */
\`;
const StyledPurchaseCard = styled(Card)\`
min-width: 200px;
background-color: var(--\${(props) => props.color});
color: #fff;
\`;
================================================================================
`;
23 changes: 23 additions & 0 deletions tests/multiparser_js_css/issue-6259.js
@@ -0,0 +1,23 @@
export const Group = styled.div`
margin: 0;
.input {
margin: 0;
}
${StyledInput}:not(:first-child) {
margin: 0;
}
& > :not(.${inputWrap}):not(${Button}) {
display: flex;
}
`

const yesFrame = (
...args: Interpolation<ThemedStyledProps<{}, Theme>>[]
) => css`
${ChatRoot}[data-frame="yes"] & {
${css({}, ...args)}
}
`
6 changes: 6 additions & 0 deletions tests/multiparser_js_css/var.js
Expand Up @@ -2,3 +2,9 @@ const Something = styled.div`
background: var(--${one}); /* ... */
border: 1px solid var(--${two}); /* ... */
`;

const StyledPurchaseCard = styled(Card)`
min-width: 200px;
background-color: var(--${props => props.color});
color: #fff;
`;

0 comments on commit 9db1d9f

Please sign in to comment.