Skip to content

Commit

Permalink
Add Link test case
Browse files Browse the repository at this point in the history
  • Loading branch information
dabbott committed Mar 5, 2023
1 parent c503b47 commit 9cc2464
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/noya-compiler/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ function Frame(props: React.ComponentProps<typeof Box>) {
name: 'app',
dependencies: {
react: '^18',
'@chakra-ui/icons': '^2',
'@chakra-ui/icons': '^1',
'@chakra-ui/react': '^1',
'@emotion/react': '^11',
'@emotion/styled': '^11',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export { App };
\\"name\\": \\"app\\",
\\"dependencies\\": {
\\"react\\": \\"^18\\",
\\"@chakra-ui/icons\\": \\"^2\\",
\\"@chakra-ui/icons\\": \\"^1\\",
\\"@chakra-ui/react\\": \\"^1\\",
\\"@emotion/react\\": \\"^11\\",
\\"@emotion/styled\\": \\"^11\\"
Expand Down Expand Up @@ -197,6 +197,15 @@ exports[`icon with color 1`] = `
"
`;
exports[`link with icon 1`] = `
"<Frame width={100} height={40}>
<Link fontWeight=\\"semibold\\" color=\\"dodgerblue\\">
{'Test'}
</Link>
</Frame>;
"
`;
exports[`text default 1`] = `
"<Frame width={100} height={40}>
<Text className=\\"text-red-500\\" textAlign=\\"center\\">
Expand Down
17 changes: 17 additions & 0 deletions packages/site/src/__tests__/renderBlock.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
heroSymbolV2Id,
iconSymbolId,
imageSymbolId,
linkSymbolId,
textSymbolId,
} from '../ayon/blocks/symbolIds';

Expand Down Expand Up @@ -69,6 +70,22 @@ describe('text', () => {
});
});

describe('link', () => {
// TODO: Icon doesn't get added to exported code
test('with icon', () => {
const symbol = SketchModel.symbolInstance({
symbolID: linkSymbolId,
blockText: 'Test #icon-arrow-right',
frame: SketchModel.rect({
width: 100,
height: 40,
}),
});

expect(generate(symbol)).toMatchSnapshot();
});
});

describe('icon', () => {
test('default', () => {
const symbol = SketchModel.symbolInstance({
Expand Down

0 comments on commit 9cc2464

Please sign in to comment.