From 51555b0bde44b4120367dc6c2c07268d3c2d6f4e Mon Sep 17 00:00:00 2001 From: HyeongSeok Date: Thu, 19 Oct 2023 15:15:22 +0900 Subject: [PATCH] Test/autoComplete --- test/autoComplete.test.tsx | 72 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 test/autoComplete.test.tsx diff --git a/test/autoComplete.test.tsx b/test/autoComplete.test.tsx new file mode 100644 index 0000000..8a4ea93 --- /dev/null +++ b/test/autoComplete.test.tsx @@ -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( + { + return ( +
+
{email}
+ removeEmail(index)}> + × + +
+ ); + }} + />, + ); + + const inputTarget = document.getElementById('inputTarget'); + expect(!!inputTarget?.getAttribute('autoComplete')).toBe(true); + }); + + it('autoComplete undefined', () => { + render( + { + return ( +
+
{email}
+ removeEmail(index)}> + × + +
+ ); + }} + />, + ); + + const inputTarget = document.getElementById('inputTarget'); + expect(!!inputTarget?.getAttribute('autoComplete')).toBe(false); + }); + + it('autoComplete falsy string', () => { + render( + { + return ( +
+
{email}
+ removeEmail(index)}> + × + +
+ ); + }} + />, + ); + + const inputTarget = document.getElementById('inputTarget'); + expect(!!inputTarget?.getAttribute('autoComplete')).toBe(false); + }); +});