Skip to content

Commit 1a3d3fe

Browse files
author
Luke Bowerman
authored
Fix DialogContent borderBottom + test coverage (#1151)
1 parent 5aaed7c commit 1a3d3fe

File tree

4 files changed

+47
-24
lines changed

4 files changed

+47
-24
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [UNRELEASED]
9+
10+
### Fixed
11+
12+
- `DialogContent` with `borderBottom` prop CSS output error (no border, no flex: 8)
13+
814
## [0.9.4] - 2020-06-29
915

1016
### Added

packages/components/src/Dialog/Layout/DialogContent.test.tsx

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,34 @@
2626

2727
import 'jest-styled-components'
2828
import React from 'react'
29-
import { assertSnapshot } from '@looker/components-test-utils'
29+
import { assertSnapshot, renderWithTheme } from '@looker/components-test-utils'
3030
import { DialogContent } from './DialogContent'
3131

32-
test('DialogContent - no overflow', () => {
33-
assertSnapshot(<DialogContent>Stuff</DialogContent>)
34-
})
35-
36-
test('DialogContent - no overflow', () => {
37-
assertSnapshot(
38-
<DialogContent>
39-
<div style={{ height: '4rem' }}>Stuff</div>
40-
</DialogContent>
41-
)
32+
describe('DialogContent', () => {
33+
test('Snapshot', () => {
34+
assertSnapshot(<DialogContent>Stuff</DialogContent>)
35+
})
36+
37+
test('Snapshot - No overflow', () => {
38+
assertSnapshot(
39+
<DialogContent>
40+
<div style={{ height: '4rem' }}>Stuff</div>
41+
</DialogContent>
42+
)
43+
})
44+
45+
test('borderBottom', () => {
46+
const { getByText } = renderWithTheme(
47+
<>
48+
<DialogContent>No border</DialogContent>
49+
<DialogContent borderBottom>Has border</DialogContent>
50+
</>
51+
)
52+
53+
const noBorder = getByText('No border')
54+
expect(noBorder.parentNode).toHaveStyle('border-bottom: none')
55+
56+
const hasBorder = getByText('Has border')
57+
expect(hasBorder.parentNode).toHaveStyle('border-bottom: 1px solid #DEE1E5')
58+
})
4259
})

packages/components/src/Dialog/Layout/DialogContent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ const Outer = styled.div<{ borderBottom?: boolean }>`
117117
${layout}
118118
119119
${({ borderBottom, theme: { colors } }) =>
120-
borderBottom && `border-bottom: 1px solid ${colors.ui2}`}
120+
borderBottom && `border-bottom: 1px solid ${colors.ui2};`}
121121
122122
flex: 8;
123123
overflow: auto;

packages/components/src/Dialog/Layout/__snapshots__/DialogContent.test.tsx.snap

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`DialogContent - no overflow 1`] = `
3+
exports[`DialogContent Snapshot - No overflow 1`] = `
44
.c0 {
55
-webkit-flex: 8;
66
-ms-flex: 8;
@@ -27,12 +27,20 @@ exports[`DialogContent - no overflow 1`] = `
2727
<div
2828
className="c1"
2929
>
30-
Stuff
30+
<div
31+
style={
32+
Object {
33+
"height": "4rem",
34+
}
35+
}
36+
>
37+
Stuff
38+
</div>
3139
</div>
3240
</div>
3341
`;
3442

35-
exports[`DialogContent - no overflow 2`] = `
43+
exports[`DialogContent Snapshot 1`] = `
3644
.c0 {
3745
-webkit-flex: 8;
3846
-ms-flex: 8;
@@ -59,15 +67,7 @@ exports[`DialogContent - no overflow 2`] = `
5967
<div
6068
className="c1"
6169
>
62-
<div
63-
style={
64-
Object {
65-
"height": "4rem",
66-
}
67-
}
68-
>
69-
Stuff
70-
</div>
70+
Stuff
7171
</div>
7272
</div>
7373
`;

0 commit comments

Comments
 (0)