diff --git a/src/Alert.js b/src/Alert.js
index bd2d97fe5b..f3d35a6a5d 100644
--- a/src/Alert.js
+++ b/src/Alert.js
@@ -24,9 +24,20 @@ const Alert = React.createClass({
+ );
+ },
+
+ renderSrOnlyDismissButton() {
+ return (
+
);
},
@@ -41,6 +52,7 @@ const Alert = React.createClass({
{isDismissable ? this.renderDismissButton() : null}
{this.props.children}
+ {isDismissable ? this.renderSrOnlyDismissButton() : null}
);
},
diff --git a/test/AlertSpec.js b/test/AlertSpec.js
index c667c25819..93cb445098 100644
--- a/test/AlertSpec.js
+++ b/test/AlertSpec.js
@@ -81,16 +81,16 @@ describe('Alert', function () {
assert.equal(React.findDOMNode(instance).getAttribute('role'), 'alert');
});
- it('Should have add ARIAs to button', function () {
+ it('Should call onDismiss callback when the sr-only dismiss link is activated', function(done) {
+ let doneOp = function () {
+ done();
+ };
let instance = ReactTestUtils.renderIntoDocument(
- {}} closeLabel='close'>Message
+
+ Message
+
);
-
- let button = ReactTestUtils.findRenderedDOMComponentWithTag(instance, 'button');
-
- assert.equal(React.findDOMNode(button).getAttribute('aria-label'), 'close');
- assert.equal(React.findDOMNode(button).children[0].getAttribute('aria-hidden'), 'true');
+ ReactTestUtils.Simulate.click(React.findDOMNode(instance).getElementsByClassName('sr-only')[0]);
});
-
});
});