/**
* @jest-environment node
*/
import React from 'react';
import { renderToStaticMarkup } from 'react-dom/server';
import { styled, CC } from '@compiled/css-in-js';
describe('SSR', () => {
it('should render styles inline', () => {
const StyledDiv = styled.div`
font-size: 12px;
`;
const result = renderToStaticMarkup(hello world);
expect(result).toMatchInlineSnapshot(
`"
hello world
"`
);
});
it('should only render one style block when wrapped in a compiled component when siblings', () => {
const StyledDiv = styled.div`
font-size: 12px;
`;
const result = renderToStaticMarkup(
hello world
hello world
);
expect(result).toMatchInlineSnapshot(
`"hello world
hello world
"`
);
});
it('should render semantically higher in the tree so FOUC does not occur when wrapped in compiled component', () => {
const StyledDiv = styled.div`
font-size: 12px;
`;
const result = renderToStaticMarkup(
);
expect(result).toMatchInlineSnapshot(
`""`
);
});
it('should only render one style element when having a parent compiled component', () => {
const StyledParent = styled.div`
display: flex;
`;
const StyledDiv = styled.div`
font-size: 12px;
`;
const result = renderToStaticMarkup(
hello world
hello world
);
expect(result).toMatchInlineSnapshot(
`""`
);
});
});