import * as __WEBPACK_EXTERNAL_MODULE__storybook_test__ from "@storybook/test";
import * as __WEBPACK_EXTERNAL_MODULE__PasswordInput_mjs__ from "./PasswordInput.mjs";
const meta = {
    title: 'Components/Inputs/PasswordInput',
    component: __WEBPACK_EXTERNAL_MODULE__PasswordInput_mjs__["default"],
    argTypes: {
        onChange: {
            action: 'changed'
        },
        onBlur: {
            action: 'blurred'
        }
    },
    parameters: {
        design: {
            type: 'figma',
            url: 'https://www.figma.com/file/bJcVrZNilxa06jYuVCGWYd/Redpanda-Design-System-2023?type=design&node-id=23-331&mode=design&t=cVtmR0UCPQ2Em08Q-4'
        }
    }
};
/* ESM default export */ const PasswordInput_stories_rslib_entry_ = meta;
const Default = {
    args: {
        name: 'password'
    },
    play: async ({ canvasElement, step })=>{
        const canvas = (0, __WEBPACK_EXTERNAL_MODULE__storybook_test__.within)(canvasElement);
        await step('Check defaults', async ()=>{
            await (0, __WEBPACK_EXTERNAL_MODULE__storybook_test__.waitFor)(()=>{
                (0, __WEBPACK_EXTERNAL_MODULE__storybook_test__.expect)(canvas.getByTestId('password_field')).toBeVisible();
                (0, __WEBPACK_EXTERNAL_MODULE__storybook_test__.expect)(canvas.getByTestId('password-input-toggle')).toBeVisible();
            });
        });
        __WEBPACK_EXTERNAL_MODULE__storybook_test__.fireEvent.change(canvas.getByTestId('password_field'), {
            target: {
                value: 'asdf'
            }
        });
        await step('Initially the password should not be shown', async ()=>{
            await (0, __WEBPACK_EXTERNAL_MODULE__storybook_test__.waitFor)(()=>{
                (0, __WEBPACK_EXTERNAL_MODULE__storybook_test__.expect)(canvas.getByTestId('password_field').getAttribute('type')).toEqual('password');
                (0, __WEBPACK_EXTERNAL_MODULE__storybook_test__.expect)(canvas.getByTestId('password_field')).toHaveValue('asdf');
            });
        });
        __WEBPACK_EXTERNAL_MODULE__storybook_test__.fireEvent.click(canvas.getByTestId('password-input-toggle'));
        await step('Toggling visibility should reveal password', async ()=>{
            await (0, __WEBPACK_EXTERNAL_MODULE__storybook_test__.waitFor)(()=>{
                (0, __WEBPACK_EXTERNAL_MODULE__storybook_test__.expect)(canvas.getByTestId('password_field').getAttribute('type')).toEqual('text');
                (0, __WEBPACK_EXTERNAL_MODULE__storybook_test__.expect)(canvas.getByTestId('password_field')).toHaveValue('asdf');
                (0, __WEBPACK_EXTERNAL_MODULE__storybook_test__.expect)(canvas.getByTestId('password_field')).toHaveDisplayValue([
                    'asdf'
                ]);
            });
        });
    }
};
const NoEyeIndicator = {
    args: {
        name: 'password',
        showEyeIndicator: false
    },
    play: async ({ canvasElement, step })=>{
        const canvas = (0, __WEBPACK_EXTERNAL_MODULE__storybook_test__.within)(canvasElement);
        await step('Check defaults', async ()=>{
            (0, __WEBPACK_EXTERNAL_MODULE__storybook_test__.expect)(canvas.getByTestId('password_field')).toBeVisible();
            (0, __WEBPACK_EXTERNAL_MODULE__storybook_test__.expect)(canvas.getByTestId('password-input-toggle')).toHaveTextContent('Show');
        });
        __WEBPACK_EXTERNAL_MODULE__storybook_test__.fireEvent.click(canvas.getByTestId('password-input-toggle'));
        await step('Should change visibility toggle text', async ()=>{
            await (0, __WEBPACK_EXTERNAL_MODULE__storybook_test__.waitFor)(()=>{
                (0, __WEBPACK_EXTERNAL_MODULE__storybook_test__.expect)(canvas.getByTestId('password-input-toggle')).toHaveTextContent('Hide');
            });
        });
    }
};
export { Default, NoEyeIndicator, PasswordInput_stories_rslib_entry_ as default };
