Skip to content

Commit f827757

Browse files
committed
allow SLDSPickList to return selected option object instead of just value string
1 parent 8cbfe23 commit f827757

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

components/SLDSPicklistBase/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ module.exports = React.createClass( {
8383
getValueByIndex(index){
8484
const option = this.props.options[index];
8585
if(option){
86-
return this.props.options[index].value;
86+
return this.props.options[index];
8787
}
8888
},
8989

tests/SLDSPicklistBase/picklistBase.test.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe('SLDSPicklistBase: ', function(){
1515
it('onSelect fires upon selection change', sinon.test(function() {
1616
let onSelectStub = this.stub();
1717
let options = [
18-
{"value" : '1', "label" : '1'}
18+
{"value" : '1', "label" : '1',, "extra1": 'extra1', "extra2" : { "prop1" : 'prop1', "prop2" : 'prop2'}
1919
];
2020

2121
let cmp = TestUtils.renderIntoDocument(
@@ -30,6 +30,6 @@ describe('SLDSPicklistBase: ', function(){
3030
clickOnItem(cmp, 0);
3131

3232
expect(onSelectStub.calledOnce).to.be.ok;
33-
expect(onSelectStub.calledWith('1')).to.be.ok;
33+
expect(onSelectStub.calledWith({"value" : '1', "label" : '1',, "extra1": 'extra1', "extra2" : { "prop1" : 'prop1', "prop2" : 'prop2'})).to.be.ok;
3434
}));
3535
});

0 commit comments

Comments
 (0)