mirror of
https://gitee.com/ant-design-vue/ant-design-vue.git
synced 2024-12-02 03:58:05 +08:00
fix: checkbox focus & blur not work
This commit is contained in:
parent
42431d39a2
commit
777d1d5dda
@ -1 +1 @@
|
||||
Subproject commit 156f6e903435aff90e130518d80dd676fae22c5d
|
||||
Subproject commit 46fbd8fd067c497a740594a1b8cc8e503fc94a8a
|
@ -17,25 +17,13 @@ describe('CheckboxGroup', () => {
|
||||
sync: false,
|
||||
},
|
||||
);
|
||||
wrapper
|
||||
.findAll('.ant-checkbox-input')
|
||||
.at(0)
|
||||
.trigger('change');
|
||||
wrapper.findAll('.ant-checkbox-input')[0].trigger('change');
|
||||
expect(onChange).toHaveBeenCalledWith(['Apple']);
|
||||
wrapper
|
||||
.findAll('.ant-checkbox-input')
|
||||
.at(1)
|
||||
.trigger('change');
|
||||
wrapper.findAll('.ant-checkbox-input')[1].trigger('change');
|
||||
expect(onChange).toHaveBeenCalledWith(['Apple', 'Pear']);
|
||||
wrapper
|
||||
.findAll('.ant-checkbox-input')
|
||||
.at(2)
|
||||
.trigger('change');
|
||||
wrapper.findAll('.ant-checkbox-input')[2].trigger('change');
|
||||
expect(onChange).toHaveBeenCalledWith(['Apple', 'Pear', 'Orange']);
|
||||
wrapper
|
||||
.findAll('.ant-checkbox-input')
|
||||
.at(1)
|
||||
.trigger('change');
|
||||
wrapper.findAll('.ant-checkbox-input')[1].trigger('change');
|
||||
expect(onChange).toHaveBeenCalledWith(['Apple', 'Orange']);
|
||||
});
|
||||
|
||||
@ -57,15 +45,9 @@ describe('CheckboxGroup', () => {
|
||||
sync: false,
|
||||
},
|
||||
);
|
||||
groupWrapper
|
||||
.findAll('.ant-checkbox-input')
|
||||
.at(0)
|
||||
.trigger('change');
|
||||
groupWrapper.findAll('.ant-checkbox-input')[0].trigger('change');
|
||||
expect(onChangeGroup).not.toBeCalled();
|
||||
groupWrapper
|
||||
.findAll('.ant-checkbox-input')
|
||||
.at(1)
|
||||
.trigger('change');
|
||||
groupWrapper.findAll('.ant-checkbox-input')[1].trigger('change');
|
||||
expect(onChangeGroup).not.toBeCalled();
|
||||
});
|
||||
|
||||
@ -87,15 +69,9 @@ describe('CheckboxGroup', () => {
|
||||
sync: false,
|
||||
},
|
||||
);
|
||||
groupWrapper
|
||||
.findAll('.ant-checkbox-input')
|
||||
.at(0)
|
||||
.trigger('change');
|
||||
groupWrapper.findAll('.ant-checkbox-input')[0].trigger('change');
|
||||
expect(onChangeGroup).toHaveBeenCalledWith(['Apple']);
|
||||
groupWrapper
|
||||
.findAll('.ant-checkbox-input')
|
||||
.at(1)
|
||||
.trigger('change');
|
||||
groupWrapper.findAll('.ant-checkbox-input')[1].trigger('change');
|
||||
expect(onChangeGroup).toHaveBeenCalledWith(['Apple']);
|
||||
});
|
||||
|
||||
@ -143,10 +119,7 @@ describe('CheckboxGroup', () => {
|
||||
);
|
||||
},
|
||||
});
|
||||
wrapper
|
||||
.findAll('.ant-checkbox-input')
|
||||
.at(0)
|
||||
.trigger('change');
|
||||
wrapper.findAll('.ant-checkbox-input')[0].trigger('change');
|
||||
expect(onChange).toBeCalled();
|
||||
expect(onChange.mock.calls[0][0].target.value).toEqual('my');
|
||||
});
|
||||
|
@ -45,8 +45,10 @@ export default {
|
||||
},
|
||||
mounted() {
|
||||
nextTick(() => {
|
||||
if (this.autofocus) {
|
||||
this.$refs.input && this.$refs.input.focus();
|
||||
if (process.env.NODE_ENV === 'test') {
|
||||
if (this.autofocus) {
|
||||
this.$refs.input && this.$refs.input.focus();
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
@ -103,12 +105,10 @@ export default {
|
||||
readonly,
|
||||
tabindex,
|
||||
autofocus,
|
||||
onFocus,
|
||||
onBlur,
|
||||
value,
|
||||
...others
|
||||
} = getOptionProps(this);
|
||||
const { class: className } = this.$attrs;
|
||||
const { class: className, onFocus, onBlur } = this.$attrs;
|
||||
const globalProps = Object.keys({ ...others, ...this.$attrs }).reduce((prev, key) => {
|
||||
if (key.substr(0, 5) === 'aria-' || key.substr(0, 5) === 'data-' || key === 'role') {
|
||||
prev[key] = others[key];
|
||||
@ -135,6 +135,8 @@ export default {
|
||||
...globalProps,
|
||||
onChange: this.handleChange,
|
||||
onClick: this.onClick,
|
||||
onFocus,
|
||||
onBlur,
|
||||
};
|
||||
|
||||
return (
|
||||
|
@ -4,7 +4,7 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import demo from '../antdv-demo/docs/cascader/demo/index';
|
||||
import demo from '../antdv-demo/docs/checkbox/demo/basic';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
|
Loading…
Reference in New Issue
Block a user