Vue-slider-component: testing with cypress - instanceof MouseEvent - targetTouches, triggering events

Created on 15 Apr 2019  路  2Comments  路  Source: NightCatSama/vue-slider-component

Cannot test apps with sliders in cypress because of this line
https://github.com/NightCatSama/vue-slider-component/blob/master/lib/utils/index.ts#L29

When I want to trigger some mouse movement event on vue-slider-dot I've got error because event is not instanceof MouseEvent somehow, and you are getting targetTouches for granted.
There are some libs that are not using MouseEvent directly.

I think that better solution will be to check if event has pageX and pageY properties and if not - check if it has any targetTouches within.

cypress code

cy.get('.vue-slider-dot')
      .trigger('mousedown', 'center', { which: 1 })
      .trigger('mousemove', {
        which: 1,
        clientX: offset.left - 10,
        clientY: offset.top
      })
      .trigger('mouseup', { which: 1, force: true })
bug

Most helpful comment

thanks, now it's working with pageX property

.trigger('mousemove',{pageX: 100, pageY: 100})

thanks again

All 2 comments

Fixed in v3.0.27.

Thanks for the feedback.

thanks, now it's working with pageX property

.trigger('mousemove',{pageX: 100, pageY: 100})

thanks again

Was this page helpful?
0 / 5 - 0 ratings

Related issues

akinhwan picture akinhwan  路  3Comments

ThomasPoncet picture ThomasPoncet  路  5Comments

yusupprog picture yusupprog  路  5Comments

aashrafu picture aashrafu  路  3Comments

creativejeff picture creativejeff  路  7Comments