- Fixed peer dependency
- Added
prototype
option allowing you to add stuff to the Vue prototype - Upgraded
slots
to useslot-scope
syntax
- Fixed hard dependencies (should be able to work with any version of Vue 2.x.x etc.)
- Improved
vm.$find
methods to avoid HTMLElement inheritence issues.
- Polyfill
Object.assign
- Slots option now supports scoped slots. The scope is passed in as
props
i.e.{ slots: { foo: '<span>{{props.bah}}</span>' } }
. 77 - The
on
option now actually passes events into the component render function, rather than just adding them to the instance withvm.$on
. This makes event testing more realistic (especially when dealing with render functions). 80 - It is now possible to test extended components (rather than just plain object components).
mount(Vue.extend(A).extend(B))
81
vm.$find
now returns an array-like object that exposes the first matched item's object. So you can now dovm.$find('router-link').$html
as well asvm.$find('router-link')[0].$html
. It still have array-like methods i.e.vm.$find('router-link').concat([])
and be turned into a true array withvm.$find('router-link').slice()
.65- Added
vuenit.build
method, allowing you to create a custom, reusable mount method. 68 - Removed
vm.$create
as this has been superseded by the abovevuenit.build
method. 67 - When calling
vm.$find
to return html elements (i.e.vm.$find('button')
orvm.$findOne('.thingy')
) the element will be augmented with$html
,$name
,$find
,$contains
etc. 71 - Added
vm.$text
andfoundElement.$text
properties that return the elements text content. - If a component template contained no dynamic rendering (just regular html elements with no mustaches, props, etc.) it would fail to render as vuenit was not attaching the static render functions. 73
vm.$find
,vm.$findOne
,vm.$contains
all now include the root element of a component as part of their search.
- As
vm.$find
no longer returns a true array, certain operations will no longer work, e.g.[].concat(vm.$find('...'), vm.$find('...'))
will not concat the results of 2 finds anymore as they are not arrays, you would need to call.slice()
on them first.Array.isArray
will also start returning false. - Any calls to
vm.$create
will throw a deprecation error. In future releases it will be removed entirely. - The find methods now include the root element as part of their search, so it possible this will break existing assertions.
- Added a deprecation warning to
vm.$create
as it will be removed in 1.0.0
- Added a
Vue
andinjector
option 58 - Added a
data
option to specify initial data properties 55 - Made
component.name
oroptions.name
optional, it will just default to a randomly-generated test name 62 - Added
vm.$trigger
method 64
vuenit.http
now uses themock-http-client
library.vuenit.store
now uses themock-vuex
library.vuenit.router
now uses themock-vue-router
library.- Added a
directives
option so you can stub specific directives.
- Setting
vuenit.component.config.install
did not work as the install method was being activated before the options had been merged. - mock router was using
[].find
method which is not supported in older browsers. Replaced with old reliable for loops. vuenit.component.config
is now set by default, meaning you can just writevuenit.component.config.property=value
.
- Fixed a bug when using
vue/dist/vue.esm.js
(Vue's main entry point) as Vuenit doesn't expect esm syntax.
- Previously, if prop values were not passed into
options.props
, settingvm.propsData.unsetprop
would not update the component. This has now been fixed. - Improved
$store.when
to accept method types (i.e. commit/dispatch) as well as adding$store.otherwise
method. Also accepts regular expressions to match against: e.g.$store.when('commit', /MYCOMMIT/).return('value')
. vuenit.router()
creates a mock version of$route
and$router
.- Can automatically inject $route and $router into a component with the router option:
{ router : true }
stubDirectives
option lets you automatically stub all directives used by a component- If a component instance already has properties for
$name
,$html
,$find
, etc., they will not be overwritten with vuenit's properties. shallow
option can be passed in, which is an alias for setting stubComponents, stubFilters, and stubDirectives to true.- Components can also be shallow rendered by calling the new
vuenit.shallow()
method. - The
before
option allows you to intercept the component and options just before the component is instantiated, allowing you to spy on component methods or mock computed values, etc.
- Fixed issues with
stubComponents
option getting transposed by Vue for global components. stubComponents
default template now has a<slot>
so it still renders inner html.
- Access component instance's name with
vm.$name
(rather thanvm.$options.name
) - Access component's html content with
vm.$html
(rather thanvm.$el.outerHTML
) vm.$find
allows you to search a component's html for matching elements or component instances.vm.$contains
tests whether a component contains another component or a html element.slots
option lets you easily insert slot content into a component. This is the equivalent of manually inserting slots with theinnerHTML
property.on
option lets you add event listeners when creating a component.stubFilters
flag automatically stubs all known filters.filters
option allows you to stub/mock filtersvuenit.trigger
method allows you trigger dom events.vm.$create
method creates a new instance of a component using the same options as before
stubComponents
flag automatically stubs all known componentscomponents
options allows you to stub/mock components- added
install
method - disabled unknownElement debug message
- disabled productionTip debug message
- added a
cleanUp
method that removes any globally-registered components from the Base Vue object vuenit.component.config
andvuenit.directive.config
allow global settings to be applied.