test: icon-button
This commit is contained in:
parent
7ed463f59b
commit
71c93afad7
1 changed files with 24 additions and 0 deletions
24
src/components/icon-button.cy.tsx
Normal file
24
src/components/icon-button.cy.tsx
Normal file
|
@ -0,0 +1,24 @@
|
|||
/* eslint-disable @typescript-eslint/no-unused-expressions */
|
||||
import React from 'react';
|
||||
import { IconButton } from './icon-button';
|
||||
import { faOpenid } from '@fortawesome/free-brands-svg-icons';
|
||||
|
||||
describe('<IconButton />', () => {
|
||||
it('renders', () => {
|
||||
cy.mount(<IconButton icon={faOpenid}>Button</IconButton>);
|
||||
});
|
||||
|
||||
it('is clickable', () => {
|
||||
const onClick = cy.stub();
|
||||
cy.mount(
|
||||
<IconButton icon={faOpenid} onClick={onClick} data-cy='icon-button'>
|
||||
Button
|
||||
</IconButton>,
|
||||
);
|
||||
cy.getBySel('icon-button')
|
||||
.click()
|
||||
.then(() => {
|
||||
expect(onClick).to.be.calledOnce;
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue