Skip to content

refactor: tidy up #2036

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 1 commit into from
Jan 18, 2023
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
8 changes: 4 additions & 4 deletions packages/shared/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function isVueComponent(c: any): boolean {
return true
}

if (c === null || typeof c !== 'object') {
if (!isPlainObject(c)) {
return false
}

Expand Down Expand Up @@ -63,7 +63,7 @@ export function componentNeedsCompiling(component: Component): boolean {

export function isRefSelector(refOptionsObject: any): boolean {
if (
typeof refOptionsObject !== 'object' ||
!isPlainObject(refOptionsObject) ||
Object.keys(refOptionsObject || {}).length !== 1
) {
return false
Expand All @@ -73,7 +73,7 @@ export function isRefSelector(refOptionsObject: any): boolean {
}

export function isNameSelector(nameOptionsObject: any): boolean {
if (typeof nameOptionsObject !== 'object' || nameOptionsObject === null) {
if (!isPlainObject(nameOptionsObject)) {
return false
}

Expand All @@ -89,7 +89,7 @@ export function isDynamicComponent(c: any) {
}

export function isComponentOptions(c: any) {
return c !== null && typeof c === 'object' && (c.template || c.render)
return isPlainObject(c) && (c.template || c.render)
}

export function isFunctionalComponent(c: any) {
Expand Down
4 changes: 2 additions & 2 deletions packages/test-utils/src/wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
warnDeprecated,
isVueWrapper
} from 'shared/util'
import { isPlainObject } from 'shared/validators'
import { isElementVisible } from 'shared/is-visible'
import find from './find'
import createWrapper from './create-wrapper'
Expand Down Expand Up @@ -719,8 +720,7 @@ export default class Wrapper implements BaseWrapper {
Object.keys(data).forEach(key => {
// Don't let people set entire objects, because reactivity won't work
if (
typeof data[key] === 'object' &&
data[key] !== null &&
isPlainObject(data[key]) &&
// $FlowIgnore : Problem with possibly null this.vm
data[key] === this.vm[key]
) {
Expand Down