menu

Testing Library

Simple and complete DOM testing utilities that encourage good testing practices.

Channels
Chat
view-forward
# All channels
view-forward
# General
view-forward
# General Help
view-forward
# Angular Help
view-forward
# Cypress Help
view-forward
# DOM Help
view-forward
# React Help
view-forward
# Svelte Help
view-forward
# TestCafe Help
view-forward
# Vue Help
view-forward
Team

Test the width of an element

January 16, 2020 at 1:34pm

Test the width of an element

January 16, 2020 at 1:34pm
How can i test the width of a the button when the button is clicked, or the isLoading property is true?
<Button
width={isLoading ? '80%' : '100%'}
>
Login
</Button>
....
const loginButton = queryByRole('button');
...
In jest is something like expect(loginButton.prop('width')).toBe('80%');