-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(v5): Update CloseButton (#5460)
* feat(v5): Update CloseButton - Added white variant - Remove inner span label in favor of aria-label attrib - Remove inner × label since it's now using a built-in svg - Enable CloseButton tests (previously not working) - Added closeVariant prop to Alert, ToastHeader, ModalHeader * docs(CloseButton): add component page (#5474) Co-authored-by: David Beitey <[email protected]>
- Loading branch information
Showing
18 changed files
with
198 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import React from 'react'; | ||
import { mount } from 'enzyme'; | ||
|
||
import CloseButton from '../src/CloseButton'; | ||
|
||
describe('<CloseButton>', () => { | ||
it('Should output a button', () => { | ||
mount(<CloseButton />) | ||
.find('button') | ||
.should.have.length(1); | ||
}); | ||
|
||
it('Should have type=button by default', () => { | ||
mount(<CloseButton />) | ||
.find('button') | ||
.getDOMNode() | ||
.getAttribute('type') | ||
.should.equal('button'); | ||
}); | ||
|
||
it('Should have class .btn-close', () => { | ||
mount(<CloseButton />).assertSingle('.btn-close'); | ||
}); | ||
|
||
it('Should call onClick callback', (done) => { | ||
mount(<CloseButton onClick={() => done()} />).simulate('click'); | ||
}); | ||
|
||
it('Should have a aria-label defaulted to "Close"', () => { | ||
mount(<CloseButton />) | ||
.find('button') | ||
.getDOMNode() | ||
.getAttribute('aria-label') | ||
.should.equal('Close'); | ||
}); | ||
|
||
it('Should allow override of aria-label', () => { | ||
mount(<CloseButton aria-label="My Close" />) | ||
.find('button') | ||
.getDOMNode() | ||
.getAttribute('aria-label') | ||
.should.equal('My Close'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.