InputNumber: add select method (#13286)

* Input: add test for `select` method

* InputNumber: add `select` method
This commit is contained in:
st-sloth
2018-11-05 16:21:24 +05:00
committed by hetech
parent f8a27565b0
commit 9d09d0dbf4
6 changed files with 65 additions and 0 deletions

View File

@@ -396,4 +396,35 @@ describe('InputNumber', () => {
done();
});
});
describe('InputNumber Methods', () => {
it('method:select', done => {
const testContent = '123';
vm = createVue({
template: `
<el-input-number
ref="inputNumComp"
:value="${testContent}"
/>
`
}, true);
expect(vm.$refs.inputNumComp.$refs.input.$refs.input.selectionStart)
.to.equal(testContent.length);
expect(vm.$refs.inputNumComp.$refs.input.$refs.input.selectionEnd)
.to.equal(testContent.length);
vm.$refs.inputNumComp.select();
vm.$nextTick(_ => {
expect(vm.$refs.inputNumComp.$refs.input.$refs.input.selectionStart)
.to.equal(0);
expect(vm.$refs.inputNumComp.$refs.input.$refs.input.selectionEnd)
.to.equal(testContent.length);
done();
});
});
});
});