You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by au...@apache.org on 2017/07/14 22:57:45 UTC
[5/7] cordova-windows git commit: CB-12895 : setup eslint and removed
jshint
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/a8692238/spec/unit/package.spec.js
----------------------------------------------------------------------
diff --git a/spec/unit/package.spec.js b/spec/unit/package.spec.js
index 3315efd..03bac51 100644
--- a/spec/unit/package.spec.js
+++ b/spec/unit/package.spec.js
@@ -16,109 +16,109 @@
specific language governing permissions and limitations
under the License.
*/
-var path = require('path'),
- rewire = require('rewire'),
- shell = require('shelljs'),
- Q = require('q'),
- platformRoot = '../../template',
- pkgRoot = './template/',
- pkgPath = path.join(pkgRoot, 'AppPackages'),
- testPkgPath = './spec/unit/fixtures/DummyProject/AppPackages',
- pkg = rewire(platformRoot + '/cordova/lib/package.js');
+var path = require('path');
+var rewire = require('rewire');
+var shell = require('shelljs');
+var Q = require('q');
+var platformRoot = '../../template';
+var pkgRoot = './template/';
+var pkgPath = path.join(pkgRoot, 'AppPackages');
+var testPkgPath = './spec/unit/fixtures/DummyProject/AppPackages';
+var pkg = rewire(platformRoot + '/cordova/lib/package.js');
var consoleLogOriginal;
-beforeEach(function() {
+beforeEach(function () {
// console output suppression
consoleLogOriginal = pkg.__get__('console.log');
- pkg.__set__('console.log', function() {} );
+ pkg.__set__('console.log', function () {});
});
-afterEach(function() {
+afterEach(function () {
pkg.__set__('console.log', consoleLogOriginal);
});
-describe('getPackage method', function() {
+describe('getPackage method', function () {
it('start', function () {
shell.rm('-rf', pkgPath);
shell.cp('-R', testPkgPath, pkgRoot);
});
- it('spec.1 should find windows anycpu debug package', function(done) {
+ it('spec.1 should find windows anycpu debug package', function (done) {
var rejected = jasmine.createSpy();
pkg.getPackage('windows', 'debug', 'anycpu')
- .then(function(pkgInfo) {
+ .then(function (pkgInfo) {
expect(pkgInfo.type).toBe('windows');
expect(pkgInfo.buildtype).toBe('debug');
expect(pkgInfo.arch).toBe('anycpu');
expect(pkgInfo.script).toBeDefined();
- }, function(err) {
+ }, function (err) {
console.error(err);
rejected();
})
- .finally(function() {
+ .finally(function () {
expect(rejected).not.toHaveBeenCalled();
done();
});
});
- it('spec.2 should find windows phone anycpu debug package', function(done) {
+ it('spec.2 should find windows phone anycpu debug package', function (done) {
var rejected = jasmine.createSpy();
pkg.getPackage('phone', 'debug', 'anycpu')
- .then(function(pkgInfo) {
- expect(pkgInfo.type).toBe('phone');
- expect(pkgInfo.buildtype).toBe('debug');
- expect(pkgInfo.arch).toBe('anycpu');
- expect(pkgInfo.script).toBeDefined();
- }, rejected)
- .finally(function() {
- expect(rejected).not.toHaveBeenCalled();
- done();
- });
+ .then(function (pkgInfo) {
+ expect(pkgInfo.type).toBe('phone');
+ expect(pkgInfo.buildtype).toBe('debug');
+ expect(pkgInfo.arch).toBe('anycpu');
+ expect(pkgInfo.script).toBeDefined();
+ }, rejected)
+ .finally(function () {
+ expect(rejected).not.toHaveBeenCalled();
+ done();
+ });
});
- it('spec.3 should not find windows 10 anycpu debug package', function(done) {
+ it('spec.3 should not find windows 10 anycpu debug package', function (done) {
var resolved = jasmine.createSpy();
pkg.getPackage('windows10', 'debug', 'anycpu')
- .then(resolved)
- .finally(function() {
- expect(resolved).not.toHaveBeenCalled();
- done();
- });
+ .then(resolved)
+ .finally(function () {
+ expect(resolved).not.toHaveBeenCalled();
+ done();
+ });
});
- it('spec.4 should not find windows anycpu release package', function(done) {
+ it('spec.4 should not find windows anycpu release package', function (done) {
var resolved = jasmine.createSpy();
pkg.getPackage('windows', 'release', 'anycpu')
- .then(resolved)
- .finally(function() {
- expect(resolved).not.toHaveBeenCalled();
- done();
- });
+ .then(resolved)
+ .finally(function () {
+ expect(resolved).not.toHaveBeenCalled();
+ done();
+ });
});
- it('spec.5 should not find windows x86 debug package', function(done) {
+ it('spec.5 should not find windows x86 debug package', function (done) {
var resolved = jasmine.createSpy();
pkg.getPackage('windows', 'debug', 'x86')
- .then(resolved)
- .finally(function() {
- expect(resolved).not.toHaveBeenCalled();
- done();
- });
+ .then(resolved)
+ .finally(function () {
+ expect(resolved).not.toHaveBeenCalled();
+ done();
+ });
});
- it('end', function() {
+ it('end', function () {
shell.rm('-rf', pkgPath);
});
});
-describe('getPackageFileInfo method', function() {
- it('spec.6 should get file info correctly for wp8 anycpu debug package', function() {
+describe('getPackageFileInfo method', function () {
+ it('spec.6 should get file info correctly for wp8 anycpu debug package', function () {
var packageFile = path.join(pkgPath, 'CordovaApp.Phone_0.0.1.0_debug_Test', 'CordovaApp.Phone_0.0.1.0_AnyCPU_debug.appxbundle');
var pkgInfo = pkg.getPackageFileInfo(packageFile);
@@ -127,7 +127,7 @@ describe('getPackageFileInfo method', function() {
expect(pkgInfo.buildtype).toBe('debug');
});
- it('spec.7 should get file info correctly for windows 8.1 anycpu debug package', function() {
+ it('spec.7 should get file info correctly for windows 8.1 anycpu debug package', function () {
var packageFile = path.join(pkgPath, 'CordovaApp.Windows_0.0.1.0_anycpu_debug_Test', 'CordovaApp.Windows_0.0.1.0_anycpu_debug.appx');
var pkgInfo = pkg.getPackageFileInfo(packageFile);
@@ -136,7 +136,7 @@ describe('getPackageFileInfo method', function() {
expect(pkgInfo.buildtype).toBe('debug');
});
- it('spec.8 should get file info correctly for windows 8.1 x64 release package', function() {
+ it('spec.8 should get file info correctly for windows 8.1 x64 release package', function () {
var packageFile = path.join(pkgPath, 'CordovaApp.Windows_0.0.1.0_x64_Test', 'CordovaApp.Windows_0.0.1.0_x64.appx');
var pkgInfo = pkg.getPackageFileInfo(packageFile);
@@ -145,7 +145,7 @@ describe('getPackageFileInfo method', function() {
expect(pkgInfo.buildtype).toBe('release');
});
- it('spec.9 should get file info correctly for windows 8.1 x86 release package', function() {
+ it('spec.9 should get file info correctly for windows 8.1 x86 release package', function () {
var packageFile = path.join(pkgPath, 'CordovaApp.Windows_0.0.1.0_x86_Test', 'CordovaApp.Windows_0.0.1.0_x86.appx');
var pkgInfo = pkg.getPackageFileInfo(packageFile);
@@ -155,28 +155,28 @@ describe('getPackageFileInfo method', function() {
});
});
-describe('getAppId method', function() {
- it('spec.10 should properly get phoneProductId value from manifest', function(done) {
+describe('getAppId method', function () {
+ it('spec.10 should properly get phoneProductId value from manifest', function (done) {
var resolve = jasmine.createSpy();
Q(pkg.getAppId(pkgRoot))
- .then(resolve)
- .finally(function() {
- expect(resolve).toHaveBeenCalledWith('$guid1$');
- done();
- });
+ .then(resolve)
+ .finally(function () {
+ expect(resolve).toHaveBeenCalledWith('$guid1$');
+ done();
+ });
});
});
-describe('getPackageName method', function() {
- it('spec.11 should properly get Application Id value from manifest', function(done) {
+describe('getPackageName method', function () {
+ it('spec.11 should properly get Application Id value from manifest', function (done) {
var resolve = jasmine.createSpy();
Q(pkg.getAppId(pkgRoot))
- .then(resolve)
- .finally(function() {
- expect(resolve).toHaveBeenCalledWith('$guid1$');
- done();
- });
+ .then(resolve)
+ .finally(function () {
+ expect(resolve).toHaveBeenCalledWith('$guid1$');
+ done();
+ });
});
});
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/a8692238/spec/unit/pluginHandler/common.spec.js
----------------------------------------------------------------------
diff --git a/spec/unit/pluginHandler/common.spec.js b/spec/unit/pluginHandler/common.spec.js
index 776fb58..bd027b7 100644
--- a/spec/unit/pluginHandler/common.spec.js
+++ b/spec/unit/pluginHandler/common.spec.js
@@ -38,23 +38,23 @@ var copyFile = common.__get__('copyFile');
var copyNewFile = common.__get__('copyNewFile');
var removeFileAndParents = common.__get__('removeFileAndParents');
-describe('common platform handler', function() {
- describe('copyFile', function() {
- it('Test #000 : should throw if source path not found', function(){
- expect(function(){copyFile('/some/dir', 'foo', project_dir, dest);})
+describe('common platform handler', function () {
+ describe('copyFile', function () {
+ it('Test #000 : should throw if source path not found', function () {
+ expect(function () { copyFile('/some/dir', 'foo', project_dir, dest); })
.toThrow(new Error('"' + path.resolve('/some/dir', 'foo') + '" not found!'));
});
- it('Test #001 : should throw if src not in plugin directory', function(){
+ it('Test #001 : should throw if src not in plugin directory', function () {
shell.mkdir('-p', project_dir);
fs.writeFileSync(non_plugin_file, 'contents', 'utf-8');
var outside_file = '../non_plugin_file';
- expect(function(){copyFile(test_dir, outside_file, project_dir, dest);}).
- toThrow(new Error('File "' + path.resolve(test_dir, outside_file) + '" is located outside the plugin directory "' + test_dir + '"'));
+ expect(function () { copyFile(test_dir, outside_file, project_dir, dest); })
+ .toThrow(new Error('File "' + path.resolve(test_dir, outside_file) + '" is located outside the plugin directory "' + test_dir + '"'));
shell.rm('-rf', test_dir);
});
- it('Test #002 : should allow symlink src, if inside plugin', function(){
+ it('Test #002 : should allow symlink src, if inside plugin', function () {
shell.mkdir('-p', java_dir);
fs.writeFileSync(java_file, 'contents', 'utf-8');
@@ -67,7 +67,7 @@ describe('common platform handler', function() {
shell.rm('-rf', project_dir);
});
- it('Test #003 : should throw if symlink is linked to a file outside the plugin', function(){
+ it('Test #003 : should throw if symlink is linked to a file outside the plugin', function () {
shell.mkdir('-p', java_dir);
fs.writeFileSync(non_plugin_file, 'contents', 'utf-8');
@@ -76,20 +76,20 @@ describe('common platform handler', function() {
return;
}
- expect(function(){copyFile(test_dir, symlink_file, project_dir, dest);}).
- toThrow(new Error('File "' + path.resolve(test_dir, symlink_file) + '" is located outside the plugin directory "' + test_dir + '"'));
+ expect(function () { copyFile(test_dir, symlink_file, project_dir, dest); })
+ .toThrow(new Error('File "' + path.resolve(test_dir, symlink_file) + '" is located outside the plugin directory "' + test_dir + '"'));
shell.rm('-rf', project_dir);
});
- it('Test #004 : should throw if dest is outside the project directory', function(){
+ it('Test #004 : should throw if dest is outside the project directory', function () {
shell.mkdir('-p', java_dir);
fs.writeFileSync(java_file, 'contents', 'utf-8');
- expect(function(){copyFile(test_dir, java_file, project_dir, non_plugin_file);})
+ expect(function () { copyFile(test_dir, java_file, project_dir, non_plugin_file); })
.toThrow(new Error('Destination "' + path.resolve(project_dir, non_plugin_file) + '" for source file "' + path.resolve(test_dir, java_file) + '" is located outside the project'));
shell.rm('-rf', project_dir);
});
- it('Test #005 : should call mkdir -p on target path', function(){
+ it('Test #005 : should call mkdir -p on target path', function () {
shell.mkdir('-p', java_dir);
fs.writeFileSync(java_file, 'contents', 'utf-8');
@@ -101,7 +101,7 @@ describe('common platform handler', function() {
shell.rm('-rf', project_dir);
});
- it('Test #006 : should call cp source/dest paths', function(){
+ it('Test #006 : should call cp source/dest paths', function () {
shell.mkdir('-p', java_dir);
fs.writeFileSync(java_file, 'contents', 'utf-8');
@@ -116,16 +116,16 @@ describe('common platform handler', function() {
});
describe('copyNewFile', function () {
- it('Test #007 : should throw if target path exists', function(){
+ it('Test #007 : should throw if target path exists', function () {
shell.mkdir('-p', dest);
- expect(function(){copyNewFile(test_dir, src, project_dir, dest);})
+ expect(function () { copyNewFile(test_dir, src, project_dir, dest); })
.toThrow(new Error('"' + dest + '" already exists!'));
shell.rm('-rf', dest);
});
});
- describe('deleteJava', function() {
- it('Test #008 : should call fs.unlinkSync on the provided paths', function(){
+ describe('deleteJava', function () {
+ it('Test #008 : should call fs.unlinkSync on the provided paths', function () {
shell.mkdir('-p', java_dir);
fs.writeFileSync(java_file, 'contents', 'utf-8');
@@ -137,21 +137,21 @@ describe('common platform handler', function() {
shell.rm('-rf', java_dir);
});
- it('Test #009 : should delete empty directories after removing source code in a java src path hierarchy', function(){
+ it('Test #009 : should delete empty directories after removing source code in a java src path hierarchy', function () {
shell.mkdir('-p', java_dir);
fs.writeFileSync(java_file, 'contents', 'utf-8');
removeFileAndParents(project_dir, java_file);
expect(fs.existsSync(java_file)).not.toBe(true);
expect(fs.existsSync(java_dir)).not.toBe(true);
- expect(fs.existsSync(path.join(src,'one'))).not.toBe(true);
+ expect(fs.existsSync(path.join(src, 'one'))).not.toBe(true);
shell.rm('-rf', java_dir);
});
});
});
-function ignoreEPERMonWin32(symlink_src, symlink_dest) {
+function ignoreEPERMonWin32 (symlink_src, symlink_dest) {
try {
fs.symlinkSync(symlink_src, symlink_dest);
} catch (e) {
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/a8692238/spec/unit/pluginHandler/windows.spec.js
----------------------------------------------------------------------
diff --git a/spec/unit/pluginHandler/windows.spec.js b/spec/unit/pluginHandler/windows.spec.js
index 11aa573..9364d14 100644
--- a/spec/unit/pluginHandler/windows.spec.js
+++ b/spec/unit/pluginHandler/windows.spec.js
@@ -37,7 +37,7 @@ var pluginInfo = require('../../../template/cordova/lib/PluginInfo').PluginInfo;
var dummyplugin = path.join(__dirname, '../fixtures/testProj/plugins/org.test.plugins.dummyplugin');
var testPlugin = path.join(__dirname, '../fixtures/testProj/plugins/testPlugin');
var dummyPluginInfo = new PluginInfo(dummyplugin);
-var testPluginInfo = new pluginInfo(testPlugin);
+var testPluginInfo = new pluginInfo(testPlugin); /* eslint new-cap : 0 */
var valid_source = dummyPluginInfo.getSourceFiles('windows');
var valid_resourceFiles = dummyPluginInfo.getResourceFiles('windows');
var valid_libfiles = dummyPluginInfo.getLibFiles('windows');
@@ -54,12 +54,11 @@ var resourcereferenceplugin = path.join(__dirname, '../fixtures/org.test.plugins
var resourcePluginInfo = new PluginInfo(resourcereferenceplugin);
var valid_resourcereferenceFiles = resourcePluginInfo.getResourceFiles('windows');
-
-function copyArray(arr) {
+function copyArray (arr) {
return Array.prototype.slice.call(arr, 0);
}
-function winJoin() {
+function winJoin () {
// use Node API when possible
if (path.win32) return path.win32.join.apply(path, arguments);
return copyArray(arguments).join('\\').replace(/\//g, '\\');
@@ -69,26 +68,25 @@ beforeEach(function () {
jasmine.addMatchers({
toContainXmlPath: function () {
return {
- compare: function(actual, expected) {
+ compare: function (actual, expected) {
var xml = actual;
var notText = this.isNot ? 'not ' : '';
var result = {};
result.pass = xml.find(expected) !== null;
- if(result.pass) {
+ if (result.pass) {
result.message = 'Expected xml \'' + et.tostring(xml) + '\' ' + notText + 'to contain elements matching \'' + actual + '\'.';
} else {
result.message = 'Expected xml \'' + et.tostring(xml) + '\' ' + notText + 'to not contain elements matching \'' + actual + '\'.';
}
- return result;
+ return result;
}
};
}
});
});
-
var getPluginFilePath = PluginHandler.__get__('getPluginFilePath');
-var computeResourcePath = function(resourceFile) {
+var computeResourcePath = function (resourceFile) {
return getPluginFilePath(dummyPluginInfo, resourceFile.src, cordovaProjectWindowsPlatformDir);
};
@@ -125,11 +123,11 @@ describe('windows project handler', function () {
PluginHandler.__set__('copyFile', copyFileSpy.and.callFake(copyFileOrig));
});
- afterEach(function() {
+ afterEach(function () {
PluginHandler.__set__('copyFile', copyFileOrig);
});
- function validateInstalledProjects(tag, elementToInstall, xpath, supportedPlatforms) {
+ function validateInstalledProjects (tag, elementToInstall, xpath, supportedPlatforms) {
var projects = copyArray(dummyProject.projects);
projects.push(dummyProject.master);
@@ -211,7 +209,7 @@ describe('windows project handler', function () {
copyFileSpy.and.callFake(copyFileOrig);
expect(function () {
install(source[1], faultyPluginInfo, dummyProject);
- }).toThrow(new Error ('"' + path.resolve(faultyplugin, 'src/windows/NotHere.js') + '" not found!'));
+ }).toThrow(new Error('"' + path.resolve(faultyplugin, 'src/windows/NotHere.js') + '" not found!'));
});
it('Test #002 : should throw if source-file target already exists', function () {
var source = copyArray(valid_source);
@@ -220,7 +218,7 @@ describe('windows project handler', function () {
fs.writeFileSync(target, 'some bs', 'utf-8');
expect(function () {
install(source[0], dummyPluginInfo, dummyProject);
- }).toThrow(new Error ('"' + target + '" already exists!'));
+ }).toThrow(new Error('"' + target + '" already exists!'));
});
});
@@ -238,7 +236,6 @@ describe('windows project handler', function () {
validateInstalledProjects('resource-file', resourceFiles[0], xpath, ['all']);
});
-
// project files, which is not needed.
it('Test #004 : should write to correct project files when conditions are specified', function () {
var xpath = 'Content[@Include="' + resourceFiles[1].target + '"]';
@@ -281,11 +278,11 @@ describe('windows project handler', function () {
it('Test #011 : should throw if conditions are invalid', function () {
expect(function () {
install(invalidResourceFiles[0], faultyPluginInfo, dummyProject);
- }).toThrow(new Error ('Invalid arch attribute (must be "x86", "x64" or "ARM"): x85'));
+ }).toThrow(new Error('Invalid arch attribute (must be "x86", "x64" or "ARM"): x85'));
expect(function () {
install(invalidResourceFiles[1], faultyPluginInfo, dummyProject);
- }).toThrow(new Error ('Invalid versions attribute (must be a valid semantic version range): 8.0a'));
+ }).toThrow(new Error('Invalid versions attribute (must be a valid semantic version range): 8.0a'));
expect(function () {
install(invalidResourceFiles[2], faultyPluginInfo, dummyProject);
@@ -320,15 +317,15 @@ describe('windows project handler', function () {
it('Test #016 : should throw if conditions are invalid', function () {
expect(function () {
install(invalidLibFiles[0], faultyPluginInfo, dummyProject);
- }).toThrow(new Error ('Invalid arch attribute (must be "x86", "x64" or "ARM"): x85'));
+ }).toThrow(new Error('Invalid arch attribute (must be "x86", "x64" or "ARM"): x85'));
expect(function () {
install(invalidLibFiles[1], faultyPluginInfo, dummyProject);
- }).toThrow(new Error ('Invalid versions attribute (must be a valid semantic version range): 8.0a'));
+ }).toThrow(new Error('Invalid versions attribute (must be a valid semantic version range): 8.0a'));
expect(function () {
install(invalidLibFiles[2], faultyPluginInfo, dummyProject);
- }).toThrow(new Error ('Invalid device-target attribute (must be "all", "phone", "windows" or "win"): daphne'));
+ }).toThrow(new Error('Invalid device-target attribute (must be "all", "phone", "windows" or "win"): daphne'));
});
});
@@ -367,49 +364,49 @@ describe('windows project handler', function () {
validateInstalledProjects('framework', frameworks[5], xpath, ['windows', 'windows10', 'phone']);
});
- it('Test #023 : with .winmd and .dll files', function() {
- var frameworks = copyArray(test_frameworks);
- var install = PluginHandler.getInstaller('framework');
- var uninstall = PluginHandler.getUninstaller('framework');
- var testProject = JsprojManager.getProject(testProjectWindowsPlatformDir);
+ it('Test #023 : with .winmd and .dll files', function () {
+ var frameworks = copyArray(test_frameworks);
+ var install = PluginHandler.getInstaller('framework');
+ var uninstall = PluginHandler.getUninstaller('framework');
+ var testProject = JsprojManager.getProject(testProjectWindowsPlatformDir);
- frameworks.forEach(function(framework) {
- install(framework, testPluginInfo, testProject);
- var dest = path.join('plugins', 'testPlugin', framework.targetDir || '', path.basename(framework.src));
- if (framework.implementation) {
- expect(copyFileSpy).toHaveBeenCalledWith(testPlugin, framework.implementation, testProjectWindowsPlatformDir, path.join(path.dirname(dest), path.basename(framework.implementation)));
- }
- });
+ frameworks.forEach(function (framework) {
+ install(framework, testPluginInfo, testProject);
+ var dest = path.join('plugins', 'testPlugin', framework.targetDir || '', path.basename(framework.src));
+ if (framework.implementation) {
+ expect(copyFileSpy).toHaveBeenCalledWith(testPlugin, framework.implementation, testProjectWindowsPlatformDir, path.join(path.dirname(dest), path.basename(framework.implementation)));
+ }
+ });
- var jsProjFileFromPlatform = path.join(testProjectWindowsPlatformDir, 'CordovaApp.Windows10.jsproj');
- var searchProjects = testProject._projects.filter(function(project) {
- return path.normalize(project.location) === jsProjFileFromPlatform;
- });
+ var jsProjFileFromPlatform = path.join(testProjectWindowsPlatformDir, 'CordovaApp.Windows10.jsproj');
+ var searchProjects = testProject._projects.filter(function (project) {
+ return path.normalize(project.location) === jsProjFileFromPlatform;
+ });
- expect(searchProjects.length).toBe(1);
- var projectXmlTree = searchProjects[0].xml;
+ expect(searchProjects.length).toBe(1);
+ var projectXmlTree = searchProjects[0].xml;
- var refHintPaths = projectXmlTree.findall('./ItemGroup/Reference/HintPath');
- var pathsEqual = refHintPaths.every(function(hintPath, index) {
+ var refHintPaths = projectXmlTree.findall('./ItemGroup/Reference/HintPath');
+ var pathsEqual = refHintPaths.every(function (hintPath, index) {
return path.basename(hintPath.text) === path.basename(frameworks[index].src);
- });
+ });
- expect(pathsEqual).toBeTruthy();
+ expect(pathsEqual).toBeTruthy();
- var refWinMdStatus = projectXmlTree.findall('./ItemGroup/Reference/IsWinMDFile');
- var allReferencesHaveMetadata = refWinMdStatus.every(function(isWinMd) {
- return isWinMd.text === 'true';
- });
+ var refWinMdStatus = projectXmlTree.findall('./ItemGroup/Reference/IsWinMDFile');
+ var allReferencesHaveMetadata = refWinMdStatus.every(function (isWinMd) {
+ return isWinMd.text === 'true';
+ });
- expect(allReferencesHaveMetadata).toBeTruthy();
+ expect(allReferencesHaveMetadata).toBeTruthy();
- var refImplements = projectXmlTree.findall('./ItemGroup/Reference/Implementation');
- expect(refImplements.length).toBe(1);
- expect(refImplements[0].text).toBe(path.basename(frameworks[1].implementation));
+ var refImplements = projectXmlTree.findall('./ItemGroup/Reference/Implementation');
+ expect(refImplements.length).toBe(1);
+ expect(refImplements[0].text).toBe(path.basename(frameworks[1].implementation));
- frameworks.forEach(function(framework) {
- uninstall(framework, testPluginInfo, testProject);
- });
+ frameworks.forEach(function (framework) {
+ uninstall(framework, testPluginInfo, testProject);
+ });
});
});
@@ -465,7 +462,7 @@ describe('windows project handler', function () {
});
});
- describe('of <js-module> elements', function() {
+ describe('of <js-module> elements', function () {
var jsModule = {src: 'www/dummyplugin.js'};
var wwwDest, platformWwwDest;
@@ -490,9 +487,10 @@ describe('windows project handler', function () {
});
});
- describe('of <asset> elements', function() {
+ describe('of <asset> elements', function () {
var asset = {src: 'www/dummyplugin.js', target: 'foo/dummy.js'};
- var wwwDest, platformWwwDest;
+ var wwwDest; /* eslint no-unused-vars : 0 */
+ var platformWwwDest; /* eslint no-unused-vars : 0 */
var install = PluginHandler.getInstaller('asset');
beforeEach(function () {
@@ -527,7 +525,7 @@ describe('windows project handler', function () {
PluginHandler.__set__('removeFile', removeFileOrig);
});
- function validateUninstalledProjects(tag, elementToUninstall, xmlPath, incText, targetConditions, supportedPlatforms) {
+ function validateUninstalledProjects (tag, elementToUninstall, xmlPath, incText, targetConditions, supportedPlatforms) {
var projects = copyArray(dummyProject.projects);
projects.push(dummyProject.master);
@@ -583,7 +581,7 @@ describe('windows project handler', function () {
it('Test #032 : should remove from correct project files when conditions specified', function () {
var resourcefiles = copyArray(valid_resourceFiles);
- resourcefiles.forEach(function(resourceFile) {
+ resourcefiles.forEach(function (resourceFile) {
install(resourceFile, dummyPluginInfo, dummyProject);
});
var path = 'ItemGroup/Content';
@@ -595,7 +593,7 @@ describe('windows project handler', function () {
it('Test #033 : should remove from correct project files when conditions specified', function () {
var resourcefiles = copyArray(valid_resourceFiles);
- resourcefiles.forEach(function(resourceFile) {
+ resourcefiles.forEach(function (resourceFile) {
install(resourceFile, dummyPluginInfo, dummyProject);
});
var path = 'ItemGroup/Content';
@@ -607,7 +605,7 @@ describe('windows project handler', function () {
it('Test #034 : should remove from correct project files when conditions specified', function () {
var resourcefiles = copyArray(valid_resourceFiles);
- resourcefiles.forEach(function(resourceFile) {
+ resourcefiles.forEach(function (resourceFile) {
install(resourceFile, dummyPluginInfo, dummyProject);
});
var path = 'ItemGroup/Content';
@@ -618,7 +616,7 @@ describe('windows project handler', function () {
it('Test #035 : should remove from correct project files when conditions specified', function () {
var resourcefiles = copyArray(valid_resourceFiles);
- resourcefiles.forEach(function(resourceFile) {
+ resourcefiles.forEach(function (resourceFile) {
install(resourceFile, dummyPluginInfo, dummyProject);
});
var path = 'ItemGroup/Content';
@@ -630,7 +628,7 @@ describe('windows project handler', function () {
it('Test #036 : should remove from correct project files when conditions specified with reference', function () {
var resourcereferencefiles = copyArray(valid_resourcereferenceFiles);
- resourcereferencefiles.forEach(function(resourceFile) {
+ resourcereferencefiles.forEach(function (resourceFile) {
install(resourceFile, resourcePluginInfo, dummyProject);
});
var path = 'ItemGroup/Content';
@@ -641,7 +639,7 @@ describe('windows project handler', function () {
it('Test #036 : should remove from correct project files when conditions specified with reference', function () {
var resourcereferencefiles = copyArray(valid_resourcereferenceFiles);
- resourcereferencefiles.forEach(function(resourceFile) {
+ resourcereferencefiles.forEach(function (resourceFile) {
install(resourceFile, resourcePluginInfo, dummyProject);
});
var path = 'ItemGroup/Content';
@@ -653,7 +651,7 @@ describe('windows project handler', function () {
it('Test #036 : should remove from correct project files when conditions specified with reference', function () {
var resourcereferencefiles = copyArray(valid_resourcereferenceFiles);
- resourcereferencefiles.forEach(function(resourceFile) {
+ resourcereferencefiles.forEach(function (resourceFile) {
install(resourceFile, resourcePluginInfo, dummyProject);
});
var path = 'ItemGroup/Content';
@@ -665,7 +663,7 @@ describe('windows project handler', function () {
it('Test #036 : should remove from correct project files when conditions specified with reference', function () {
var resourcereferencefiles = copyArray(valid_resourcereferenceFiles);
- resourcereferencefiles.forEach(function(resourceFile) {
+ resourcereferencefiles.forEach(function (resourceFile) {
install(resourceFile, resourcePluginInfo, dummyProject);
});
var path = 'ItemGroup/Content';
@@ -680,7 +678,7 @@ describe('windows project handler', function () {
// project files, which is not needed.
it('Test #033 : should remove from correct project files when conditions specified', function () {
var libfiles = copyArray(valid_libfiles);
- libfiles.forEach(function(libfile) {
+ libfiles.forEach(function (libfile) {
PluginHandler.getInstaller('lib-file')(libfile, dummyPluginInfo, dummyProject);
});
@@ -692,7 +690,7 @@ describe('windows project handler', function () {
it('Test #034 : should remove from correct project files when conditions specified', function () {
var libfiles = copyArray(valid_libfiles);
- libfiles.forEach(function(libfile) {
+ libfiles.forEach(function (libfile) {
PluginHandler.getInstaller('lib-file')(libfile, dummyPluginInfo, dummyProject);
});
@@ -704,7 +702,7 @@ describe('windows project handler', function () {
it('Test #035 : should remove from correct project files when conditions specified', function () {
var libfiles = copyArray(valid_libfiles);
- libfiles.forEach(function(libfile) {
+ libfiles.forEach(function (libfile) {
PluginHandler.getInstaller('lib-file')(libfile, dummyPluginInfo, dummyProject);
});
@@ -716,7 +714,7 @@ describe('windows project handler', function () {
it('Test #036 : should remove from correct project files when conditions specified', function () {
var libfiles = copyArray(valid_libfiles);
- libfiles.forEach(function(libfile) {
+ libfiles.forEach(function (libfile) {
PluginHandler.getInstaller('lib-file')(libfile, dummyPluginInfo, dummyProject);
});
@@ -727,7 +725,7 @@ describe('windows project handler', function () {
});
});
- describe('of <framework> elements', function () {
+ describe('of <framework> elements', function () {
// This could be separated into individual specs, but that results in a lot of copying and deleting the
// project files, which is not needed.
it('Test #037 : should remove from correct project files when conditions specified', function () {
@@ -737,7 +735,7 @@ describe('windows project handler', function () {
var frameworks = copyArray(valid_frameworks);
- frameworks.forEach(function(framework) {
+ frameworks.forEach(function (framework) {
PluginHandler.getInstaller('framework')(framework, dummyPluginInfo, dummyProject);
});
@@ -756,7 +754,7 @@ describe('windows project handler', function () {
var frameworks = copyArray(valid_frameworks);
- frameworks.forEach(function(framework) {
+ frameworks.forEach(function (framework) {
PluginHandler.getInstaller('framework')(framework, dummyPluginInfo, dummyProject);
});
@@ -774,7 +772,7 @@ describe('windows project handler', function () {
var frameworks = copyArray(valid_frameworks);
- frameworks.forEach(function(framework) {
+ frameworks.forEach(function (framework) {
PluginHandler.getInstaller('framework')(framework, dummyPluginInfo, dummyProject);
});
@@ -792,7 +790,7 @@ describe('windows project handler', function () {
var frameworks = copyArray(valid_frameworks);
- frameworks.forEach(function(framework) {
+ frameworks.forEach(function (framework) {
PluginHandler.getInstaller('framework')(framework, dummyPluginInfo, dummyProject);
});
@@ -810,7 +808,7 @@ describe('windows project handler', function () {
var frameworks = copyArray(valid_frameworks);
- frameworks.forEach(function(framework) {
+ frameworks.forEach(function (framework) {
PluginHandler.getInstaller('framework')(framework, dummyPluginInfo, dummyProject);
});
@@ -828,7 +826,7 @@ describe('windows project handler', function () {
var frameworks = copyArray(valid_frameworks);
- frameworks.forEach(function(framework) {
+ frameworks.forEach(function (framework) {
PluginHandler.getInstaller('framework')(framework, dummyPluginInfo, dummyProject);
});
@@ -851,7 +849,7 @@ describe('windows project handler', function () {
var frameworks = copyArray(valid_frameworks);
- frameworks.forEach(function(framework) {
+ frameworks.forEach(function (framework) {
PluginHandler.getInstaller('framework')(framework, dummyPluginInfo, dummyProject);
});
@@ -869,7 +867,7 @@ describe('windows project handler', function () {
var frameworks = copyArray(valid_frameworks);
- frameworks.forEach(function(framework) {
+ frameworks.forEach(function (framework) {
PluginHandler.getInstaller('framework')(framework, dummyPluginInfo, dummyProject);
});
@@ -889,7 +887,7 @@ describe('windows project handler', function () {
var frameworks = copyArray(valid_frameworks);
- frameworks.forEach(function(framework) {
+ frameworks.forEach(function (framework) {
PluginHandler.getInstaller('framework')(framework, dummyPluginInfo, dummyProject);
});
@@ -909,7 +907,7 @@ describe('windows project handler', function () {
var frameworks = copyArray(valid_frameworks);
- frameworks.forEach(function(framework) {
+ frameworks.forEach(function (framework) {
PluginHandler.getInstaller('framework')(framework, dummyPluginInfo, dummyProject);
});
@@ -923,7 +921,7 @@ describe('windows project handler', function () {
});
});
- describe('of <js-module> elements', function() {
+ describe('of <js-module> elements', function () {
var jsModule = {src: 'www/dummyPlugin.js'};
var wwwDest, platformWwwDest;
@@ -937,7 +935,7 @@ describe('windows project handler', function () {
var existsSyncOrig = fs.existsSync;
spyOn(fs, 'existsSync').and.callFake(function (file) {
- if ([wwwDest, platformWwwDest].indexOf(file) >= 0 ) return true;
+ if ([wwwDest, platformWwwDest].indexOf(file) >= 0) return true;
return existsSyncOrig.call(fs, file);
});
});
@@ -955,7 +953,7 @@ describe('windows project handler', function () {
});
});
- describe('of <asset> elements', function() {
+ describe('of <asset> elements', function () {
var asset = {src: 'www/dummyPlugin.js', target: 'foo/dummy.js'};
var wwwDest, platformWwwDest;
var uninstall = PluginHandler.getUninstaller('asset');
@@ -968,7 +966,7 @@ describe('windows project handler', function () {
var existsSyncOrig = fs.existsSync;
spyOn(fs, 'existsSync').and.callFake(function (file) {
- if ([wwwDest, platformWwwDest].indexOf(file) >= 0 ) return true;
+ if ([wwwDest, platformWwwDest].indexOf(file) >= 0) return true;
return existsSyncOrig.call(fs, file);
});
});
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/a8692238/spec/unit/run.spec.js
----------------------------------------------------------------------
diff --git a/spec/unit/run.spec.js b/spec/unit/run.spec.js
index a17b58f..82d2078 100644
--- a/spec/unit/run.spec.js
+++ b/spec/unit/run.spec.js
@@ -17,24 +17,24 @@
under the License.
*/
-var Q = require('q'),
- path = require('path'),
- rewire = require('rewire'),
- platformRoot = '../../template',
- buildPath = path.join(platformRoot, 'cordova', 'build'),
- run = rewire(platformRoot + '/cordova/lib/run.js');
+var Q = require('q');
+var path = require('path');
+var rewire = require('rewire');
+var platformRoot = '../../template';
+var buildPath = path.join(platformRoot, 'cordova', 'build');
+var run = rewire(platformRoot + '/cordova/lib/run.js');
var utils = require(path.join(platformRoot, 'cordova/lib/utils'));
var packages = require(path.join(platformRoot, 'cordova/lib/package'));
-describe('run method', function() {
- var consoleLogOriginal,
- isCordovaProjectOriginal,
- buildRunOriginal,
- getPackageOriginal,
- deployToPhoneOriginal,
- deployToDesktopOriginal,
- ranWithElevatedPermissionsOriginal;
+describe('run method', function () {
+ var consoleLogOriginal;
+ var isCordovaProjectOriginal;
+ var buildRunOriginal;
+ var getPackageOriginal;
+ var deployToPhoneOriginal;
+ var deployToDesktopOriginal;
+ var ranWithElevatedPermissionsOriginal;
var isCordovaProjectFalse = function () {
return false;
@@ -47,7 +47,7 @@ describe('run method', function() {
beforeEach(function () {
// console output suppression
consoleLogOriginal = run.__get__('console.log');
- run.__set__('console.log', function () {} );
+ run.__set__('console.log', function () {});
isCordovaProjectOriginal = run.__get__('utils.isCordovaProject');
buildRunOriginal = run.__get__('build.run');
@@ -58,7 +58,7 @@ describe('run method', function() {
run.__set__('ranWithElevatedPermissions', function () { return false; });
});
- afterEach(function() {
+ afterEach(function () {
run.__set__('console.log', consoleLogOriginal);
run.__set__('utils.isCordovaProject', isCordovaProjectOriginal);
run.__set__('build.run', buildRunOriginal);
@@ -68,7 +68,7 @@ describe('run method', function() {
run.__set__('ranWithElevatedPermissions', ranWithElevatedPermissionsOriginal);
});
- it('spec.1 should not run if not launched from project directory', function(done) {
+ it('spec.1 should not run if not launched from project directory', function (done) {
var buildRun = jasmine.createSpy();
run.__set__('utils.isCordovaProject', isCordovaProjectFalse);
@@ -78,13 +78,13 @@ describe('run method', function() {
});
run.run([ 'node', buildPath ])
- .finally(function() {
- expect(buildRun).not.toHaveBeenCalled();
- done();
- });
+ .finally(function () {
+ expect(buildRun).not.toHaveBeenCalled();
+ done();
+ });
});
- it('spec.2 should not run if both debug and release args are specified', function(done) {
+ it('spec.2 should not run if both debug and release args are specified', function (done) {
var buildRun = jasmine.createSpy();
run.__set__('utils.isCordovaProject', isCordovaProjectTrue);
@@ -94,13 +94,13 @@ describe('run method', function() {
});
run.run({ release: true, debug: true })
- .finally(function() {
- expect(buildRun).not.toHaveBeenCalled();
- done();
- });
+ .finally(function () {
+ expect(buildRun).not.toHaveBeenCalled();
+ done();
+ });
});
- it('spec.3 should not run if device and emulator args are combined', function(done) {
+ it('spec.3 should not run if device and emulator args are combined', function (done) {
var buildRun = jasmine.createSpy();
run.__set__('utils.isCordovaProject', isCordovaProjectTrue);
@@ -110,13 +110,13 @@ describe('run method', function() {
});
run.run({ device: true, emulator: true })
- .finally(function() {
- expect(buildRun).not.toHaveBeenCalled();
- done();
- });
+ .finally(function () {
+ expect(buildRun).not.toHaveBeenCalled();
+ done();
+ });
});
- it('spec.4 should not run if device and target args are combined', function(done) {
+ it('spec.4 should not run if device and target args are combined', function (done) {
var buildRun = jasmine.createSpy();
run.__set__('utils.isCordovaProject', isCordovaProjectTrue);
@@ -126,29 +126,29 @@ describe('run method', function() {
});
run.run({ device: true, target: 'sometargethere' })
- .finally(function() {
- expect(buildRun).not.toHaveBeenCalled();
- done();
- });
+ .finally(function () {
+ expect(buildRun).not.toHaveBeenCalled();
+ done();
+ });
});
- it('spec.5 should build and deploy on phone if --phone arg specified', function(done) {
- var build = jasmine.createSpy(),
- deployToPhone = jasmine.createSpy(),
- deployToDesktop = jasmine.createSpy(),
- failed = jasmine.createSpy();
+ it('spec.5 should build and deploy on phone if --phone arg specified', function (done) {
+ var build = jasmine.createSpy();
+ var deployToPhone = jasmine.createSpy();
+ var deployToDesktop = jasmine.createSpy();
+ var failed = jasmine.createSpy();
run.__set__('utils.isCordovaProject', isCordovaProjectTrue);
run.__set__('build.run', function () {
build();
var buildResult = {
- type : 'phone',
- arch : 'arm',
- archs : ['arm'],
- buildtype : 'release',
- appx : 'testfile',
- script : 'testfile.ps1',
- phoneId : 'undefined'
+ type: 'phone',
+ arch: 'arm',
+ archs: ['arm'],
+ buildtype: 'release',
+ appx: 'testfile',
+ script: 'testfile.ps1',
+ phoneId: 'undefined'
};
return Q(buildResult);
});
@@ -158,42 +158,42 @@ describe('run method', function() {
file: 'testfile'
});
});
- run.__set__('packages.deployToPhone', function() {
+ run.__set__('packages.deployToPhone', function () {
deployToPhone();
return Q();
});
- run.__set__('packages.deployToDesktop', function() {
+ run.__set__('packages.deployToDesktop', function () {
deployToDesktop();
return Q();
});
run.run([ 'node', buildPath, '--phone', '--break' ])
- .catch(failed)
- .finally(function(){
- expect(failed).not.toHaveBeenCalled();
- expect(build).toHaveBeenCalled();
- expect(deployToPhone).toHaveBeenCalled();
- expect(deployToDesktop).not.toHaveBeenCalled();
- done();
- });
+ .catch(failed)
+ .finally(function () {
+ expect(failed).not.toHaveBeenCalled();
+ expect(build).toHaveBeenCalled();
+ expect(deployToPhone).toHaveBeenCalled();
+ expect(deployToDesktop).not.toHaveBeenCalled();
+ done();
+ });
});
- it('spec.6 should build and deploy on desktop if --phone arg is not specified', function(done) {
- var build = jasmine.createSpy(),
- deployToPhone = jasmine.createSpy(),
- deployToDesktop = jasmine.createSpy();
+ it('spec.6 should build and deploy on desktop if --phone arg is not specified', function (done) {
+ var build = jasmine.createSpy();
+ var deployToPhone = jasmine.createSpy();
+ var deployToDesktop = jasmine.createSpy();
run.__set__('utils.isCordovaProject', isCordovaProjectTrue);
run.__set__('build.run', function () {
build();
var buildResult = {
- type : 'windows',
- arch : 'anycpu',
- archs : ['anycpu'],
- buildtype : 'release',
- appx : 'testfile',
- script : 'testfile.ps1',
- phoneId : 'undefined'
+ type: 'windows',
+ arch: 'anycpu',
+ archs: ['anycpu'],
+ buildtype: 'release',
+ appx: 'testfile',
+ script: 'testfile.ps1',
+ phoneId: 'undefined'
};
return Q(buildResult);
});
@@ -203,27 +203,27 @@ describe('run method', function() {
file: 'testfile'
});
});
- run.__set__('packages.deployToPhone', function() {
+ run.__set__('packages.deployToPhone', function () {
deployToPhone();
return Q();
});
- run.__set__('packages.deployToDesktop', function() {
+ run.__set__('packages.deployToDesktop', function () {
deployToDesktop();
return Q();
});
run.run([ 'node', buildPath ])
- .finally(function() {
- expect(build).toHaveBeenCalled();
- expect(deployToDesktop).toHaveBeenCalled();
- expect(deployToPhone).not.toHaveBeenCalled();
- done();
- });
+ .finally(function () {
+ expect(build).toHaveBeenCalled();
+ expect(deployToDesktop).toHaveBeenCalled();
+ expect(deployToPhone).not.toHaveBeenCalled();
+ done();
+ });
});
- it('spec. 7 should not call build if --nobuild specified', function(done) {
- var build = jasmine.createSpy(),
- deployToDesktop = jasmine.createSpy();
+ it('spec. 7 should not call build if --nobuild specified', function (done) {
+ var build = jasmine.createSpy();
+ var deployToDesktop = jasmine.createSpy();
run.__set__('utils.isCordovaProject', isCordovaProjectTrue);
run.__set__('build.run', function () {
@@ -236,20 +236,20 @@ describe('run method', function() {
file: 'testfile'
});
});
- run.__set__('packages.deployToDesktop', function() {
+ run.__set__('packages.deployToDesktop', function () {
deployToDesktop();
return Q();
});
run.run({ nobuild: true })
- .finally(function() {
- expect(deployToDesktop).toHaveBeenCalled();
- expect(build).not.toHaveBeenCalled();
- done();
- });
+ .finally(function () {
+ expect(deployToDesktop).toHaveBeenCalled();
+ expect(build).not.toHaveBeenCalled();
+ done();
+ });
});
- it('spec.8 should accept --archs parameter either as cli or as platform arg', function(done) {
+ it('spec.8 should accept --archs parameter either as cli or as platform arg', function (done) {
spyOn(utils, 'isCordovaProject').and.returnValue(true);
spyOn(packages, 'getPackage').and.returnValue(Q({ arch: 'arm' }));
@@ -259,30 +259,30 @@ describe('run method', function() {
var expectedDeployOptions = jasmine.objectContaining({arch: 'arm'});
var fail = jasmine.createSpy('fail')
- .and.callFake(function (err) {
- console.error(err);
- });
+ .and.callFake(function (err) {
+ console.error(err);
+ });
- run.run({nobuild: true, argv: ['--archs=arm'] })
- .then(function () {
- expect(packages.getPackage).toHaveBeenCalledWith(anyString, anyString, 'arm');
- expect(packages.deployToDesktop).toHaveBeenCalledWith(expectedDeployOptions, anyString, anyString);
- })
- .then(function () {
- return run.run({nobuild: true, archs: 'arm' });
- })
- .then(function () {
- expect(packages.getPackage).toHaveBeenCalledWith(anyString, anyString, 'arm');
- expect(packages.deployToDesktop).toHaveBeenCalledWith(expectedDeployOptions, anyString, anyString);
- })
- .catch(fail)
- .finally(function() {
- expect(fail).not.toHaveBeenCalled();
- done();
- });
+ run.run({ nobuild: true, argv: ['--archs=arm'] })
+ .then(function () {
+ expect(packages.getPackage).toHaveBeenCalledWith(anyString, anyString, 'arm');
+ expect(packages.deployToDesktop).toHaveBeenCalledWith(expectedDeployOptions, anyString, anyString);
+ })
+ .then(function () {
+ return run.run({ nobuild: true, archs: 'arm' });
+ })
+ .then(function () {
+ expect(packages.getPackage).toHaveBeenCalledWith(anyString, anyString, 'arm');
+ expect(packages.deployToDesktop).toHaveBeenCalledWith(expectedDeployOptions, anyString, anyString);
+ })
+ .catch(fail)
+ .finally(function () {
+ expect(fail).not.toHaveBeenCalled();
+ done();
+ });
});
- it('spec.9 should fall back to anycpu if --archs parameter is not specified', function(done) {
+ it('spec.9 should fall back to anycpu if --archs parameter is not specified', function (done) {
spyOn(utils, 'isCordovaProject').and.returnValue(true);
spyOn(packages, 'getPackage').and.returnValue(Q({ arch: 'anycpu' }));
@@ -294,14 +294,14 @@ describe('run method', function() {
var fail = jasmine.createSpy('fail');
run.run({nobuild: true})
- .then(function () {
- expect(packages.getPackage).toHaveBeenCalledWith(anyString, anyString, 'anycpu');
- expect(packages.deployToDesktop).toHaveBeenCalledWith(expectedDeployOptions, anyString, anyString);
- })
- .catch(fail)
- .finally(function() {
- expect(fail).not.toHaveBeenCalled();
- done();
- });
+ .then(function () {
+ expect(packages.getPackage).toHaveBeenCalledWith(anyString, anyString, 'anycpu');
+ expect(packages.deployToDesktop).toHaveBeenCalledWith(expectedDeployOptions, anyString, anyString);
+ })
+ .catch(fail)
+ .finally(function () {
+ expect(fail).not.toHaveBeenCalled();
+ done();
+ });
});
});
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/a8692238/template/cordova/Api.js
----------------------------------------------------------------------
diff --git a/template/cordova/Api.js b/template/cordova/Api.js
index 125e3c5..f086d47 100644
--- a/template/cordova/Api.js
+++ b/template/cordova/Api.js
@@ -29,7 +29,7 @@ var PluginInfoProvider = require('cordova-common').PluginInfoProvider;
var PLATFORM = 'windows';
-function setupEvents(externalEventEmitter) {
+function setupEvents (externalEventEmitter) {
if (externalEventEmitter) {
// This will make the platform internal events visible outside
events.forwardEventsTo(externalEventEmitter);
@@ -52,7 +52,7 @@ function setupEvents(externalEventEmitter) {
*
* * platform: String that defines a platform name.
*/
-function Api(platform, platformRootDir, eventEmitter) {
+function Api (platform, platformRootDir, eventEmitter) {
this.platform = PLATFORM;
this.root = path.resolve(__dirname, '..');
@@ -96,15 +96,14 @@ Api.createPlatform = function (destinationDir, projectConfig, options, events) {
try {
result = require('../../bin/lib/create')
- .create(destinationDir, projectConfig, options)
- .then(function () {
- var PlatformApi = require(path.resolve(destinationDir, 'cordova/Api'));
- return new PlatformApi(PLATFORM, destinationDir, events);
- });
- }
- catch(e) {
- events.emit('error','createPlatform is not callable from the windows project API.');
- throw(e);
+ .create(destinationDir, projectConfig, options)
+ .then(function () {
+ var PlatformApi = require(path.resolve(destinationDir, 'cordova/Api'));
+ return new PlatformApi(PLATFORM, destinationDir, events);
+ });
+ } catch (e) {
+ events.emit('error', 'createPlatform is not callable from the windows project API.');
+ throw (e);
}
return result;
@@ -129,15 +128,14 @@ Api.updatePlatform = function (destinationDir, options, events) {
setupEvents(events);
try {
return require('../../bin/lib/update')
- .update(destinationDir, options)
- .then(function () {
- var PlatformApi = require(path.resolve(destinationDir, 'cordova/Api'));
- return new PlatformApi(PLATFORM, destinationDir, events);
- });
- }
- catch(e) {
- events.emit('error','updatePlatform is not callable from the windows project API.');
- throw(e);
+ .update(destinationDir, options)
+ .then(function () {
+ var PlatformApi = require(path.resolve(destinationDir, 'cordova/Api'));
+ return new PlatformApi(PLATFORM, destinationDir, events);
+ });
+ } catch (e) {
+ events.emit('error', 'updatePlatform is not callable from the windows project API.');
+ throw (e);
}
};
@@ -309,13 +307,13 @@ Api.prototype.removePlugin = function (plugin, uninstallOptions) {
* there could be multiple items in output array, e.g. when multiple
* arhcitectures is specified.
*/
-Api.prototype.build = function(buildOptions) {
+Api.prototype.build = function (buildOptions) {
// TODO: Should we run check_reqs first? Android does this, but Windows appears doesn't.
return require('./lib/build').run.call(this, buildOptions)
- .then(function (result) {
- // Wrap result into array according to PlatformApi spec
- return [result];
- });
+ .then(function (result) {
+ // Wrap result into array according to PlatformApi spec
+ return [result];
+ });
};
/**
@@ -330,7 +328,7 @@ Api.prototype.build = function(buildOptions) {
* @return {Promise} A promise either fulfilled if package was built and ran
* successfully, or rejected with CordovaError.
*/
-Api.prototype.run = function(runOptions) {
+Api.prototype.run = function (runOptions) {
// TODO: Should we run check_reqs first? Android does this, but Windows appears doesn't.
return require('./lib/run').run.call(this, runOptions);
};
@@ -341,12 +339,12 @@ Api.prototype.run = function(runOptions) {
* @return {Promise} Return a promise either fulfilled, or rejected with
* CordovaError.
*/
-Api.prototype.clean = function(cleanOpts) {
+Api.prototype.clean = function (cleanOpts) {
var self = this;
return require('./lib/build').clean.call(this, cleanOpts)
- .then(function () {
- return require('./lib/prepare').clean.call(self, cleanOpts);
- });
+ .then(function () {
+ return require('./lib/prepare').clean.call(self, cleanOpts);
+ });
};
/**
@@ -357,7 +355,7 @@ Api.prototype.clean = function(cleanOpts) {
* @return {Promise<Requirement[]>} Promise, resolved with set of Requirement
* objects for current platform.
*/
-Api.prototype.requirements = function() {
+Api.prototype.requirements = function () {
return require('./lib/check_reqs').check_all();
};
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/a8692238/template/cordova/lib/AppxManifest.js
----------------------------------------------------------------------
diff --git a/template/cordova/lib/AppxManifest.js b/template/cordova/lib/AppxManifest.js
index 4b478de..dcd9d25 100644
--- a/template/cordova/lib/AppxManifest.js
+++ b/template/cordova/lib/AppxManifest.js
@@ -21,22 +21,22 @@ var fs = require('fs');
var util = require('util');
var et = require('elementtree');
var path = require('path');
-var xml= require('cordova-common').xmlHelpers;
+var xml = require('cordova-common').xmlHelpers;
var UAP_RESTRICTED_CAPS = ['enterpriseAuthentication', 'sharedUserCertificates',
- 'documentsLibrary', 'musicLibrary', 'picturesLibrary',
- 'videosLibrary', 'removableStorage', 'internetClientClientServer',
- 'privateNetworkClientServer'];
+ 'documentsLibrary', 'musicLibrary', 'picturesLibrary',
+ 'videosLibrary', 'removableStorage', 'internetClientClientServer',
+ 'privateNetworkClientServer'];
// UAP namespace capabilities come from the XSD type ST_Capability_Uap from AppxManifestTypes.xsd
-var CAPS_NEEDING_UAPNS = ['documentsLibrary', 'picturesLibrary', 'videosLibrary',
- 'musicLibrary', 'enterpriseAuthentication', 'sharedUserCertificates',
- 'removableStorage', 'appointments', 'contacts', 'userAccountInformation',
- 'phoneCall', 'blockedChatMessages', 'objects3D'];
+var CAPS_NEEDING_UAPNS = ['documentsLibrary', 'picturesLibrary', 'videosLibrary',
+ 'musicLibrary', 'enterpriseAuthentication', 'sharedUserCertificates',
+ 'removableStorage', 'appointments', 'contacts', 'userAccountInformation',
+ 'phoneCall', 'blockedChatMessages', 'objects3D'];
var KNOWN_ORIENTATIONS = {
- 'default': ['portrait', 'landscape', 'landscapeFlipped'],
- 'portrait': ['portrait'],
+ 'default': ['portrait', 'landscape', 'landscapeFlipped'],
+ 'portrait': ['portrait'],
'landscape': ['landscape', 'landscapeFlipped']
};
@@ -58,7 +58,7 @@ var manifestCache = {};
* @param {string} prefix A namespace prefix used to prepend some elements.
* Depends on manifest type.
*/
-function AppxManifest(path, prefix) {
+function AppxManifest (path, prefix) {
this.path = path;
// Append ':' to prefix if needed
prefix = prefix || '';
@@ -101,13 +101,13 @@ AppxManifest.get = function (fileName, ignoreCache) {
var root = xml.parseElementtreeSync(fileName).getroot();
var prefixes = Object.keys(root.attrib)
- .reduce(function (result, attrib) {
- if (attrib.indexOf('xmlns') === 0 && attrib !== 'xmlns:mp' && attrib !== 'xmlns:uap3') {
- result.push(attrib.replace('xmlns', '').replace(':', ''));
- }
+ .reduce(function (result, attrib) {
+ if (attrib.indexOf('xmlns') === 0 && attrib !== 'xmlns:mp' && attrib !== 'xmlns:uap3') {
+ result.push(attrib.replace('xmlns', '').replace(':', ''));
+ }
- return result;
- }, []).sort();
+ return result;
+ }, []).sort();
var prefix = prefixes[prefixes.length - 1];
var Manifest = prefix === 'uap' ? Win10AppxManifest : AppxManifest;
@@ -141,8 +141,7 @@ AppxManifest.purgeCache = function (cacheKeys) {
AppxManifest.prototype.getPhoneIdentity = function () {
var phoneIdentity = this.doc.getroot().find('./mp:PhoneIdentity');
- if (!phoneIdentity)
- throw new Error('Failed to find PhoneIdentity element in appxmanifest at ' + this.path);
+ if (!phoneIdentity) { throw new Error('Failed to find PhoneIdentity element in appxmanifest at ' + this.path); }
return {
getPhoneProductId: function () {
@@ -158,8 +157,7 @@ AppxManifest.prototype.getPhoneIdentity = function () {
AppxManifest.prototype.getIdentity = function () {
var identity = this.doc.getroot().find('./Identity');
- if (!identity)
- throw new Error('Failed to find "Identity" node. The appxmanifest at ' + this.path + ' is invalid');
+ if (!identity) { throw new Error('Failed to find "Identity" node. The appxmanifest at ' + this.path + ' is invalid'); }
return {
getName: function () {
@@ -182,10 +180,10 @@ AppxManifest.prototype.getIdentity = function () {
return identity.attrib.Version;
},
setVersion: function (version) {
- if (!version) throw new TypeError('Identity.Version attribute must be non-empty in appxmanifest at ' + this.path );
+ if (!version) throw new TypeError('Identity.Version attribute must be non-empty in appxmanifest at ' + this.path);
// Adjust version number as per CB-5337 Windows8 build fails due to invalid app version
- if(version && version.match(/\.\d/g)) {
+ if (version && version.match(/\.\d/g)) {
var numVersionComponents = version.match(/\.\d/g).length + 1;
while (numVersionComponents++ < 4) {
version += '.0';
@@ -201,8 +199,7 @@ AppxManifest.prototype.getIdentity = function () {
AppxManifest.prototype.getProperties = function () {
var properties = this.doc.getroot().find('./Properties');
- if (!properties)
- throw new Error('Failed to find "Properties" node. The appxmanifest at ' + this.path + ' is invalid');
+ if (!properties) { throw new Error('Failed to find "Properties" node. The appxmanifest at ' + this.path + ' is invalid'); }
return {
getDisplayName: function () {
@@ -260,14 +257,13 @@ AppxManifest.prototype.getProperties = function () {
description.text = processDescription(text);
return this;
- },
+ }
};
};
AppxManifest.prototype.getApplication = function () {
var application = this.doc.getroot().find('./Applications/Application');
- if (!application)
- throw new Error('Failed to find "Application" element. The appxmanifest at ' + this.path + ' is invalid');
+ if (!application) { throw new Error('Failed to find "Application" element. The appxmanifest at ' + this.path + ' is invalid'); }
var self = this;
@@ -316,7 +312,7 @@ AppxManifest.prototype.getApplication = function () {
appUriRules = new et.Element('ApplicationContentUriRules');
application.append(appUriRules);
- rules.forEach(function(rule) {
+ rules.forEach(function (rule) {
appUriRules.append(new et.Element('Rule', {Match: rule, Type: 'include'}));
});
@@ -328,10 +324,9 @@ AppxManifest.prototype.getApplication = function () {
AppxManifest.prototype.getVisualElements = function () {
var self = this;
var visualElements = this.doc.getroot().find('./Applications/Application/' +
- this.prefix + 'VisualElements');
+ this.prefix + 'VisualElements');
- if (!visualElements)
- throw new Error('Failed to find "VisualElements" node. The appxmanifest at ' + this.path + ' is invalid');
+ if (!visualElements) { throw new Error('Failed to find "VisualElements" node. The appxmanifest at ' + this.path + ' is invalid'); }
return {
_node: visualElements,
@@ -350,7 +345,7 @@ AppxManifest.prototype.getVisualElements = function () {
});
},
setOrientation: function (orientation) {
- if (!orientation || orientation === ''){
+ if (!orientation || orientation === '') {
orientation = 'default';
}
@@ -363,7 +358,7 @@ AppxManifest.prototype.getVisualElements = function () {
return this;
}
- if(!rotationPreferenceRoot) {
+ if (!rotationPreferenceRoot) {
rotationPreferenceRoot = new et.Element(rotationPreferenceRootName);
visualElements.append(rotationPreferenceRoot);
}
@@ -371,8 +366,8 @@ AppxManifest.prototype.getVisualElements = function () {
rotationPreferenceRoot.clear();
var orientations = KNOWN_ORIENTATIONS[orientation] || orientation.split(',');
- orientations.forEach(function(orientation) {
- var el = new et.Element(self.prefix + 'Rotation', {Preference: orientation} );
+ orientations.forEach(function (orientation) {
+ var el = new et.Element(self.prefix + 'Rotation', {Preference: orientation});
rotationPreferenceRoot.append(el);
});
@@ -382,8 +377,7 @@ AppxManifest.prototype.getVisualElements = function () {
return visualElements.attrib.BackgroundColor;
},
setBackgroundColor: function (color) {
- if (!color)
- throw new TypeError('VisualElements.BackgroundColor attribute must be defined in appxmanifest at ' + this.path);
+ if (!color) { throw new TypeError('VisualElements.BackgroundColor attribute must be defined in appxmanifest at ' + this.path); }
visualElements.attrib.BackgroundColor = refineColor(color);
return this;
@@ -424,7 +418,7 @@ AppxManifest.prototype.getVisualElements = function () {
setSplashScreenExtension: function (extension) {
var splashNode = visualElements.find('./' + self.prefix + 'SplashScreen');
if (splashNode) {
- var oldPath = splashNode.attrib.Image;
+ var oldPath = splashNode.attrib.Image;
splashNode.attrib.Image = path.dirname(oldPath) + '\\' + path.basename(oldPath, path.extname(oldPath)) + extension;
}
return this;
@@ -445,12 +439,11 @@ AppxManifest.prototype.getVisualElements = function () {
return visualElements.attrib.Description;
},
setDescription: function (description) {
- if (!description || description.length === 0)
- throw new TypeError('VisualElements.Description attribute must be defined and non-empty in appxmanifest at ' + this.path);
+ if (!description || description.length === 0) { throw new TypeError('VisualElements.Description attribute must be defined and non-empty in appxmanifest at ' + this.path); }
visualElements.attrib.Description = processDescription(description);
return this;
- },
+ }
};
};
@@ -459,33 +452,33 @@ AppxManifest.prototype.getCapabilities = function () {
if (!capabilities) return [];
return capabilities.getchildren()
- .map(function (element) {
- return { type: element.tag, name: element.attrib.Name };
- });
+ .map(function (element) {
+ return { type: element.tag, name: element.attrib.Name };
+ });
};
-function isCSSColorName(color) {
+function isCSSColorName (color) {
return color.indexOf('0x') === -1 && color.indexOf('#') === -1;
}
-function refineColor(color) {
+function refineColor (color) {
if (isCSSColorName(color)) {
return color;
}
// return three-byte hexadecimal number preceded by "#" (required for Windows)
color = color.replace('0x', '').replace('#', '');
- if (color.length == 3) {
+ if (color.length === 3) {
color = color[0] + color[0] + color[1] + color[1] + color[2] + color[2];
}
// alpha is not supported, so we remove it
- if (color.length == 8) { // AArrggbb
+ if (color.length === 8) { // AArrggbb
color = color.slice(2);
}
return '#' + color;
}
-function processDescription(text) {
+function processDescription (text) {
var result = text;
// Description value limitations: https://msdn.microsoft.com/en-us/library/windows/apps/br211429.aspx
@@ -519,7 +512,7 @@ AppxManifest.prototype.setAppName = function (name) {
* @param {String} [destPath] File to write manifest to. If omitted,
* manifest will be written to file it has been read from.
*/
-AppxManifest.prototype.write = function(destPath) {
+AppxManifest.prototype.write = function (destPath) {
// sort Capability elements as per CB-5350 Windows8 build fails due to invalid 'Capabilities' definition
sortCapabilities(this.doc);
fs.writeFileSync(destPath || this.path, this.doc.write({indent: 4}), 'utf-8');
@@ -530,33 +523,32 @@ AppxManifest.prototype.write = function(destPath) {
* @param {Elementtree.Document} manifest An XML document that represents
* appxmanifest
*/
-function sortCapabilities(manifest) {
+function sortCapabilities (manifest) {
// removes namespace prefix (m3:Capability -> Capability)
// this is required since elementtree returns qualified name with namespace
- function extractLocalName(tag) {
+ function extractLocalName (tag) {
return tag.split(':').pop(); // takes last part of string after ':'
}
- var capabilitiesRoot = manifest.find('.//Capabilities'),
- capabilities = capabilitiesRoot.getchildren() || [];
+ var capabilitiesRoot = manifest.find('.//Capabilities');
+ var capabilities = capabilitiesRoot.getchildren() || [];
// to sort elements we remove them and then add again in the appropriate order
- capabilities.forEach(function(elem) { // no .clear() method
+ capabilities.forEach(function (elem) { // no .clear() method
capabilitiesRoot.remove(elem);
// CB-7601 we need local name w/o namespace prefix to sort capabilities correctly
elem.localName = extractLocalName(elem.tag);
});
- capabilities.sort(function(a, b) {
- return (a.localName > b.localName) ? 1: -1;
+ capabilities.sort(function (a, b) {
+ return (a.localName > b.localName) ? 1 : -1;
});
- capabilities.forEach(function(elem) {
+ capabilities.forEach(function (elem) {
capabilitiesRoot.append(elem);
});
}
-
-function Win10AppxManifest(path) {
- AppxManifest.call(this, path, /*prefix=*/'uap');
+function Win10AppxManifest (path) {
+ AppxManifest.call(this, path, /* prefix= */'uap');
}
util.inherits(Win10AppxManifest, AppxManifest);
@@ -588,7 +580,7 @@ Win10AppxManifest.prototype.getApplication = function () {
appUriRules = new et.Element('uap:ApplicationContentUriRules');
application.append(appUriRules);
- rules.forEach(function(rule) {
+ rules.forEach(function (rule) {
appUriRules.append(new et.Element('uap:Rule', { Match: rule, Type: 'include', WindowsRuntimeAccess: 'all' }));
});
@@ -643,9 +635,9 @@ Win10AppxManifest.prototype.setAppName = function (name) {
*/
Win10AppxManifest.prototype.getRestrictedCapabilities = function () {
var restrictedCapabilities = this.getCapabilities()
- .filter(function (capability) {
- return UAP_RESTRICTED_CAPS.indexOf(capability.name) >= 0;
- });
+ .filter(function (capability) {
+ return UAP_RESTRICTED_CAPS.indexOf(capability.name) >= 0;
+ });
return restrictedCapabilities.length === 0 ? false : restrictedCapabilities;
};
@@ -688,11 +680,11 @@ Win10AppxManifest.prototype.setDependencies = function (dependencies) {
* @param {String} [destPath] File to write manifest to. If omitted,
* manifest will be written to file it has been read from.
*/
-Win10AppxManifest.prototype.write = function(destPath) {
+Win10AppxManifest.prototype.write = function (destPath) {
fs.writeFileSync(destPath || this.path, this.writeToString(), 'utf-8');
};
-Win10AppxManifest.prototype.writeToString = function() {
+Win10AppxManifest.prototype.writeToString = function () {
ensureUapPrefixedCapabilities(this.doc.find('.//Capabilities'));
ensureUniqueCapabilities(this.doc.find('.//Capabilities'));
// sort Capability elements as per CB-5350 Windows8 build fails due to invalid 'Capabilities' definition
@@ -704,30 +696,30 @@ Win10AppxManifest.prototype.writeToString = function() {
* Checks for capabilities which require the uap: prefix in Windows 10.
* @param capabilities {ElementTree.Element} The appx manifest element for <capabilities>
*/
-function ensureUapPrefixedCapabilities(capabilities) {
+function ensureUapPrefixedCapabilities (capabilities) {
capabilities.getchildren()
- .forEach(function(el) {
- if (CAPS_NEEDING_UAPNS.indexOf(el.attrib.Name) > -1 && el.tag.indexOf('uap:') !== 0) {
- el.tag = 'uap:' + el.tag;
- }
- });
+ .forEach(function (el) {
+ if (CAPS_NEEDING_UAPNS.indexOf(el.attrib.Name) > -1 && el.tag.indexOf('uap:') !== 0) {
+ el.tag = 'uap:' + el.tag;
+ }
+ });
}
/**
* Cleans up duplicate capability declarations that were generated during the prepare process
* @param capabilities {ElementTree.Element} The appx manifest element for <capabilities>
*/
-function ensureUniqueCapabilities(capabilities) {
+function ensureUniqueCapabilities (capabilities) {
var uniqueCapabilities = [];
capabilities.getchildren()
- .forEach(function(el) {
- var name = el.attrib.Name;
- if (uniqueCapabilities.indexOf(name) !== -1) {
- capabilities.remove(el);
- } else {
- uniqueCapabilities.push(name);
- }
- });
+ .forEach(function (el) {
+ var name = el.attrib.Name;
+ if (uniqueCapabilities.indexOf(name) !== -1) {
+ capabilities.remove(el);
+ } else {
+ uniqueCapabilities.push(name);
+ }
+ });
}
module.exports = AppxManifest;
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/a8692238/template/cordova/lib/ConfigChanges.js
----------------------------------------------------------------------
diff --git a/template/cordova/lib/ConfigChanges.js b/template/cordova/lib/ConfigChanges.js
index c07a77a..c6f7e21 100644
--- a/template/cordova/lib/ConfigChanges.js
+++ b/template/cordova/lib/ConfigChanges.js
@@ -22,7 +22,7 @@ var CapsNeedUapPrefix = require(path.join(__dirname, 'AppxManifest')).CapsNeedUa
var CAPS_SELECTOR = '/Package/Capabilities';
var WINDOWS10_MANIFEST = 'package.windows10.appxmanifest';
-function PlatformMunger(platform, project_dir, platformJson, pluginInfoProvider) {
+function PlatformMunger (platform, project_dir, platformJson, pluginInfoProvider) {
CommonMunger.apply(this, arguments);
}
@@ -63,13 +63,13 @@ PlatformMunger.prototype.apply_file_munge = function (file, munge, remove) {
};
// Recursive function to clone an object
-function cloneObject(obj) {
+function cloneObject (obj) {
if (obj === null || typeof obj !== 'object') {
return obj;
}
var copy = obj.constructor();
- Object.keys(obj).forEach(function(key) {
+ Object.keys(obj).forEach(function (key) {
copy[key] = cloneObject(obj[key]);
});
@@ -81,7 +81,7 @@ function cloneObject(obj) {
* @param {Object} capability with xml field like <Capability Name="CapabilityName">
* @return {String} name of capability
*/
-function getCapabilityName(capability) {
+function getCapabilityName (capability) {
var reg = /Name\s*=\s*"(.*?)"/;
return capability.xml.match(reg)[1];
}
@@ -91,10 +91,10 @@ function getCapabilityName(capability) {
* @param {Object} an array of capabilities
* @return {Object} an unique array of capabilities
*/
-function getUniqueCapabilities(capabilities) {
- return capabilities.reduce(function(uniqueCaps, currCap) {
+function getUniqueCapabilities (capabilities) {
+ return capabilities.reduce(function (uniqueCaps, currCap) {
- var isRepeated = uniqueCaps.some(function(cap) {
+ var isRepeated = uniqueCaps.some(function (cap) {
return getCapabilityName(cap) === getCapabilityName(currCap);
});
@@ -108,7 +108,7 @@ function getUniqueCapabilities(capabilities) {
* @param {Object} secondCap second capability
* @return {Number} either -1, 0 or 1
*/
-function compareCapabilities(firstCap, secondCap) {
+function compareCapabilities (firstCap, secondCap) {
var firstCapName = getCapabilityName(firstCap);
var secondCapName = getCapabilityName(secondCap);
@@ -123,7 +123,6 @@ function compareCapabilities(firstCap, secondCap) {
return 0;
}
-
/**
* Generates a new munge that contains <uap:Capability> elements created based on
* corresponding <Capability> elements from base munge. If there are no such elements
@@ -133,13 +132,13 @@ function compareCapabilities(firstCap, secondCap) {
* @param {Object} capabilities A list of capabilities
* @return {Object} A list with 'uap'-prefixed capabilities
*/
-function generateUapCapabilities(capabilities) {
+function generateUapCapabilities (capabilities) {
- function hasCapabilityChange(change) {
+ function hasCapabilityChange (change) {
return /^\s*<(\w+:)?(Device)?Capability\s/.test(change.xml);
}
- function createPrefixedCapabilityChange(change) {
+ function createPrefixedCapabilityChange (change) {
if (CapsNeedUapPrefix.indexOf(getCapabilityName(change)) < 0) {
return change;
}
@@ -154,10 +153,10 @@ function generateUapCapabilities(capabilities) {
}
return capabilities
- // For every xml change check if it adds a <Capability> element ...
- .filter(hasCapabilityChange)
- // ... and create a duplicate with 'uap:' prefix
- .map(createPrefixedCapabilityChange);
+ // For every xml change check if it adds a <Capability> element ...
+ .filter(hasCapabilityChange)
+ // ... and create a duplicate with 'uap:' prefix
+ .map(createPrefixedCapabilityChange);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org