[
https://issues.apache.org/jira/browse/CB-13979?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16471664#comment-16471664
]
Kevin Christopher Henry commented on CB-13979:
----------------------------------------------
[~dpogue]: Thanks for doing this. Tests would be great. Remember to test both
edit-config and config-file if you can.
I don't have access to a development machine at the moment, but you can
construct a test file by generating a new (blank) project, adding a platform
(Android, say), and then adding something like this to config.xml:
{noformat}
<platform name="android"></platform>
<platform name="android">
<edit-config file="app/src/main/AndroidManifest.xml"
target="/manifest/application" mode="merge">
<application android:allowBackup="false"/>
</edit-config>
</platform>
{noformat}
The dummy platform tag will prevent the edit-config from being seen with the
existing code. The only issue is to choose something to configure that you can
easily check in your test. That I'm not sure of, as I've never needed to
dynamically check the configuration.
> getEditConfigs() and getConfigFiles() only work for the first <platform> tag
> ----------------------------------------------------------------------------
>
> Key: CB-13979
> URL: https://issues.apache.org/jira/browse/CB-13979
> Project: Apache Cordova
> Issue Type: Bug
> Components: cordova-common
> Affects Versions: Master
> Reporter: Kevin Christopher Henry
> Assignee: Darryl Pogue
> Priority: Minor
> Labels: pull-request-available
>
> I ran into something strange - my configuration would change based on the
> ordering of elements in config.xml.
> Looking at the source code, the culprit is getEditConfigs() and
> getConfigFiles() in ConfigParser.js. Unlike the rest of the code they only
> look in the first platform tag for config directives:
> {{var platform_tag = this.doc.find('./platform[@name="' + platform + '"]');}}
> {{var platform_edit_configs = platform_tag ?
> platform_tag.findall('edit-config') : [];}}
> This should probably be something like this instead (untested):
> {{var platform_edit_configs = this.doc.findall('./platform[@name="' +
> platform + '"]/edit-config');}}
> And similarly for getConfigFiles().
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]