mirror of
https://github.com/apache/superset.git
synced 2026-04-17 07:05:04 +00:00
fix auto select override pre-selected value bug (#2745)
auto select should only apply to cases where select control doesn't have pre-selected value prop. If select control has pre-selected value (passed in from value prop), auto select first avaliable options should not apply.
This commit is contained in:
@@ -66,5 +66,17 @@ describe('AsyncSelect', () => {
|
||||
expect(spy.callCount).to.equal(1);
|
||||
expect(spy.calledWith(wrapper.instance().state.options[0])).to.equal(true);
|
||||
});
|
||||
it('should not auto select when value prop is set', () => {
|
||||
const wrapper = mount(
|
||||
<AsyncSelect {...mockedProps} value={2} autoSelect />,
|
||||
);
|
||||
const spy = sinon.spy(wrapper.instance(), 'onChange');
|
||||
|
||||
server.respond();
|
||||
|
||||
expect(spy.callCount).to.equal(0);
|
||||
expect(wrapper.find(Select)).to.have.length(1);
|
||||
expect(wrapper.find('.Select-value-label').children().first().text()).to.equal('another');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user