Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
serebrov committed Apr 11, 2021
1 parent 3ea8d26 commit 0ec7238
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 33 deletions.
62 changes: 31 additions & 31 deletions spec/keyboard-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,27 @@ describe('Picker keyboard control', () => {
})

it('Arrow down selects emoji below', () => {
expect(picker.vm.previewEmoji).toEqual(null)
expect(picker.vm.view.previewEmoji).toEqual(null)

const search = picker.find(Search)
const input = search.find('input')
input.trigger('click')

input.trigger('keydown.down')
expect(picker.vm.previewEmoji.native).toEqual('👍')
expect(picker.vm.previewEmojiCategory.id).toEqual('recent')
expect(picker.vm.view.previewEmoji.native).toEqual('👍')
expect(picker.vm.view.previewEmojiCategory.id).toEqual('recent')

input.trigger('keydown.down')
expect(picker.vm.previewEmoji.native).toEqual('😞')
expect(picker.vm.previewEmojiCategory.id).toEqual('recent')
expect(picker.vm.view.previewEmoji.native).toEqual('😞')
expect(picker.vm.view.previewEmojiCategory.id).toEqual('recent')

input.trigger('keydown.down')
expect(picker.vm.previewEmoji.native).toEqual('😀')
expect(picker.vm.previewEmojiCategory.id).toEqual('smileys')
expect(picker.vm.view.previewEmoji.native).toEqual('😀')
expect(picker.vm.view.previewEmojiCategory.id).toEqual('smileys')
})

it('Arrow down selects emoji above', () => {
expect(picker.vm.previewEmoji).toEqual(null)
expect(picker.vm.view.previewEmoji).toEqual(null)

const search = picker.find(Search)
const input = search.find('input')
Expand All @@ -47,40 +47,40 @@ describe('Picker keyboard control', () => {
input.trigger('keydown.down')
input.trigger('keydown.down')

expect(picker.vm.previewEmoji.native).toEqual('😀')
expect(picker.vm.previewEmojiCategory.id).toEqual('smileys')
expect(picker.vm.view.previewEmoji.native).toEqual('😀')
expect(picker.vm.view.previewEmojiCategory.id).toEqual('smileys')

input.trigger('keydown.up')
expect(picker.vm.previewEmoji.native).toEqual('😞')
expect(picker.vm.previewEmojiCategory.id).toEqual('recent')
expect(picker.vm.view.previewEmoji.native).toEqual('😞')
expect(picker.vm.view.previewEmojiCategory.id).toEqual('recent')

input.trigger('keydown.up')
expect(picker.vm.previewEmoji.native).toEqual('👍')
expect(picker.vm.previewEmojiCategory.id).toEqual('recent')
expect(picker.vm.view.previewEmoji.native).toEqual('👍')
expect(picker.vm.view.previewEmojiCategory.id).toEqual('recent')
})

it('Arrow right selects emoji on the right', () => {
expect(picker.vm.previewEmoji).toEqual(null)
expect(picker.vm.view.previewEmoji).toEqual(null)

const search = picker.find(Search)
const input = search.find('input')
input.trigger('click')

input.trigger('keydown.right')
expect(picker.vm.previewEmoji.native).toEqual('👍')
expect(picker.vm.previewEmojiCategory.id).toEqual('recent')
expect(picker.vm.view.previewEmoji.native).toEqual('👍')
expect(picker.vm.view.previewEmojiCategory.id).toEqual('recent')

input.trigger('keydown.right')
expect(picker.vm.previewEmoji.native).toEqual('😀')
expect(picker.vm.previewEmojiCategory.id).toEqual('recent')
expect(picker.vm.view.previewEmoji.native).toEqual('😀')
expect(picker.vm.view.previewEmojiCategory.id).toEqual('recent')

input.trigger('keydown.right')
expect(picker.vm.previewEmoji.native).toEqual('😘')
expect(picker.vm.previewEmojiCategory.id).toEqual('recent')
expect(picker.vm.view.previewEmoji.native).toEqual('😘')
expect(picker.vm.view.previewEmojiCategory.id).toEqual('recent')
})

it('Arrow left selects emoji on the left', () => {
expect(picker.vm.previewEmoji).toEqual(null)
expect(picker.vm.view.previewEmoji).toEqual(null)

const search = picker.find(Search)
const input = search.find('input')
Expand All @@ -90,20 +90,20 @@ describe('Picker keyboard control', () => {
input.trigger('keydown.right')
input.trigger('keydown.right')

expect(picker.vm.previewEmoji.native).toEqual('😘')
expect(picker.vm.previewEmojiCategory.id).toEqual('recent')
expect(picker.vm.view.previewEmoji.native).toEqual('😘')
expect(picker.vm.view.previewEmojiCategory.id).toEqual('recent')

input.trigger('keydown.left')
expect(picker.vm.previewEmoji.native).toEqual('😀')
expect(picker.vm.previewEmojiCategory.id).toEqual('recent')
expect(picker.vm.view.previewEmoji.native).toEqual('😀')
expect(picker.vm.view.previewEmojiCategory.id).toEqual('recent')

input.trigger('keydown.left')
expect(picker.vm.previewEmoji.native).toEqual('👍')
expect(picker.vm.previewEmojiCategory.id).toEqual('recent')
expect(picker.vm.view.previewEmoji.native).toEqual('👍')
expect(picker.vm.view.previewEmojiCategory.id).toEqual('recent')
})

it('Enter selects the emoji', () => {
expect(picker.vm.previewEmoji).toEqual(null)
expect(picker.vm.view.previewEmoji).toEqual(null)

const search = picker.find(Search)
const input = search.find('input')
Expand All @@ -113,8 +113,8 @@ describe('Picker keyboard control', () => {
input.trigger('keydown.down')
input.trigger('keydown.down')

expect(picker.vm.previewEmoji.native).toEqual('😀')
expect(picker.vm.previewEmojiCategory.id).toEqual('smileys')
expect(picker.vm.view.previewEmoji.native).toEqual('😀')
expect(picker.vm.view.previewEmojiCategory.id).toEqual('smileys')

input.trigger('keydown.enter')

Expand Down
4 changes: 2 additions & 2 deletions spec/picker-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ describe('anchors', () => {
expect(symbols.element.attributes['data-title'].value).toBe('Symbols')

// The `recent` category is selected initially.
expect(picker.vm.activeCategory.id).toBe('recent')
expect(picker.vm.view.activeCategory.id).toBe('recent')
expect(anchors.vm.activeCategory.id).toBe('recent')

symbols.trigger('click')
Expand All @@ -223,7 +223,7 @@ describe('anchors', () => {
// Picker change - the check below fails (although works in demo app)
// scrollTop if 0 for all categories and activeCategory is changed in the
// onScroll handler, need to find a way to thes this.
// expect(picker.vm.activeCategory.id).toBe('symbols')
// expect(picker.vm.view.activeCategory.id).toBe('symbols')
// expect(anchors.vm.activeCategory.id).toBe('symbols')
})
})
Expand Down

0 comments on commit 0ec7238

Please sign in to comment.