-
Notifications
You must be signed in to change notification settings - Fork 842
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Emotion] Fix/regression test last batch of misc components with chil…
…dProps (#6255) * [EuiColorStops] Fix unmerged `style`s, `data-test-subj`s, and missing required props + of course, regression styles and childProps * [EuiDatePopoverButton] Add it renders unit test and shouldRenderCustomStyles * [EuiHeader] Add shouldRenderCustomStyles regression tests * [EuiResizablePanel] Add unit tests, fix location of passed `style` prop - the current merging of `styles` doesn't make sense given `wrapperProps` and the location of `...rest` + have to export `customStyles` to support EuiResizableWrapper's context requirement - nb - the context isn't actually _required_ per se and seems to have a legit fallback, but we added a manual throw detection, so alas * fix changelog id
- Loading branch information
Constance
authored
Sep 21, 2022
1 parent
deabfa9
commit b3327d7
Showing
15 changed files
with
221 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
...ate_picker/super_date_picker/date_popover/__snapshots__/date_popover_button.test.tsx.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`EuiSuperUpdateButton renders 1`] = ` | ||
<div> | ||
<div | ||
class="euiPopover testClass1 testClass2 emotion-euiPopover" | ||
data-test-subj="test subject string" | ||
> | ||
<div | ||
class="euiPopover__anchor css-zih94u-render" | ||
> | ||
<button | ||
class="euiDatePopoverButton euiDatePopoverButton--start" | ||
data-test-subj="superDatePickerstartDatePopoverButton" | ||
title="" | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
`; |
49 changes: 49 additions & 0 deletions
49
src/components/date_picker/super_date_picker/date_popover/date_popover_button.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
|
||
import { requiredProps } from '../../../../test'; | ||
import { shouldRenderCustomStyles } from '../../../../test/internal'; | ||
|
||
import { EuiDatePopoverButton } from './date_popover_button'; | ||
|
||
const noop = () => {}; | ||
|
||
describe('EuiSuperUpdateButton', () => { | ||
const props = { | ||
...requiredProps, | ||
value: '', | ||
dateFormat: '', | ||
timeFormat: '', | ||
timeOptions: { | ||
timeTenseOptions: [], | ||
timeUnitsOptions: [], | ||
relativeOptions: [], | ||
relativeRoundingLabels: {} as any, | ||
refreshUnitsOptions: [], | ||
commonDurationRanges: [], | ||
}, | ||
onChange: noop, | ||
onPopoverClose: noop, | ||
onPopoverToggle: noop, | ||
position: 'start' as const, | ||
isOpen: false, | ||
}; | ||
|
||
shouldRenderCustomStyles(<EuiDatePopoverButton {...props} />, { | ||
childProps: ['buttonProps'], | ||
}); | ||
|
||
it('renders', () => { | ||
const { container } = render(<EuiDatePopoverButton {...props} />); | ||
|
||
expect(container).toMatchSnapshot(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/components/resizable_container/__snapshots__/resizable_panel.test.tsx.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`EuiResizablePanel renders 1`] = ` | ||
<div> | ||
<div | ||
class="euiResizablePanel euiResizablePanel--middle" | ||
id="resizable-panel_generated-id" | ||
style="width: 100%; height: 0%;" | ||
> | ||
<div | ||
aria-label="aria-label" | ||
class="euiPanel euiPanel--transparent euiPanel--paddingMedium euiResizablePanel__content euiResizablePanel__content--scrollable testClass1 testClass2 emotion-euiPanel-grow-none-m-transparent" | ||
data-test-subj="test subject string" | ||
> | ||
Content | ||
</div> | ||
</div> | ||
</div> | ||
`; |
Oops, something went wrong.