Skip to content

fix: delete useless code #248

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

Merged
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/mount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,6 @@ export function mount(
// normalise the incoming component
let component

const functionalComponentEmits: Record<string, unknown[]> = {}

if (isFunctionalComponent(originalComponent)) {
// we need to wrap it like this so we can capture emitted events.
// we capture events using a mixin that mutates `emit` in `beforeCreate`,
Expand Down Expand Up @@ -422,7 +420,7 @@ export function mount(
const vm = app.mount(el)

const App = vm.$refs[MOUNT_COMPONENT_REF] as ComponentPublicInstance
return createWrapper(app, App, setProps, functionalComponentEmits)
return createWrapper(app, App, setProps)
}

export const shallowMount: typeof mount = (component: any, options?: any) => {
Expand Down
10 changes: 3 additions & 7 deletions src/vueWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,17 @@ export class VueWrapper<T extends ComponentPublicInstance> {
private rootVM: ComponentPublicInstance
private __app: App | null
private __setProps: ((props: Record<string, any>) => void) | undefined
private __functionalEmits: Record<string, unknown[]>

constructor(
app: App | null,
vm: ComponentPublicInstance,
setProps?: (props: Record<string, any>) => void,
functionalEmits?: Record<string, unknown[]>
setProps?: (props: Record<string, any>) => void
) {
this.__app = app
// root is null on functional components
this.rootVM = vm?.$root
this.componentVM = vm as T
this.__setProps = setProps
this.__functionalEmits = functionalEmits
// plugins hook
config.plugins.VueWrapper.extend(this)
}
Expand Down Expand Up @@ -247,8 +244,7 @@ export class VueWrapper<T extends ComponentPublicInstance> {
export function createWrapper<T extends ComponentPublicInstance>(
app: App | null,
vm: ComponentPublicInstance,
setProps?: (props: Record<string, any>) => void,
functionalComponentEmits?: Record<string, unknown[]>
setProps?: (props: Record<string, any>) => void
): VueWrapper<T> {
return new VueWrapper<T>(app, vm, setProps, functionalComponentEmits)
return new VueWrapper<T>(app, vm, setProps)
}