You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by da...@apache.org on 2016/11/09 07:13:44 UTC
cordova-windows git commit: CB-12124: Make available device
capabilities in package.windows10.appxmanifest
Repository: cordova-windows
Updated Branches:
refs/heads/master d6322b774 -> 74e84e3dc
CB-12124: Make available device capabilities in package.windows10.appxmanifest
Project: http://git-wip-us.apache.org/repos/asf/cordova-windows/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-windows/commit/74e84e3d
Tree: http://git-wip-us.apache.org/repos/asf/cordova-windows/tree/74e84e3d
Diff: http://git-wip-us.apache.org/repos/asf/cordova-windows/diff/74e84e3d
Branch: refs/heads/master
Commit: 74e84e3dc48d6f6a78cc3eb3f170352e3937e0b8
Parents: d6322b7
Author: Nikita Matrosov <ma...@gmail.com>
Authored: Tue Nov 8 15:03:11 2016 +0300
Committer: Nikita Matrosov <ma...@gmail.com>
Committed: Tue Nov 8 15:03:11 2016 +0300
----------------------------------------------------------------------
spec/unit/ConfigChanges.spec.js | 38 ++++++++++++++++++++
.../plugin.xml | 1 +
template/cordova/lib/ConfigChanges.js | 2 +-
3 files changed, 40 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/74e84e3d/spec/unit/ConfigChanges.spec.js
----------------------------------------------------------------------
diff --git a/spec/unit/ConfigChanges.spec.js b/spec/unit/ConfigChanges.spec.js
index df346dd..48755c7 100644
--- a/spec/unit/ConfigChanges.spec.js
+++ b/spec/unit/ConfigChanges.spec.js
@@ -159,5 +159,43 @@ describe('Capabilities within package.windows.appxmanifest', function() {
done();
});
});
+
+ it('should be added as DeviceCapabilities when install plugin', function(done) {
+ function isDeviceCapability(capability) {
+ return capability.type === 'DeviceCapability';
+ }
+
+ function checkCapabilitiesAfterInstall(manifest) {
+ // There is the one default capability in manifest with 'internetClient' name
+ var manifestCapabilities = getManifestCapabilities(manifest);
+ var pluginCapabilities = getPluginCapabilities(dummyPluginInfo);
+
+ expect(manifestCapabilities.length).toBe(pluginCapabilities.length + 1);
+
+ var manifestDeviceCapabilties = manifestCapabilities.filter(isDeviceCapability);
+ expect(manifestDeviceCapabilties.length).toBe(1);
+ }
+
+ function checkCapabilitiesAfterRemove(manifest) {
+ var manifestCapabilities = getManifestCapabilities(manifest);
+ expect(manifestCapabilities.length).toBe(1);
+ }
+
+ api.addPlugin(dummyPluginInfo)
+ .then(function() {
+ checkCapabilitiesAfterInstall(windowsManifest);
+ checkCapabilitiesAfterInstall(windowsManifest10);
+ api.removePlugin(dummyPluginInfo);
+ })
+ .then(function() {
+ checkCapabilitiesAfterRemove(windowsManifest);
+ checkCapabilitiesAfterRemove(windowsManifest10);
+ })
+ .catch(fail)
+ .finally(function() {
+ expect(fail).not.toHaveBeenCalled();
+ done();
+ });
+ });
});
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/74e84e3d/spec/unit/fixtures/org.test.plugins.capabilityplugin/plugin.xml
----------------------------------------------------------------------
diff --git a/spec/unit/fixtures/org.test.plugins.capabilityplugin/plugin.xml b/spec/unit/fixtures/org.test.plugins.capabilityplugin/plugin.xml
index a52d18c..687dedf 100644
--- a/spec/unit/fixtures/org.test.plugins.capabilityplugin/plugin.xml
+++ b/spec/unit/fixtures/org.test.plugins.capabilityplugin/plugin.xml
@@ -8,5 +8,6 @@
<Capability Name="enterpriseAuthentication" />
<Capability Name="privateNetworkClientServer" />
<Capability Name="sharedUserCertificates" />
+ <DeviceCapability Name="webcam"/>
</config-file>
</plugin>
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/74e84e3d/template/cordova/lib/ConfigChanges.js
----------------------------------------------------------------------
diff --git a/template/cordova/lib/ConfigChanges.js b/template/cordova/lib/ConfigChanges.js
index 64eba4d..1bd620f 100644
--- a/template/cordova/lib/ConfigChanges.js
+++ b/template/cordova/lib/ConfigChanges.js
@@ -136,7 +136,7 @@ function compareCapabilities(firstCap, secondCap) {
function generateUapCapabilities(capabilities) {
function hasCapabilityChange(change) {
- return /^\s*<Capability\s/.test(change.xml);
+ return /^\s*<(Device)?Capability\s/.test(change.xml);
}
function createPrefixedCapabilityChange(change) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org