Skip to content

Commit f2eb398

Browse files
committed
test(input): focus & blur api
1 parent d4856f2 commit f2eb398

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

test/unit/specs/input.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,12 @@ describe('Input.vue', () => {
148148
}
149149
})
150150
const input = vm.$el.querySelector('input')
151-
input.focus()
151+
vm.focus()
152152
setTimeout(() => {
153153
expect(focusHandler)
154154
.to.be.calledOnce
155155
input.value = 'new value'
156-
input.blur()
156+
vm.blur()
157157
const e = createEvent('', 'change')
158158
input.dispatchEvent(e)
159159
setTimeout(() => {

test/unit/specs/textarea.spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ describe('Textarea.vue', () => {
4040
})
4141
it('should expand when focus, fold when blur', (done) => {
4242
vm = createTextarea(1)
43-
vm.$el.querySelector('textarea').focus()
43+
vm.focus()
4444
setTimeout(() => {
4545
expect(vm.$el.offsetHeight)
4646
.to.equal(80)
4747
vm.textareaValue = ''
48-
vm.$el.querySelector('textarea').blur()
48+
vm.blur()
4949
setTimeout(() => {
5050
expect(vm.$el.offsetHeight)
5151
.to.equal(40)
@@ -55,7 +55,7 @@ describe('Textarea.vue', () => {
5555
})
5656
it('should has remain when focus', (done) => {
5757
vm = createTextarea(1)
58-
vm.$el.querySelector('textarea').focus()
58+
vm.focus()
5959
setTimeout(() => {
6060
expect(vm.$el.querySelector('.cube-textarea-indicator').innerText)
6161
.to.equal('56')

0 commit comments

Comments
 (0)