Skip to content

Commit

Permalink
test: add test to new handleChange function
Browse files Browse the repository at this point in the history
  • Loading branch information
KarineBrandelli committed Apr 3, 2024
1 parent 59ca8bf commit 1e73f7d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ exports[`TextField should match snapshot 1`] = `
>
<div
aria-haspopup="listbox"
class="MuiSelect-root MuiSelect-select MuiSelect-selectMenu MuiSelect-outlined MuiInputBase-input MuiOutlinedInput-input makeStyles-outlinedInput-100 MuiInputBase-inputAdornedEnd MuiOutlinedInput-inputAdornedEnd"
class="MuiSelect-root MuiSelect-select MuiSelect-selectMenu MuiSelect-outlined MuiInputBase-input MuiOutlinedInput-input makeStyles-outlinedInput-112 MuiInputBase-inputAdornedEnd MuiOutlinedInput-inputAdornedEnd"
role="button"
tabindex="0"
>
Expand All @@ -31,7 +31,7 @@ exports[`TextField should match snapshot 1`] = `
/>
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSelect-icon MuiSelect-iconOutlined makeStyles-iconOutlined-104"
class="MuiSvgIcon-root MuiSelect-icon MuiSelect-iconOutlined makeStyles-iconOutlined-116"
focusable="false"
viewBox="0 0 24 24"
>
Expand Down Expand Up @@ -71,11 +71,11 @@ exports[`TextField should match snapshot 1`] = `
</div>
<fieldset
aria-hidden="true"
class="PrivateNotchedOutline-root-105 MuiOutlinedInput-notchedOutline"
class="PrivateNotchedOutline-root-117 MuiOutlinedInput-notchedOutline"
style="padding-left: 8px;"
>
<legend
class="PrivateNotchedOutline-legend-106"
class="PrivateNotchedOutline-legend-118"
style="width: 0.01px;"
>
<span>
Expand Down
12 changes: 12 additions & 0 deletions src/core/inputs/text-field/text-field.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,18 @@ describe('TextField', () => {
})
})

it('should remove emojis if typed', () => {
render(<TextField inputProps={{ placeholder: 'Description' }} />)

const inputElement = screen.getByPlaceholderText(
'Description'
) as HTMLInputElement

fireEvent.change(inputElement, { target: { value: 'Hello World😀' } })

expect(inputElement.value).toBe('Hello World')
})

it('should match snapshot', () => {
const { container } = render(
<TextField
Expand Down

0 comments on commit 1e73f7d

Please sign in to comment.