mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #11002 from overleaf/msm-fix-email-suggestion
[web] Fix clearing suggestions in email input GitOrigin-RevId: c821114e2112bf066f4ee5f01304321db983bc4e
This commit is contained in:
parent
c87772d732
commit
95bb5ca4e4
2 changed files with 6 additions and 4 deletions
|
@ -148,7 +148,9 @@ function Input({ onChange, handleAddNewEmail }: InputProps) {
|
|||
)
|
||||
|
||||
useEffect(() => {
|
||||
if (suggestion && inputValue && !suggestion.startsWith(inputValue)) {
|
||||
if (!inputValue) {
|
||||
setSuggestion(null)
|
||||
} else if (suggestion && !suggestion.startsWith(inputValue)) {
|
||||
setSuggestion(null)
|
||||
}
|
||||
}, [suggestion, inputValue])
|
||||
|
|
|
@ -146,11 +146,11 @@ describe('<AddEmailInput/>', function () {
|
|||
).to.equal(true)
|
||||
})
|
||||
|
||||
it('should clear the suggestion when the potential domain match is completely deleted', function () {
|
||||
it('should clear the suggestion when the potential domain match is completely deleted', async function () {
|
||||
await screen.findByText('user@domain.edu')
|
||||
fireEvent.change(screen.getByRole('textbox'), {
|
||||
target: { value: 'user@' },
|
||||
target: { value: '' },
|
||||
})
|
||||
expect(onChangeStub.calledWith('user@')).to.equal(true)
|
||||
expect(screen.queryByText('user@domain.edu')).to.be.null
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in a new issue