Skip to content

Commit

Permalink
Add unit tests for new button prop.
Browse files Browse the repository at this point in the history
  • Loading branch information
tellthemachines committed Jan 13, 2021
1 parent ce5a39b commit a46769d
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions packages/components/src/button/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,28 @@ describe( 'Button', () => {
expect( iconButton.prop( 'aria-label' ) ).toBe( 'Custom' );
} );

it( 'should support adding aria-describedby text', () => {
const buttonDescription = shallow(
<Button describedBy="Description text" />
)
.find( 'VisuallyHidden' )
.shallow()
.text();
expect( buttonDescription ).toBe( 'Description text' );
} );

it( 'should populate tooltip with describedBy content', () => {
const buttonTooltip = shallow(
<Button
describedBy="Description text"
label="Label"
icon={ plusCircle }
/>
).find( 'Tooltip' );

expect( buttonTooltip.prop( 'text' ) ).toBe( 'Description text' );
} );

it( 'should allow tooltip disable', () => {
const iconButton = shallow(
<Button
Expand Down

0 comments on commit a46769d

Please sign in to comment.