Skip to content

Commit 7f67416

Browse files
author
Luke Bowerman
authored
Preparatory work for Styled Components 5 & latest TS (#1479)
1 parent 8443ee6 commit 7f67416

File tree

14 files changed

+36
-20
lines changed

14 files changed

+36
-20
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
"prettier": "^2.1.2",
7474
"react": "^16.13.1",
7575
"react-dom": "^16.13.1",
76+
"react-is": "^16.13.1",
7677
"styled-components": "^4.4.1",
7778
"typescript": "^3.8.3",
7879
"webpack": "^4.44.2"

packages/components-providers/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@
2222
"@types/react": "^16.9.49",
2323
"@types/styled-components": "^4.4.1",
2424
"react": "^16.13.1",
25+
"react-is": "^16.13.1",
2526
"styled-components": "^4.4.1"
2627
},
2728
"peerDependencies": {
28-
"react": "^16.9.0",
29+
"react": "^16.11",
30+
"react-is": "^16.11",
2931
"styled-components": "^4"
3032
},
3133
"gitHead": "62febc162e3e45124f403e2c84fc741f68fe6714"

packages/components-test-utils/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,13 @@
2525
"enzyme": "^3.11.0",
2626
"jest-styled-components": "^6.3.4",
2727
"react": "^16.13.1",
28+
"react-is": "^16.13.1",
2829
"react-test-renderer": "^16.13.1",
2930
"styled-components": "^4.4.1"
3031
},
3132
"peerDependencies": {
32-
"react": "^16.11"
33+
"react": "^16.11",
34+
"react-is": "^16.11"
3335
},
3436
"gitHead": "62febc162e3e45124f403e2c84fc741f68fe6714"
3537
}

packages/components-theme-editor/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@
2424
"@types/react": "^16.9.49",
2525
"@types/styled-components": "^4.4.1",
2626
"react": "^16.13.1",
27+
"react-is": "^16.13.1",
2728
"styled-components": "^4.4.1"
2829
},
2930
"peerDependencies": {
30-
"react": "^16.9.0",
31+
"react": "^16.11",
32+
"react-is": "^16.11",
3133
"styled-components": "^4"
3234
}
3335
}

packages/components/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,13 @@
5353
"jest-styled-components": "^6.3.4",
5454
"react": "^16.13.1",
5555
"react-dom": "^16.13.1",
56+
"react-is": "^16.13.1",
5657
"styled-components": "^4.4.1"
5758
},
5859
"peerDependencies": {
59-
"react": "^16.9.0",
60-
"react-dom": "^16.9.0",
60+
"react": "^16.11",
61+
"react-dom": "^16.11",
62+
"react-is": "^16.11",
6163
"styled-components": "^4"
6264
},
6365
"gitHead": "62febc162e3e45124f403e2c84fc741f68fe6714"

packages/components/src/Dialog/Surface.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ interface SurfaceProps
5252
ColorProps,
5353
LayoutProps {
5454
surfaceStyles?: CSSObject
55-
anchor?: 'right'
5655
animationState?: string
5756
}
5857

packages/components/src/Form/Inputs/InputColor/InputColor.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ export const InputColorComponent = forwardRef(
135135
}
136136

137137
const handleColorChange = (hs: HueSaturation) => {
138-
setColorState({ h: 0, s: 100, ...hs, v: get(color, 'v', 1) })
138+
setColorState({ ...hs, v: get(color, 'v', 1) })
139139
}
140140

141141
const handleSliderChange = (event: FormEvent<HTMLInputElement>) =>

packages/components/src/Link/Link.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ describe('Link', () => {
4343
test('Underline', () => {
4444
renderWithTheme(<Link underline>My link</Link>)
4545
const link = screen.getByText('My link')
46-
expect(link).toHaveStyle('text-decoration: underline')
46+
expect(link).toHaveStyleRule('text-decoration: underline')
4747
})
4848

4949
test('color', () => {

packages/components/src/List/List.test.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
*/
2626

2727
import React from 'react'
28-
import { createWithTheme } from '@looker/components-test-utils'
28+
import { createWithTheme, renderWithTheme } from '@looker/components-test-utils'
29+
import { screen } from '@testing-library/react'
2930
import { List } from './List'
3031
import { ListItem } from './ListItem'
3132

@@ -68,15 +69,16 @@ test('A numerically ordered List', () => {
6869
})
6970

7071
test('A numerically ordered List marked as nomarker', () => {
71-
const component = createWithTheme(
72-
<List type="number" nomarker>
72+
renderWithTheme(
73+
<List type="number" nomarker data-testid="list">
7374
<ListItem>🥑</ListItem>
7475
<ListItem>🍕</ListItem>
7576
<ListItem>🥨</ListItem>
7677
</List>
7778
)
78-
const tree = component.toJSON()
79-
expect(tree).toHaveStyleRule('list-style-type', 'none')
79+
80+
const list = screen.getByTestId('list')
81+
expect(list).toHaveStyle('list-style-type: none')
8082
// Padding unset due to default reset applied
81-
expect(tree).toMatchSnapshot()
83+
expect(list).toMatchSnapshot()
8284
})

packages/components/src/List/__snapshots__/List.test.tsx.snap

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,21 +113,22 @@ exports[`A numerically ordered List marked as nomarker 1`] = `
113113
}
114114
115115
<ol
116-
className="c0"
116+
class="c0"
117+
data-testid="list"
117118
type="none"
118119
>
119120
<li
120-
className="c1"
121+
class="c1"
121122
>
122123
🥑
123124
</li>
124125
<li
125-
className="c1"
126+
class="c1"
126127
>
127128
🍕
128129
</li>
129130
<li
130-
className="c1"
131+
class="c1"
131132
>
132133
🥨
133134
</li>

0 commit comments

Comments
 (0)