- Notifications
You must be signed in to change notification settings - Fork62
🔬 a Vue.js testing utility library
License
NotificationsYou must be signed in to change notification settings
eddyerburgh/avoriaz
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
a Vue.js testing utility library
This library will be deprecated oncevue-test-utils is released.
npm install --save-dev avoriaz
- Example using karma and mocha
- Example using karma and jasmine
- Example using Jest
- Example using mocha-webpack
- Example using tape
- Example using ava
import{mount}from'avoriaz'importFoofrom'./Foo.vue'constwrapper=mount(Foo)expect(wrapper.contains('.bar')).to.equal(true)
import{shallow}from'avoriaz'importFoofrom'./Foo.vue'importBarfrom'./Bar.vue'constwrapper=shallow(Foo)expect(wrapper.contains(Bar)).to.equal(true)
constbutton=wrapper.find('div > button .button-child')[0]expect(button.hasStyle('color','red')).to.equal(true)
constclickHandler=sinon.stub()constwrapper=mount(Foo,{propsData:{ clickHandler}})wrapper.find('div .bar')[0].trigger('click')expect(clickHandler.called).to.equal(true)
consttitle=wrapper.find('h1.title')[0]expect(title.text()).to.equal('some text')
const$route={path:'http://www.example-path.com'}constwrapper=mount(Foo,{globals:{ $route}})expect(wrapper.vm.$route.path).to.equal($route.path)
constwrapper=mount(Foo,{slots:{default:Foo}})
wrapper.setData({someData:'some data'})expect(wrapper.vm.someData).to.equal('some data')
wrapper.setProps({someProp:'some prop',anotherProp:'another prop'})
For more examples,see the docs
About
🔬 a Vue.js testing utility library
Topics
Resources
License
Stars
Watchers
Forks
Packages0
No packages published