|
@@ -261,6 +261,33 @@ describe('DatePicker', () => {
|
|
|
}, DELAY);
|
|
|
});
|
|
|
|
|
|
+ it('nuke invalid input on close', done => {
|
|
|
+ vm = createVue({
|
|
|
+ template: '<el-date-picker v-model="value" value-format="yyyy-MM-dd" ref="compo" />',
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ value: '2010-10-01'
|
|
|
+ };
|
|
|
+ }
|
|
|
+ }, true);
|
|
|
+
|
|
|
+ const compo = vm.$refs.compo;
|
|
|
+ const input = compo.$el.querySelector('input');
|
|
|
+ input.blur();
|
|
|
+ input.focus();
|
|
|
+
|
|
|
+ setTimeout(_ => {
|
|
|
+ compo.userInput = 'abc';
|
|
|
+ compo.handleChange(); // simplified test
|
|
|
+ compo.handleClose();
|
|
|
+ setTimeout(_ => {
|
|
|
+ expect(input.value).to.equal('2010-10-01');
|
|
|
+ expect(vm.value).to.equal('2010-10-01');
|
|
|
+ done();
|
|
|
+ }, DELAY);
|
|
|
+ }, DELAY);
|
|
|
+ });
|
|
|
+
|
|
|
it('select datetime with defaultTime', done => {
|
|
|
vm = createVue({
|
|
|
template: `
|