Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: mturoci <[email protected]>
  • Loading branch information
VijithaEkanayake and mturoci authored Dec 18, 2020
1 parent 0b50eb3 commit 6737d9f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions ui/src/textbox.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ describe('Textbox.tsx', () => {
expect(syncMock).toBeCalled()
})

it('Does not call sync on key up - When the key is not Enter key', () => {
it('Does not call sync when key pressed is not enter', () => {
const { getByTestId } = render(<XTextbox model={textboxProps} />)
const syncMock = jest.fn()

Expand All @@ -122,7 +122,7 @@ describe('Textbox.tsx', () => {
expect(syncMock).not.toBeCalled()
})

it('Does not call sync on key up - When multiline is true', () => {
it('Does not call sync on enter - multiline is true', () => {
const { getByTestId } = render(<XTextbox model={{ ...textboxProps, multiline: true}} />)
const syncMock = jest.fn()

Expand Down
8 changes: 4 additions & 4 deletions ui/src/textbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ export const
qd.args[m.name] = v ?? (m.value || '')
if (m.trigger) qd.sync()
},
onKeyUp = ( event: React.KeyboardEvent<HTMLInputElement>, v?: string) => {
if ((event).key == "Enter" && event.target instanceof HTMLInputElement) {
v = v || (event.target as HTMLInputElement).value
onKeyUp = ( {key, target}: React.KeyboardEvent<HTMLInputElement>, v?: S) => {
if (key == 'Enter' && target instanceof HTMLInputElement) {
v = v || target.value
qd.args[m.name] = v ?? (m.value || '')
qd.sync()
}
Expand Down Expand Up @@ -121,4 +121,4 @@ export const
)

return { render }
})
})

0 comments on commit 6737d9f

Please sign in to comment.