From b3a35e4df5e86437f51f1c20edb930d522421524 Mon Sep 17 00:00:00 2001
From: wangRan <307209868@qq.com>
Date: Wed, 5 Dec 2018 17:47:53 +0800
Subject: [PATCH] fix: Boolean type resolution error in xml
---
.../src/factory/common/ManagedResolverFactory.ts | 2 ++
packages/context/src/factory/common/constants.ts | 1 +
.../context/test/fixtures/app/resources/object.xml | 1 +
.../unit/factory/xml/XmlApplicationContext.test.ts | 1 +
.../unit/factory/xml/XmlObjectElementParser.test.ts | 10 ++++++++++
5 files changed, 15 insertions(+)
diff --git a/packages/context/src/factory/common/ManagedResolverFactory.ts b/packages/context/src/factory/common/ManagedResolverFactory.ts
index c8e77a4aab2f..70bc6aa1b97c 100644
--- a/packages/context/src/factory/common/ManagedResolverFactory.ts
+++ b/packages/context/src/factory/common/ManagedResolverFactory.ts
@@ -101,6 +101,8 @@ class ValueResolver extends BaseManagedResolver {
return parseInt(tpl(mv.value, props), 10);
case VALUE_TYPE.DATE:
return new Date(tpl(mv.value, props));
+ case VALUE_TYPE.BOOLEAN:
+ return mv.value === 'true';
}
return mv.value;
diff --git a/packages/context/src/factory/common/constants.ts b/packages/context/src/factory/common/constants.ts
index 18c30d2029d4..d03c00407942 100644
--- a/packages/context/src/factory/common/constants.ts
+++ b/packages/context/src/factory/common/constants.ts
@@ -70,4 +70,5 @@ export const VALUE_TYPE = {
TEMPLATE: 'template',
MANAGED: 'managed',
OBJECT: 'object', // 仅仅在解析时使用
+ BOOLEAN: 'boolean'
};
diff --git a/packages/context/test/fixtures/app/resources/object.xml b/packages/context/test/fixtures/app/resources/object.xml
index 6be9992bd4e3..d1c7347fa192 100644
--- a/packages/context/test/fixtures/app/resources/object.xml
+++ b/packages/context/test/fixtures/app/resources/object.xml
@@ -7,6 +7,7 @@
+