From 84f633321c94341f05dad725b90dc016b12ee44b Mon Sep 17 00:00:00 2001 From: Darryl Pogue Date: Wed, 12 Oct 2016 10:48:26 -0700 Subject: [PATCH] CB-12002 - Add getAllowIntents() to ConfigParser --- cordova-common/spec/ConfigParser/ConfigParser.spec.js | 4 ++++ cordova-common/spec/fixtures/test-config.xml | 3 +++ cordova-common/src/ConfigParser/ConfigParser.js | 9 +++++++++ 3 files changed, 16 insertions(+) diff --git a/cordova-common/spec/ConfigParser/ConfigParser.spec.js b/cordova-common/spec/ConfigParser/ConfigParser.spec.js index 097fe617d..22fbc992e 100644 --- a/cordova-common/spec/ConfigParser/ConfigParser.spec.js +++ b/cordova-common/spec/ConfigParser/ConfigParser.spec.js @@ -227,6 +227,10 @@ describe('config.xml parser', function () { var navigations = cfg.getAllowNavigations(); expect(navigations.length).not.toEqual(0); }); + it('it should read tag entries', function(){ + var intents = cfg.getAllowIntents(); + expect(intents.length).not.toEqual(0); + }); }); describe('static resources', function() { var hasPlatformPropertyDefined = function (e) { return !!e.platform; }; diff --git a/cordova-common/spec/fixtures/test-config.xml b/cordova-common/spec/fixtures/test-config.xml index df479484a..a6561431b 100644 --- a/cordova-common/spec/fixtures/test-config.xml +++ b/cordova-common/spec/fixtures/test-config.xml @@ -74,6 +74,9 @@ + + + diff --git a/cordova-common/src/ConfigParser/ConfigParser.js b/cordova-common/src/ConfigParser/ConfigParser.js index f23df4de5..6e74ce3d1 100644 --- a/cordova-common/src/ConfigParser/ConfigParser.js +++ b/cordova-common/src/ConfigParser/ConfigParser.js @@ -480,6 +480,15 @@ ConfigParser.prototype = { }; }); }, + /* Get all the allow-intent tags */ + getAllowIntents: function() { + var allow_intents = this.doc.findall('./allow-intent'); + return allow_intents.map(function(allow_intent){ + return { + 'href': allow_intent.attrib.href + }; + }); + }, /* Get all edit-config tags */ getEditConfigs: function(platform) { var platform_tag = this.doc.find('./platform[@name="' + platform + '"]');