Skip to content

Commit

Permalink
Add another classes test
Browse files Browse the repository at this point in the history
  • Loading branch information
geophree committed Sep 30, 2020
1 parent 62414f7 commit c4a16f0
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
16 changes: 15 additions & 1 deletion __tests__/__snapshots__/classes.js.snap
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`and 1`] = `
"import style9 from 'style9';
const styles = {
default: {
color: \\"c1r9f2e5\\",
opacity: \\"cu2kwdz\\"
},
red: {
color: \\"cyyg6ey\\"
}
};
(foo ? \\"cyyg6ey \\" : \\"c1r9f2e5 \\") + \\"cu2kwdz \\";"
`;

exports[`hoists function call 1`] = `
"import style9 from 'style9';
const styles = {
Expand Down Expand Up @@ -168,5 +182,5 @@ const styles = {
color: \\"cyyg6ey\\"
}
};
(foo ? \\"c1r9f2e5 \\" : \\"cyyg6ey \\") + (foo ? \\"cu2kwdz \\" : \\"\\");"
(foo ? \\"cyyg6ey \\" : \\"c1r9f2e5 \\") + \\"cu2kwdz \\";"
`;
20 changes: 19 additions & 1 deletion __tests__/classes.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,24 @@ styles(foo() && 'default');
expect(code).toMatchSnapshot();
});

it('and', async () => {
const input = `
import style9 from 'style9';
const styles = style9.create({
default: {
color: 'blue',
opacity: 1
},
red: {
color: 'red'
}
});
styles('default', foo && 'red');
`;
const { code } = compile(input);
expect(code).toMatchSnapshot();
});

it('ternary', () => {
const input = `
import style9 from 'style9';
Expand All @@ -45,7 +63,7 @@ const styles = style9.create({
color: 'red'
}
});
styles(foo ? 'default' : 'red');
styles(foo ? 'red' : 'default');
`;
const { code } = compile(input);
expect(code).toMatchSnapshot();
Expand Down

0 comments on commit c4a16f0

Please sign in to comment.