How to use the @testing-library/svelte.fireEvent.focus function in @testing-library/svelte

To help you get started, we’ve selected a few @testing-library/svelte examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wix-incubator / unidriver / adapters / jsdom-svelte / src / index.ts View on Github external
click: async () => {
            const el = await elem();
            await fireEvent.mouseDown(el);

            if (elementIsFocusable(el)) {
                if (document.activeElement != el) {
                    if (document.activeElement) {
                        fireEvent.blur(document.activeElement);
                    }

                    if (!el.disabled) {
                        el.focus();
                        await fireEvent.focus(el);
                    }
                }
            }


            await fireEvent.mouseUp(el);
            await fireEvent.click(el);

            if (isCheckable(el)) {
                handleCheckableInput(el as HTMLInputElement);
            }
        },
        mouse: {