import React from 'react';
import { render, fireEvent } from 'react-testing-library';

import PasswordInput from './PasswordInput';

describe('PasswordInput component', () => {
    const value = 'panda';

    it('should display a password input with a toggle button', () => {
        const { container } = render(<PasswordInput value={value} />);
        const inputNode = container.querySelector('input');
        const buttonNode = container.querySelector('button');

        expect(inputNode).not.toBe(null);
        expect(buttonNode).not.toBe(null);
        expect(inputNode.getAttribute('type')).toBe('password');
    });

    it('should display the password', () => {
        const { container } = render(<PasswordInput value={value} />);
        const inputNode = container.querySelector('input');
        const buttonNode = container.querySelector('button');

        fireEvent.click(buttonNode);
        expect(inputNode.getAttribute('type')).toBe('text');
    });
});

@@ -967,13 +967,379 @@
 %0A    %7D);
+%0A%0A    it('should disable input and button', () =%3E %7B%0A        const %7B container %7D = render(%3CPasswordInput disabled=%7Btrue%7D /%3E);%0A        const inputNode = container.querySelector('input');%0A        const buttonNode = container.querySelector('button');%0A%0A        expect(inputNode).toHaveAttribute('disabled');%0A        expect(buttonNode).toHaveAttribute('disabled');%0A    %7D);
 %0A%7D);%0A

Add test for password input component