Skip to content
This repository has been archived by the owner on Jan 7, 2022. It is now read-only.

Commit

Permalink
On open popup blur input
Browse files Browse the repository at this point in the history
  • Loading branch information
mariomka committed Jan 18, 2018
1 parent 47c8fca commit 5155ac7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Datetime.vue
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,9 @@ export default {
this.$emit('input', date ? date.toISO() : '')
},
open () {
open (event) {
event.target.blur()
this.isOpen = true
},
close () {
Expand Down
15 changes: 15 additions & 0 deletions test/specs/Datetime.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,21 @@ describe('Datetime.vue', function () {
})
})

it('should blur input when open popup', function (done) {
const vm = createVM(this,
`<Datetime></Datetime>`,
{
components: { Datetime }
})

vm.$('.vdatetime-input').focus()

setTimeout(() => {
expect(document.activeElement.isEqualNode(vm.$('.vdatetime-input'))).to.be.false
done()
}, 50)
})

it('should close when clicking the overlay', function (done) {
const vm = createVM(this,
`<Datetime></Datetime>`,
Expand Down

0 comments on commit 5155ac7

Please sign in to comment.