-
Notifications
You must be signed in to change notification settings - Fork 841
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EuiFormControlLayoutCustomIcon
to TS (#1956)
* `EuiFormControlLayoutCustomIcon` to TS * `EuiFormControlLayoutCustomIcon` code review
- Loading branch information
1 parent
2adc03b
commit 5c3ed7e
Showing
5 changed files
with
93 additions
and
17 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
36 changes: 36 additions & 0 deletions
36
...ents/form/form_control_layout/__snapshots__/form_control_layout_custom_icon.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,36 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`EuiFormControlLayoutCustomIcon is rendered as button 1`] = ` | ||
<button | ||
class="euiFormControlLayoutCustomIcon customClass euiFormControlLayoutCustomIcon--clickable" | ||
data-test-subj="customIcon" | ||
type="button" | ||
> | ||
<svg | ||
aria-hidden="true" | ||
class="euiIcon euiIcon--medium euiIcon-isLoading euiFormControlLayoutCustomIcon__icon" | ||
focusable="false" | ||
height="16" | ||
viewBox="0 0 16 16" | ||
width="16" | ||
xmlns="http://www.w3.org/2000/svg" | ||
/> | ||
</button> | ||
`; | ||
|
||
exports[`EuiFormControlLayoutCustomIcon is rendered as span 1`] = ` | ||
<span | ||
class="euiFormControlLayoutCustomIcon customClass" | ||
data-test-subj="customIcon" | ||
> | ||
<svg | ||
aria-hidden="true" | ||
class="euiIcon euiIcon--medium euiIcon-isLoading euiFormControlLayoutCustomIcon__icon" | ||
focusable="false" | ||
height="16" | ||
viewBox="0 0 16 16" | ||
width="16" | ||
xmlns="http://www.w3.org/2000/svg" | ||
/> | ||
</span> | ||
`; |
30 changes: 30 additions & 0 deletions
30
src/components/form/form_control_layout/form_control_layout_custom_icon.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,30 @@ | ||
import React from 'react'; | ||
import { render } from 'enzyme'; | ||
import { EuiFormControlLayoutCustomIcon } from './form_control_layout_custom_icon'; | ||
|
||
describe('EuiFormControlLayoutCustomIcon', () => { | ||
test('is rendered as button', () => { | ||
const props = { | ||
onClick: () => null, | ||
className: 'customClass', | ||
'data-test-subj': 'customIcon', | ||
type: 'alert', | ||
iconRef: 'icon', | ||
}; | ||
const component = render(<EuiFormControlLayoutCustomIcon {...props} />); | ||
|
||
expect(component).toMatchSnapshot(); | ||
}); | ||
|
||
test('is rendered as span', () => { | ||
const props = { | ||
className: 'customClass', | ||
'data-test-subj': 'customIcon', | ||
type: 'alert', | ||
iconRef: 'icon', | ||
}; | ||
const component = render(<EuiFormControlLayoutCustomIcon {...props} />); | ||
|
||
expect(component).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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,14 @@ | ||
import { EuiFormControlLayoutClearButton as FormControlLayoutClearButton } from './form_control_layout_clear_button'; | ||
import { EuiFormControlLayoutCustomIcon as FormControlLayoutCustomIcon } from './form_control_layout_custom_icon'; | ||
|
||
declare module '@elastic/eui' { | ||
/** | ||
* @see './form_control_layout_clear_button.js' | ||
*/ | ||
export const EuiFormControlLayoutClearButton: typeof FormControlLayoutClearButton; | ||
|
||
/** | ||
* @see './form_control_layout_custom_icon.js' | ||
*/ | ||
export const EuiFormControlLayoutCustomIcon: typeof FormControlLayoutCustomIcon; | ||
} |