File tree Expand file tree Collapse file tree 3 files changed +30
-1
lines changed
packages/styled-components/src Expand file tree Collapse file tree 3 files changed +30
-1
lines changed Original file line number Diff line number Diff line change
1
+ import { createGlobalStyle as scCreateGlobalStyle } from 'styled-components'
2
+ import { css } from './css'
3
+
4
+ export const createGlobalStyle = ( ...args ) => {
5
+ return scCreateGlobalStyle ( css ( ...args ) )
6
+ }
Original file line number Diff line number Diff line change
1
+ import React from 'react'
2
+ import 'jest-dom/extend-expect'
3
+ import { render } from '@testing-library/react'
4
+ import { createGlobalStyle } from '.'
5
+
6
+ describe ( '#createGlobalStyle' , ( ) => {
7
+ it ( 'injects global styles' , ( ) => {
8
+ const GlobalStyle = createGlobalStyle `
9
+ .margin {
10
+ margin: 2;
11
+ }
12
+ `
13
+ const { container } = render (
14
+ < >
15
+ < GlobalStyle />
16
+ < div className = "margin" />
17
+ </ > ,
18
+ )
19
+ expect ( container . firstChild ) . toHaveStyle ( `
20
+ margin: 8px;
21
+ ` )
22
+ } )
23
+ } )
Original file line number Diff line number Diff line change 1
1
export {
2
- createGlobalStyle ,
3
2
isStyledComponent ,
4
3
keyframes ,
5
4
ServerStyleSheet ,
@@ -14,5 +13,6 @@ export {
14
13
} from 'styled-components'
15
14
16
15
export { css } from './css'
16
+ export { createGlobalStyle } from './createGlobalStyle'
17
17
export { Box } from './Box'
18
18
export { styled as default } from './styled'
You can’t perform that action at this time.
0 commit comments