eddyerburgh / avoriaz

🔬 a Vue.js testing utility library
https://eddyerburgh.gitbooks.io/avoriaz/content/
MIT License
758 stars 62 forks source link

Tests disregard disabled attribute #170

Open SergeyKhval opened 6 years ago

SergeyKhval commented 6 years ago

The following test fails

<template>
  <button disabled @click="handleClick">Button</button>
</template>

<script>
  export default {
    methods: {
      handleClick() {
        console.log('clicked')
      },
    },
  }
</script>
import { shallow } from 'avoriaz'
import { stub } from 'sinon'
import Test from './test'

describe('TEST COMPONENT', () => {
  it('should not handle click', () => {
    const wrapper = shallow(Test)
    wrapper.vm.handleClick = stub()
    wrapper.update()
    wrapper.first('button').trigger('click')
    expect(wrapper.vm.handleClick.called).to.equal(false)
  })
})
eddyerburgh commented 6 years ago

How are you running the tests (what browser/ test runner/ compiler)

SergeyKhval commented 6 years ago

I use karma with headless chrome and webpack

SergeyKhval commented 6 years ago

I tried to reproduce it with a clean vue-cli installation and it still fails