Skip to content

Commit

Permalink
Test/autoComplete (#164)
Browse files Browse the repository at this point in the history
  • Loading branch information
HyeongSeoku authored Oct 23, 2023
1 parent 6d4c3af commit 7ade379
Showing 1 changed file with 72 additions and 0 deletions.
72 changes: 72 additions & 0 deletions test/autoComplete.test.tsx
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);
});
});

1 comment on commit 7ade379

@vercel
Copy link

@vercel vercel bot commented on 7ade379 Oct 23, 2023

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

Please sign in to comment.