You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by dp...@apache.org on 2018/08/31 05:11:44 UTC
[cordova-common] branch master updated: Fix xml-helpers issue by
adding close tag
This is an automated email from the ASF dual-hosted git repository.
dpogue pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-common.git
The following commit(s) were added to refs/heads/master by this push:
new 446adc1 Fix xml-helpers issue by adding close tag
446adc1 is described below
commit 446adc1536ea8e9ac44dca8a3554b452d07aad64
Author: knaito <kn...@asial.co.jp>
AuthorDate: Fri Aug 31 13:03:07 2018 +0900
Fix xml-helpers issue by adding close tag
---
spec/fixtures/test-config0.xml | 12 ++++++++++++
spec/util/xml-helpers.spec.js | 6 ++++++
src/util/xml-helpers.js | 2 +-
3 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/spec/fixtures/test-config0.xml b/spec/fixtures/test-config0.xml
new file mode 100644
index 0000000..bfdbb5a
--- /dev/null
+++ b/spec/fixtures/test-config0.xml
@@ -0,0 +1,12 @@
+<?xml version='1.0' encoding='utf-8'?>
+<widget android-packageName="io.cordova.hellocordova.android" id="io.cordova.hellocordova" ios-CFBundleIdentifier="io.cordova.hellocordova.ios" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
+ <name>Hello Cordova</name>
+ <description>
+ A sample Apache Cordova application that responds to the deviceready event.
+ </description>
+ <author email="dev@cordova.apache.org" href="http://cordova.io">
+ Apache Cordova Team
+ </author>
+ <content src="index.html" />
+ <access origin="*" />
+</widget>
diff --git a/spec/util/xml-helpers.spec.js b/spec/util/xml-helpers.spec.js
index f4d5fbc..e117139 100644
--- a/spec/util/xml-helpers.spec.js
+++ b/spec/util/xml-helpers.spec.js
@@ -209,6 +209,12 @@ describe('xml-helpers', function () {
xml_helpers.graftXML(config_xml, children, '/*');
expect(config_xml.findall('access').length).toEqual(3);
});
+ it('Test 020-1 : should create parent', function () {
+ var config_xml0 = xml_helpers.parseElementtreeSync(path.join(__dirname, '../fixtures/test-config0.xml'));
+ var children = plugin_xml.find('platform[@name="ios"]/config-file').getchildren();
+ xml_helpers.graftXML(config_xml0, children, '/widget/plugins');
+ expect(config_xml0.find('plugins').getchildren().length).toEqual(1);
+ });
});
describe('graftXMLMerge', function () {
diff --git a/src/util/xml-helpers.js b/src/util/xml-helpers.js
index acb610b..df51583 100644
--- a/src/util/xml-helpers.js
+++ b/src/util/xml-helpers.js
@@ -61,7 +61,7 @@ module.exports = {
if (!parent) {
// Try to create the parent recursively if necessary
try {
- var parentToCreate = et.XML('<' + path.basename(selector) + '>');
+ var parentToCreate = et.XML('<' + path.basename(selector) + '/>');
var parentSelector = path.dirname(selector);
this.graftXML(doc, [parentToCreate], parentSelector);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org