Skip to content

Commit

Permalink
feat: add initial jest test for the ratio component's twig rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
sghoweri committed Feb 21, 2019
1 parent 0cc58e6 commit 754dfd7
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
@@ -0,0 +1,11 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`<bolt-ratio> Component <bolt-ratio> compiles 1`] = `
<bolt-ratio ratio="1200/660"
style="padding-bottom: calc(660 / 1200 * 100%); --aspect-ratio: 1200/660"
>
<img src="/fixtures/1200x660.jpg">
</bolt-ratio>
`;
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions packages/components/bolt-ratio/__tests__/ratio.js
@@ -0,0 +1,12 @@
const { render } = require('@bolt/twig-renderer');

describe('<bolt-ratio> Component', async () => {
test('<bolt-ratio> compiles', async () => {
const results = await render('@bolt-components-ratio/ratio.twig', {
children: '<img src="/fixtures/1200x660.jpg">',
ratio: '1200/660',
});
expect(results.ok).toBe(true);
expect(results.html).toMatchSnapshot();
});
});

0 comments on commit 754dfd7

Please sign in to comment.