Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(types): shallow -> shallowMount #587

Merged
merged 1 commit into from
May 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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