From 922ecaebbf58c561d8d707b3ac14cf55ff48ad29 Mon Sep 17 00:00:00 2001 From: Jimmy Jia Date: Sun, 24 Jan 2016 14:39:01 -0500 Subject: [PATCH] [fixed] Allow overriding aria-label on toggle --- src/SplitButton.js | 9 +++++++-- test/SplitButtonSpec.js | 17 +++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/SplitButton.js b/src/SplitButton.js index 6f68052c41..adf29fe792 100644 --- a/src/SplitButton.js +++ b/src/SplitButton.js @@ -14,6 +14,7 @@ class SplitButton extends React.Component { onClick, target, href, + toggleLabel, bsSize, bsStyle, ...props } = this.props; @@ -37,7 +38,7 @@ class SplitButton extends React.Component { {title} { assert.equal(linkElement.target, '_blank'); }); + it('should set aria-label on toggle from title', () => { + const instance = ReactTestUtils.renderIntoDocument(simple); + + const toggleNode = ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'dropdown-toggle'); + expect(toggleNode.getAttribute('aria-label')).to.equal('Title'); + }); + + it('should set aria-label on toggle from toggleLabel', () => { + const instance = ReactTestUtils.renderIntoDocument( + + Item 1 + + ); + + const toggleNode = ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'dropdown-toggle'); + expect(toggleNode.getAttribute('aria-label')).to.equal('Label'); + }); });