From df296bc36a379320495339b56c504572999b60c6 Mon Sep 17 00:00:00 2001 From: Howard Zhang Date: Thu, 14 Dec 2023 16:15:41 +0800 Subject: [PATCH] fix: unit test problems --- packages/vchart/src/model/base-model.ts | 2 +- packages/vutils-extension/src/utils/object.ts | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/vchart/src/model/base-model.ts b/packages/vchart/src/model/base-model.ts index db2a5cd73..1469ce614 100644 --- a/packages/vchart/src/model/base-model.ts +++ b/packages/vchart/src/model/base-model.ts @@ -106,7 +106,7 @@ export abstract class BaseModel extends CompilableBase imp } protected get _theme() { - return this.getSpecInfo().theme; + return this.getSpecInfo()?.theme; } /** for layout diff */ diff --git a/packages/vutils-extension/src/utils/object.ts b/packages/vutils-extension/src/utils/object.ts index 42714eee3..91a297213 100644 --- a/packages/vutils-extension/src/utils/object.ts +++ b/packages/vutils-extension/src/utils/object.ts @@ -41,5 +41,8 @@ export const setProperty = (target: T, path: Array, value: a }; export const getProperty = (target: any, path: Array, defaultValue?: T): T => { + if (isNil(path)) { + return undefined; + } return get(target, path as string[], defaultValue) as T; };