Skip to content

Instantly share code, notes, and snippets.

@eddyerburgh
Last active September 30, 2018 04:51
Show Gist options
  • Save eddyerburgh/fe45541a97e7567b07c070a328d1be32 to your computer and use it in GitHub Desktop.
Save eddyerburgh/fe45541a97e7567b07c070a328d1be32 to your computer and use it in GitHub Desktop.
import test from 'tape'
import { shallow } from '@vue/test-utils'
import MessageToggle from '../../src/components/MessageToggle'
test('MessageToggle.vue renders default message', t => {
t.plan(1)
const wrapper = shallow(MessageToggle)
t.equal(wrapper.find('p').text(), 'default message', 'has a default message')
})
test('MessageToggle.vue renders default message', t => {
t.plan(2)
const wrapper = shallow(MessageToggle)
const button = wrapper.find('#toggle-message')
const p = wrapper.find('p')
button.trigger('click')
t.equal(p.text(), 'message', 'toggles <p> text to "message"')
button.trigger('click')
t.equal(p.text(), 'toggled message', 'toggles <p> text to "toggled message"')
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment