-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6d4c3af
commit 7ade379
Showing
1 changed file
with
72 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { cleanup, render } from '@testing-library/react'; | ||
import { ReactMultiEmail } from '../react-multi-email'; | ||
import React from 'react'; | ||
|
||
afterEach(cleanup); | ||
|
||
describe('ReactMultiEmail autoComplete prop Test', () => { | ||
it('autoComplete avaliable value', () => { | ||
render( | ||
<ReactMultiEmail | ||
id='inputTarget' | ||
autoComplete='on' | ||
getLabel={(email, index, removeEmail) => { | ||
return ( | ||
<div data-tag key={index}> | ||
<div data-tag-item>{email}</div> | ||
<span data-tag-handle onClick={() => removeEmail(index)}> | ||
× | ||
</span> | ||
</div> | ||
); | ||
}} | ||
/>, | ||
); | ||
|
||
const inputTarget = document.getElementById('inputTarget'); | ||
expect(!!inputTarget?.getAttribute('autoComplete')).toBe(true); | ||
}); | ||
|
||
it('autoComplete undefined', () => { | ||
render( | ||
<ReactMultiEmail | ||
id='inputTarget' | ||
getLabel={(email, index, removeEmail) => { | ||
return ( | ||
<div data-tag key={index}> | ||
<div data-tag-item>{email}</div> | ||
<span data-tag-handle onClick={() => removeEmail(index)}> | ||
× | ||
</span> | ||
</div> | ||
); | ||
}} | ||
/>, | ||
); | ||
|
||
const inputTarget = document.getElementById('inputTarget'); | ||
expect(!!inputTarget?.getAttribute('autoComplete')).toBe(false); | ||
}); | ||
|
||
it('autoComplete falsy string', () => { | ||
render( | ||
<ReactMultiEmail | ||
id='inputTarget' | ||
autoComplete='' | ||
getLabel={(email, index, removeEmail) => { | ||
return ( | ||
<div data-tag key={index}> | ||
<div data-tag-item>{email}</div> | ||
<span data-tag-handle onClick={() => removeEmail(index)}> | ||
× | ||
</span> | ||
</div> | ||
); | ||
}} | ||
/>, | ||
); | ||
|
||
const inputTarget = document.getElementById('inputTarget'); | ||
expect(!!inputTarget?.getAttribute('autoComplete')).toBe(false); | ||
}); | ||
}); |
7ade379
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
react-multi-email – ./
react-multi-email-git-master-axframe.vercel.app
react-multi-email.vercel.app
react-multi-email-axframe.vercel.app