Skip to content

Commit

Permalink
fix(types): shallow -> shallowMount (#587)
Browse files Browse the repository at this point in the history
  • Loading branch information
38elements authored and eddyerburgh committed May 6, 2018
1 parent 290be49 commit c3e013e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
10 changes: 5 additions & 5 deletions packages/test-utils/types/index.d.ts
Expand Up @@ -130,9 +130,9 @@ interface MountOptions<V extends Vue> extends ComponentOptions<V> {

type ThisTypedMountOptions<V extends Vue> = MountOptions<V> & ThisType<V>

type ShallowOptions<V extends Vue> = MountOptions<V>
type ShallowMountOptions<V extends Vue> = MountOptions<V>

type ThisTypedShallowOptions<V extends Vue> = ShallowOptions<V> & ThisType<V>
type ThisTypedShallowMountOptions<V extends Vue> = ShallowMountOptions<V> & ThisType<V>

interface VueTestUtilsConfigOptions {
stubs?: Stubs
Expand All @@ -145,9 +145,9 @@ export declare function mount<V extends Vue> (component: VueClass<V>, options?:
export declare function mount<V extends Vue> (component: ComponentOptions<V>, options?: ThisTypedMountOptions<V>): Wrapper<V>
export declare function mount (component: FunctionalComponentOptions, options?: MountOptions<Vue>): Wrapper<Vue>

export declare function shallow<V extends Vue> (component: VueClass<V>, options?: ThisTypedShallowOptions<V>): Wrapper<V>
export declare function shallow<V extends Vue> (component: ComponentOptions<V>, options?: ThisTypedShallowOptions<V>): Wrapper<V>
export declare function shallow (component: FunctionalComponentOptions, options?: ShallowOptions<Vue>): Wrapper<Vue>
export declare function shallowMount<V extends Vue> (component: VueClass<V>, options?: ThisTypedShallowMountOptions<V>): Wrapper<V>
export declare function shallowMount<V extends Vue> (component: ComponentOptions<V>, options?: ThisTypedShallowMountOptions<V>): Wrapper<V>
export declare function shallowMount (component: FunctionalComponentOptions, options?: ShallowMountOptions<Vue>): Wrapper<Vue>

export declare let TransitionStub: Component | string | true
export declare let TransitionGroupStub: Component | string | true
Expand Down
18 changes: 9 additions & 9 deletions packages/test-utils/types/test/shallow.ts
@@ -1,28 +1,28 @@
import Vuex from 'vuex'
import { shallow, createLocalVue } from '../'
import { shallowMount, createLocalVue } from '../'
import { normalOptions, functionalOptions, Normal, ClassComponent } from './resources'

/**
* Should create wrapper vm based on (function) component options or constructors
* The users can specify component type via the type parameter
*/
const normalWrapper = shallow(normalOptions)
const normalWrapper = shallowMount(normalOptions)
const normalFoo: string = normalWrapper.vm.foo

const classWrapper = shallow(ClassComponent)
const classWrapper = shallowMount(ClassComponent)
const classFoo: string = classWrapper.vm.bar

const functinalWrapper = shallow(functionalOptions)
const functinalWrapper = shallowMount(functionalOptions)

/**
* Test for shallow options
* Test for shallowMount options
*/
const localVue = createLocalVue()
localVue.use(Vuex)

const store = new Vuex.Store({})

shallow(ClassComponent, {
shallowMount(ClassComponent, {
attachToDocument: true,
localVue,
mocks: {
Expand All @@ -41,17 +41,17 @@ shallow(ClassComponent, {
}
})

shallow(functionalOptions, {
shallowMount(functionalOptions, {
context: {
props: { foo: 'test' }
},
stubs: ['child']
})

/**
* ShallowOptions should receive Vue's component options
* ShallowMountOptions should receive Vue's component options
*/
shallow(ClassComponent, {
shallowMount(ClassComponent, {
propsData: {
test: 'test'
},
Expand Down

0 comments on commit c3e013e

Please sign in to comment.