Skip to content

Releases: wrseward/vue-unit

0.3.0

04 Jun 15:54
Compare
Choose a tag to compare

Add fakeMutations helper (similar to fakeActions)

0.2.2

18 May 23:18
Compare
Choose a tag to compare

Fix incorrect build from 0.2.1

0.2.1

18 May 13:28
Compare
Choose a tag to compare

Fix an issue with test failures while using the waitForUpdate helper with mocha.

Please see #3 for more info.

A big thank you to @tom-kitchin for the PR!

0.2.0

02 May 02:23
Compare
Choose a tag to compare

Add waitForUpdate

The waitForUpdate() helper function can be used to clean up a chain of async DOM assertions that you would normally have to use Vue.nextTick() for.

For example we could rewrite the following test:

const Component = {
  template: `<p>{{ message }}</p>`,
  props: ['message']
}

it('tests message updates', () => {
  const vm = mount(Component, { message: 'Hello' })
  expect($(vm.$el)).to.have.text('Hello')
  vm.message = 'World'
  return vm.$nextTick().then(() => {
    expect($(vm.$el)).to.have.text('World')
    vm.message = 'VueUnit'
    return vm.$nextTick()
  }).then(() => {
    expect($(vm.$el)).to.have.text('VueUnit')
  })
})

like so:

it('tests message updates', () => {
  const vm = mount(Component, { message: 'Hello' })

  expect($(vm.$el)).to.have.text('Hello')
  vm.message = 'World'
  waitForUpdate(() => {
    expect($(vm.$el)).to.have.text('World')
    vm.message = 'VueUnit'
  }).then(() => {
    expect($(vm.$el)).to.have.text('VueUnit')
  }).end(done)

Please note when using waitForUpdate() use must end your chain of assertions with .end(done) to avoid errors.

Initial Public Release

27 Apr 22:34
Compare
Choose a tag to compare
  • Easily test props, events, and slots (including named slots)
  • Optionally shallow render components
  • Simulate simple DOM events (click, input, etc.)
  • Use any test runner / assertion library
  • Fake vuex getters and actions