Skip to content

Commit 270cdec

Browse files
committed
add failing tests to prevent regression
1 parent ba5c37f commit 270cdec

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

__tests__/components/Headers/TimelineHeader.test.js

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,27 @@ describe('TimelineHeader', () => {
6868
expect(getByTestId('headerContainer')).toHaveClass('testClassName')
6969
})
7070

71+
it('Given TimelineHeader When no calendarHeaderClassName specified Then undefined should not be applied to the date header container', () => {
72+
const { getByTestId } = renderTimelineWithLeftAndRightSidebar({
73+
calendarHeaderClassName: undefined
74+
})
75+
expect(getByTestId('headerContainer')).not.toHaveClass('undefined')
76+
})
77+
7178
it('Given TimelineHeader When pass className Then it should be applied to the root header container', () => {
7279
const { getByTestId } = renderTimelineWithLeftAndRightSidebar({
7380
className: 'testClassName'
7481
})
7582
expect(getByTestId('headerRootDiv')).toHaveClass('testClassName')
7683
})
7784

85+
it('Given TimelineHeader When no className specified Then undefined should not be applied to the root header container', () => {
86+
const { getByTestId } = renderTimelineWithLeftAndRightSidebar({
87+
className: undefined
88+
})
89+
expect(getByTestId('headerRootDiv')).not.toHaveClass('undefined')
90+
})
91+
7892
it('Given TimelineHeader When rendered Then it should render the default styles of the date header container', () => {
7993
const { getByTestId } = renderTimelineWithLeftAndRightSidebar()
8094
const headerContainer = getByTestId('headerContainer')
@@ -116,15 +130,16 @@ describe('TimelineHeader', () => {
116130
expect(getAllByTestId('sidebarHeader')).toHaveLength(1)
117131
})
118132
it('Given SidebarHeader When passing variant prop with right value Then it should rendered above the right sidebar', () => {
119-
const { getByTestId, getAllByTestId, debug } = renderSidebarHeaderWithCustomValues(
120-
{ variant: 'right' }
121-
)
133+
const {
134+
getByTestId,
135+
getAllByTestId,
136+
debug
137+
} = renderSidebarHeaderWithCustomValues({ variant: 'right' })
122138
expect(getByTestId('sidebarHeader')).toBeInTheDocument()
123139
expect(getAllByTestId('sidebarHeader')).toHaveLength(2)
124-
expect(getAllByTestId('sidebarHeader')[1].previousElementSibling).toHaveAttribute(
125-
'data-testid',
126-
'headerContainer'
127-
)
140+
expect(
141+
getAllByTestId('sidebarHeader')[1].previousElementSibling
142+
).toHaveAttribute('data-testid', 'headerContainer')
128143
})
129144

130145
it('Given SidebarHeader When passing variant prop with unusual value Then it should rendered above the left sidebar by default', () => {

0 commit comments

Comments
 (0)