You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by fi...@apache.org on 2017/06/27 21:22:01 UTC
[20/51] [partial] cordova-lib git commit: Reorganized unit test
directory. Changes include: - consolidate spec-cordova/ and spec-plugman/
into a single spec/ dir. - put jasmine config and helper modules in top-level
spec dir. - changed package.json npm r
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d164a88f/spec-cordova/fixtures/projWithHooks/configOnePlatform_sh.xml
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/projWithHooks/configOnePlatform_sh.xml b/spec-cordova/fixtures/projWithHooks/configOnePlatform_sh.xml
deleted file mode 100644
index bddcd25..0000000
--- a/spec-cordova/fixtures/projWithHooks/configOnePlatform_sh.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version='1.0' encoding='utf-8'?>
-<widget id="io.cordova.hellocordova" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
- <name>HelloCordova</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="*" />
-
- <hook type="before_build" src="scripts/appBeforeBuild1.sh" />
- <hook type="before_build" src="scripts/appBeforeBuild02.js" />
- <hook type="before_plugin_install" src="scripts/appBeforePluginInstall.js" />
-
- <platform name="windows">
- <hook type="before_build" src="scripts/windows/appWindowsBeforeBuild.sh" />
- <hook type="before_build" src="scripts/windows/appWindowsBeforeBuild.js" />
- <hook type="before_plugin_install" src="scripts/windows/appWindowsBeforePluginInstall.js" />
- </platform>
-</widget>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d164a88f/spec-cordova/fixtures/projWithHooks/configOnlyNonPlatformScripts_bat.xml
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/projWithHooks/configOnlyNonPlatformScripts_bat.xml b/spec-cordova/fixtures/projWithHooks/configOnlyNonPlatformScripts_bat.xml
deleted file mode 100644
index 8ad84f6..0000000
--- a/spec-cordova/fixtures/projWithHooks/configOnlyNonPlatformScripts_bat.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version='1.0' encoding='utf-8'?>
-<widget id="io.cordova.hellocordova" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
- <name>HelloCordova</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="*" />
-
- <hook type="before_build" src="scripts/appBeforeBuild1.bat" />
- <hook type="before_build" src="scripts/appBeforeBuild02.js" />
- <hook type="before_plugin_install" src="scripts/appBeforePluginInstall.js" />
-</widget>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d164a88f/spec-cordova/fixtures/projWithHooks/configOnlyNonPlatformScripts_sh.xml
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/projWithHooks/configOnlyNonPlatformScripts_sh.xml b/spec-cordova/fixtures/projWithHooks/configOnlyNonPlatformScripts_sh.xml
deleted file mode 100644
index 8634f64..0000000
--- a/spec-cordova/fixtures/projWithHooks/configOnlyNonPlatformScripts_sh.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version='1.0' encoding='utf-8'?>
-<widget id="io.cordova.hellocordova" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
- <name>HelloCordova</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="*" />
-
- <hook type="before_build" src="scripts/appBeforeBuild1.sh" />
- <hook type="before_build" src="scripts/appBeforeBuild02.js" />
- <hook type="before_plugin_install" src="scripts/appBeforePluginInstall.js" />
-</widget>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d164a88f/spec-cordova/fixtures/projWithHooks/configTwoPlatforms_bat.xml
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/projWithHooks/configTwoPlatforms_bat.xml b/spec-cordova/fixtures/projWithHooks/configTwoPlatforms_bat.xml
deleted file mode 100644
index 758ac70..0000000
--- a/spec-cordova/fixtures/projWithHooks/configTwoPlatforms_bat.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version='1.0' encoding='utf-8'?>
-<widget id="io.cordova.hellocordova" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
- <name>HelloCordova</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="*" />
-
- <hook type="before_build" src="scripts/appBeforeBuild1.bat" />
- <hook type="before_build" src="scripts/appBeforeBuild02.js" />
- <hook type="before_plugin_install" src="scripts/appBeforePluginInstall.js" />
-
- <platform name="windows">
- <hook type="before_build" src="scripts/windows/appWindowsBeforeBuild.bat" />
- <hook type="before_build" src="scripts/windows/appWindowsBeforeBuild.js" />
- <hook type="before_plugin_install" src="scripts/windows/appWindowsBeforePluginInstall.js" />
- </platform>
-
- <platform name="android">
- <hook type="before_build" src="scripts/android/appAndroidBeforeBuild.bat" />
- <hook type="before_build" src="scripts/android/appAndroidBeforeBuild.js" />
- <hook type="before_plugin_install" src="scripts/android/appAndroidBeforePluginInstall.js" />
- </platform>
-</widget>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d164a88f/spec-cordova/fixtures/projWithHooks/configTwoPlatforms_sh.xml
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/projWithHooks/configTwoPlatforms_sh.xml b/spec-cordova/fixtures/projWithHooks/configTwoPlatforms_sh.xml
deleted file mode 100644
index 1175e6c..0000000
--- a/spec-cordova/fixtures/projWithHooks/configTwoPlatforms_sh.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version='1.0' encoding='utf-8'?>
-<widget id="io.cordova.hellocordova" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
- <name>HelloCordova</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="*" />
-
- <hook type="before_build" src="scripts/appBeforeBuild1.sh" />
- <hook type="before_build" src="scripts/appBeforeBuild02.js" />
- <hook type="before_plugin_install" src="scripts/appBeforePluginInstall.js" />
-
- <platform name="windows">
- <hook type="before_build" src="scripts/windows/appWindowsBeforeBuild.sh" />
- <hook type="before_build" src="scripts/windows/appWindowsBeforeBuild.js" />
- <hook type="before_plugin_install" src="scripts/windows/appWindowsBeforePluginInstall.js" />
- </platform>
-
- <platform name="android">
- <hook type="before_build" src="scripts/android/appAndroidBeforeBuild.sh" />
- <hook type="before_build" src="scripts/android/appAndroidBeforeBuild.js" />
- <hook type="before_plugin_install" src="scripts/android/appAndroidBeforePluginInstall.js" />
- </platform>
-</widget>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d164a88f/spec-cordova/fixtures/projWithHooks/hooks/before_build/hookScript10.js
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/projWithHooks/hooks/before_build/hookScript10.js b/spec-cordova/fixtures/projWithHooks/hooks/before_build/hookScript10.js
deleted file mode 100644
index bad1036..0000000
--- a/spec-cordova/fixtures/projWithHooks/hooks/before_build/hookScript10.js
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/usr/bin/env node
-var path = require('path');
-var orderLogger = require(path.join(process.argv.slice(2)[0], 'scripts', 'orderLogger'));
-orderLogger.logOrder('06');
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d164a88f/spec-cordova/fixtures/projWithHooks/merges/.gitignore
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/projWithHooks/merges/.gitignore b/spec-cordova/fixtures/projWithHooks/merges/.gitignore
deleted file mode 100644
index e69de29..0000000
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d164a88f/spec-cordova/fixtures/projWithHooks/plugins/.gitignore
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/projWithHooks/plugins/.gitignore b/spec-cordova/fixtures/projWithHooks/plugins/.gitignore
deleted file mode 100644
index e69de29..0000000
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d164a88f/spec-cordova/fixtures/projWithHooks/scripts/android/appAndroidBeforeBuild.bat
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/projWithHooks/scripts/android/appAndroidBeforeBuild.bat b/spec-cordova/fixtures/projWithHooks/scripts/android/appAndroidBeforeBuild.bat
deleted file mode 100644
index 1893215..0000000
--- a/spec-cordova/fixtures/projWithHooks/scripts/android/appAndroidBeforeBuild.bat
+++ /dev/null
@@ -1,2 +0,0 @@
-@echo off
-echo 14 >> hooks_order.txt
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d164a88f/spec-cordova/fixtures/projWithHooks/scripts/android/appAndroidBeforeBuild.js
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/projWithHooks/scripts/android/appAndroidBeforeBuild.js b/spec-cordova/fixtures/projWithHooks/scripts/android/appAndroidBeforeBuild.js
deleted file mode 100644
index 42e09e1..0000000
--- a/spec-cordova/fixtures/projWithHooks/scripts/android/appAndroidBeforeBuild.js
+++ /dev/null
@@ -1,4 +0,0 @@
-module.exports = function(context) {
- var orderLogger = require(require('path').join(context.opts.projectRoot, 'scripts', 'orderLogger'));
- orderLogger.logOrder('15', context);
-};
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d164a88f/spec-cordova/fixtures/projWithHooks/scripts/android/appAndroidBeforeBuild.sh
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/projWithHooks/scripts/android/appAndroidBeforeBuild.sh b/spec-cordova/fixtures/projWithHooks/scripts/android/appAndroidBeforeBuild.sh
deleted file mode 100644
index 34f9b56..0000000
--- a/spec-cordova/fixtures/projWithHooks/scripts/android/appAndroidBeforeBuild.sh
+++ /dev/null
@@ -1 +0,0 @@
-echo 14 >> hooks_order.txt
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d164a88f/spec-cordova/fixtures/projWithHooks/scripts/android/appAndroidBeforePluginInstall.js
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/projWithHooks/scripts/android/appAndroidBeforePluginInstall.js b/spec-cordova/fixtures/projWithHooks/scripts/android/appAndroidBeforePluginInstall.js
deleted file mode 100644
index 6b2427f..0000000
--- a/spec-cordova/fixtures/projWithHooks/scripts/android/appAndroidBeforePluginInstall.js
+++ /dev/null
@@ -1,4 +0,0 @@
-module.exports = function(context) {
- var orderLogger = require(require('path').join(context.opts.projectRoot, 'scripts', 'orderLogger'));
- orderLogger.logOrder('16', context);
-};
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d164a88f/spec-cordova/fixtures/projWithHooks/scripts/appBeforeBuild02.js
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/projWithHooks/scripts/appBeforeBuild02.js b/spec-cordova/fixtures/projWithHooks/scripts/appBeforeBuild02.js
deleted file mode 100644
index d95e3d3..0000000
--- a/spec-cordova/fixtures/projWithHooks/scripts/appBeforeBuild02.js
+++ /dev/null
@@ -1,4 +0,0 @@
-module.exports = function(context) {
- var orderLogger = require(require('path').join(context.opts.projectRoot, 'scripts', 'orderLogger'));
- orderLogger.logOrder('09', context);
-};
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d164a88f/spec-cordova/fixtures/projWithHooks/scripts/appBeforeBuild1.bat
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/projWithHooks/scripts/appBeforeBuild1.bat b/spec-cordova/fixtures/projWithHooks/scripts/appBeforeBuild1.bat
deleted file mode 100644
index c3d28b8..0000000
--- a/spec-cordova/fixtures/projWithHooks/scripts/appBeforeBuild1.bat
+++ /dev/null
@@ -1,2 +0,0 @@
-@echo off
-echo 08 >> hooks_order.txt
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d164a88f/spec-cordova/fixtures/projWithHooks/scripts/appBeforeBuild1.sh
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/projWithHooks/scripts/appBeforeBuild1.sh b/spec-cordova/fixtures/projWithHooks/scripts/appBeforeBuild1.sh
deleted file mode 100644
index 03793d8..0000000
--- a/spec-cordova/fixtures/projWithHooks/scripts/appBeforeBuild1.sh
+++ /dev/null
@@ -1 +0,0 @@
-echo 08 >> hooks_order.txt
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d164a88f/spec-cordova/fixtures/projWithHooks/scripts/appBeforePluginInstall.js
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/projWithHooks/scripts/appBeforePluginInstall.js b/spec-cordova/fixtures/projWithHooks/scripts/appBeforePluginInstall.js
deleted file mode 100644
index 73bb61a..0000000
--- a/spec-cordova/fixtures/projWithHooks/scripts/appBeforePluginInstall.js
+++ /dev/null
@@ -1,4 +0,0 @@
-module.exports = function(context) {
- var orderLogger = require(require('path').join(context.opts.projectRoot, 'scripts', 'orderLogger'));
- orderLogger.logOrder('10', context);
-};
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d164a88f/spec-cordova/fixtures/projWithHooks/scripts/orderLogger.js
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/projWithHooks/scripts/orderLogger.js b/spec-cordova/fixtures/projWithHooks/scripts/orderLogger.js
deleted file mode 100644
index ba957f3..0000000
--- a/spec-cordova/fixtures/projWithHooks/scripts/orderLogger.js
+++ /dev/null
@@ -1,12 +0,0 @@
-module.exports.logOrder = function logOrder(index, context) {
- var indexWithEOL = index + require('os').EOL;
- var path = require('path');
- var fs = require('fs');
-
- if(context) {
- fs.appendFileSync(path.join(context.opts.projectRoot, 'hooks_order.txt'), indexWithEOL);
- } else {
-
- fs.appendFileSync('hooks_order.txt', indexWithEOL);
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d164a88f/spec-cordova/fixtures/projWithHooks/scripts/windows/appWindowsBeforeBuild.bat
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/projWithHooks/scripts/windows/appWindowsBeforeBuild.bat b/spec-cordova/fixtures/projWithHooks/scripts/windows/appWindowsBeforeBuild.bat
deleted file mode 100644
index 1da7b9d..0000000
--- a/spec-cordova/fixtures/projWithHooks/scripts/windows/appWindowsBeforeBuild.bat
+++ /dev/null
@@ -1,2 +0,0 @@
-@echo off
-echo 11 >> hooks_order.txt
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d164a88f/spec-cordova/fixtures/projWithHooks/scripts/windows/appWindowsBeforeBuild.js
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/projWithHooks/scripts/windows/appWindowsBeforeBuild.js b/spec-cordova/fixtures/projWithHooks/scripts/windows/appWindowsBeforeBuild.js
deleted file mode 100644
index 207aac2..0000000
--- a/spec-cordova/fixtures/projWithHooks/scripts/windows/appWindowsBeforeBuild.js
+++ /dev/null
@@ -1,4 +0,0 @@
-module.exports = function(context) {
- var orderLogger = require(require('path').join(context.opts.projectRoot, 'scripts', 'orderLogger'));
- orderLogger.logOrder('12', context);
-};
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d164a88f/spec-cordova/fixtures/projWithHooks/scripts/windows/appWindowsBeforeBuild.sh
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/projWithHooks/scripts/windows/appWindowsBeforeBuild.sh b/spec-cordova/fixtures/projWithHooks/scripts/windows/appWindowsBeforeBuild.sh
deleted file mode 100644
index d699b61..0000000
--- a/spec-cordova/fixtures/projWithHooks/scripts/windows/appWindowsBeforeBuild.sh
+++ /dev/null
@@ -1 +0,0 @@
-echo 11 >> hooks_order.txt
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d164a88f/spec-cordova/fixtures/projWithHooks/scripts/windows/appWindowsBeforePluginInstall.js
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/projWithHooks/scripts/windows/appWindowsBeforePluginInstall.js b/spec-cordova/fixtures/projWithHooks/scripts/windows/appWindowsBeforePluginInstall.js
deleted file mode 100644
index fa4a9d7..0000000
--- a/spec-cordova/fixtures/projWithHooks/scripts/windows/appWindowsBeforePluginInstall.js
+++ /dev/null
@@ -1,4 +0,0 @@
-module.exports = function(context) {
- var orderLogger = require(require('path').join(context.opts.projectRoot, 'scripts', 'orderLogger'));
- orderLogger.logOrder('13', context);
-};
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d164a88f/spec-cordova/fixtures/projWithHooks/www/config.xml
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/projWithHooks/www/config.xml b/spec-cordova/fixtures/projWithHooks/www/config.xml
deleted file mode 100644
index 9e7b9e0..0000000
--- a/spec-cordova/fixtures/projWithHooks/www/config.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version='1.0' encoding='utf-8'?>
-<widget id="org.testing" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
- <name>TestBase</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="*" />
- <preference name="fullscreen" value="true" />
- <preference name="webviewbounce" value="true" />
-</widget>
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d164a88f/spec-cordova/fixtures/projWithHooks/www/css/index.css
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/projWithHooks/www/css/index.css b/spec-cordova/fixtures/projWithHooks/www/css/index.css
deleted file mode 100644
index 51daa79..0000000
--- a/spec-cordova/fixtures/projWithHooks/www/css/index.css
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-* {
- -webkit-tap-highlight-color: rgba(0,0,0,0); /* make transparent link selection, adjust last value opacity 0 to 1.0 */
-}
-
-body {
- -webkit-touch-callout: none; /* prevent callout to copy image, etc when tap to hold */
- -webkit-text-size-adjust: none; /* prevent webkit from resizing text to fit */
- -webkit-user-select: none; /* prevent copy paste, to allow, change 'none' to 'text' */
- background-color:#E4E4E4;
- background-image:linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%);
- background-image:-webkit-linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%);
- background-image:-ms-linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%);
- background-image:-webkit-gradient(
- linear,
- left top,
- left bottom,
- color-stop(0, #A7A7A7),
- color-stop(0.51, #E4E4E4)
- );
- background-attachment:fixed;
- font-family:'HelveticaNeue-Light', 'HelveticaNeue', Helvetica, Arial, sans-serif;
- font-size:12px;
- height:100%;
- margin:0px;
- padding:0px;
- text-transform:uppercase;
- width:100%;
-}
-
-/* Portrait layout (default) */
-.app {
- background:url(../img/logo.png) no-repeat center top; /* 170px x 200px */
- position:absolute; /* position in the center of the screen */
- left:50%;
- top:50%;
- height:50px; /* text area height */
- width:225px; /* text area width */
- text-align:center;
- padding:180px 0px 0px 0px; /* image height is 200px (bottom 20px are overlapped with text) */
- margin:-115px 0px 0px -112px; /* offset vertical: half of image height and text area height */
- /* offset horizontal: half of text area width */
-}
-
-/* Landscape layout (with min-width) */
-@media screen and (min-aspect-ratio: 1/1) and (min-width:400px) {
- .app {
- background-position:left center;
- padding:75px 0px 75px 170px; /* padding-top + padding-bottom + text area = image height */
- margin:-90px 0px 0px -198px; /* offset vertical: half of image height */
- /* offset horizontal: half of image width and text area width */
- }
-}
-
-h1 {
- font-size:24px;
- font-weight:normal;
- margin:0px;
- overflow:visible;
- padding:0px;
- text-align:center;
-}
-
-.event {
- border-radius:4px;
- -webkit-border-radius:4px;
- color:#FFFFFF;
- font-size:12px;
- margin:0px 30px;
- padding:2px 0px;
-}
-
-.event.listening {
- background-color:#333333;
- display:block;
-}
-
-.event.received {
- background-color:#4B946A;
- display:none;
-}
-
-@keyframes fade {
- from { opacity: 1.0; }
- 50% { opacity: 0.4; }
- to { opacity: 1.0; }
-}
-
-@-webkit-keyframes fade {
- from { opacity: 1.0; }
- 50% { opacity: 0.4; }
- to { opacity: 1.0; }
-}
-
-.blink {
- animation:fade 3000ms infinite;
- -webkit-animation:fade 3000ms infinite;
-}
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d164a88f/spec-cordova/fixtures/projWithHooks/www/img/logo.png
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/projWithHooks/www/img/logo.png b/spec-cordova/fixtures/projWithHooks/www/img/logo.png
deleted file mode 100644
index 9519e7d..0000000
Binary files a/spec-cordova/fixtures/projWithHooks/www/img/logo.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d164a88f/spec-cordova/fixtures/projWithHooks/www/index.html
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/projWithHooks/www/index.html b/spec-cordova/fixtures/projWithHooks/www/index.html
deleted file mode 100644
index bde5741..0000000
--- a/spec-cordova/fixtures/projWithHooks/www/index.html
+++ /dev/null
@@ -1,43 +0,0 @@
-<!DOCTYPE html>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<html>
- <head>
- <meta charset="utf-8" />
- <meta name="format-detection" content="telephone=no" />
- <!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323 -->
- <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
- <link rel="stylesheet" type="text/css" href="css/index.css" />
- <title>Hello World</title>
- </head>
- <body>
- <div class="app">
- <h1>Apache Cordova</h1>
- <div id="deviceready" class="blink">
- <p class="event listening">Connecting to Device</p>
- <p class="event received">Device is Ready</p>
- </div>
- </div>
- <script type="text/javascript" src="cordova.js"></script>
- <script type="text/javascript" src="js/index.js"></script>
- <script type="text/javascript">
- app.initialize();
- </script>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d164a88f/spec-cordova/fixtures/projWithHooks/www/js/index.js
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/projWithHooks/www/js/index.js b/spec-cordova/fixtures/projWithHooks/www/js/index.js
deleted file mode 100644
index 8d899e3..0000000
--- a/spec-cordova/fixtures/projWithHooks/www/js/index.js
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-var app = {
- // Application Constructor
- initialize: function() {
- this.bindEvents();
- },
- // Bind Event Listeners
- //
- // Bind any events that are required on startup. Common events are:
- // 'load', 'deviceready', 'offline', and 'online'.
- bindEvents: function() {
- document.addEventListener('deviceready', this.onDeviceReady, false);
- },
- // deviceready Event Handler
- //
- // The scope of 'this' is the event. In order to call the 'receivedEvent'
- // function, we must explicity call 'app.receivedEvent(...);'
- onDeviceReady: function() {
- app.receivedEvent('deviceready');
- },
- // Update DOM on a Received Event
- receivedEvent: function(id) {
- var parentElement = document.getElementById(id);
- var listeningElement = parentElement.querySelector('.listening');
- var receivedElement = parentElement.querySelector('.received');
-
- listeningElement.setAttribute('style', 'display:none;');
- receivedElement.setAttribute('style', 'display:block;');
-
- console.log('Received Event: ' + id);
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d164a88f/spec-cordova/fixtures/projWithHooks/www/spec.html
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/projWithHooks/www/spec.html b/spec-cordova/fixtures/projWithHooks/www/spec.html
deleted file mode 100644
index 71f00de..0000000
--- a/spec-cordova/fixtures/projWithHooks/www/spec.html
+++ /dev/null
@@ -1,68 +0,0 @@
-<!DOCTYPE html>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<html>
- <head>
- <title>Jasmine Spec Runner</title>
-
- <!-- jasmine source -->
- <link rel="shortcut icon" type="image/png" href="spec/lib/jasmine-1.2.0/jasmine_favicon.png">
- <link rel="stylesheet" type="text/css" href="spec/lib/jasmine-1.2.0/jasmine.css">
- <script type="text/javascript" src="spec/lib/jasmine-1.2.0/jasmine.js"></script>
- <script type="text/javascript" src="spec/lib/jasmine-1.2.0/jasmine-html.js"></script>
-
- <!-- include source files here... -->
- <script type="text/javascript" src="js/index.js"></script>
-
- <!-- include spec files here... -->
- <script type="text/javascript" src="spec/helper.js"></script>
- <script type="text/javascript" src="spec/index.js"></script>
-
- <script type="text/javascript">
- (function() {
- var jasmineEnv = jasmine.getEnv();
- jasmineEnv.updateInterval = 1000;
-
- var htmlReporter = new jasmine.HtmlReporter();
-
- jasmineEnv.addReporter(htmlReporter);
-
- jasmineEnv.specFilter = function(spec) {
- return htmlReporter.specFilter(spec);
- };
-
- var currentWindowOnload = window.onload;
-
- window.onload = function() {
- if (currentWindowOnload) {
- currentWindowOnload();
- }
- execJasmine();
- };
-
- function execJasmine() {
- jasmineEnv.execute();
- }
- })();
- </script>
- </head>
- <body>
- <div id="stage" style="display:none;"></div>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d164a88f/spec-cordova/fixtures/projects/platformApi/platforms/android/AndroidManifest.xml
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/projects/platformApi/platforms/android/AndroidManifest.xml b/spec-cordova/fixtures/projects/platformApi/platforms/android/AndroidManifest.xml
deleted file mode 100644
index be3f245..0000000
--- a/spec-cordova/fixtures/projects/platformApi/platforms/android/AndroidManifest.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version='1.0' encoding='utf-8'?>
-<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" android:windowSoftInputMode="adjustPan" package="org.testing" xmlns:android="http://schemas.android.com/apk/res/android">
- <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
- <uses-permission android:name="android.permission.INTERNET" />
- <application android:debuggable="true" android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name">
- <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/app_name" android:name="TestBase" android:theme="@android:style/Theme.Black.NoTitleBar">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- </application>
- <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="17" />
-</manifest>
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d164a88f/spec-cordova/fixtures/projects/platformApi/platforms/android/android.json
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/projects/platformApi/platforms/android/android.json b/spec-cordova/fixtures/projects/platformApi/platforms/android/android.json
deleted file mode 100644
index 07c3697..0000000
--- a/spec-cordova/fixtures/projects/platformApi/platforms/android/android.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "prepare_queue": {
- "installed": [],
- "uninstalled": []
- },
- "config_munge": {
- "files": {}
- },
- "installed_plugins": {},
- "dependent_plugins": {}
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d164a88f/spec-cordova/fixtures/projects/platformApi/platforms/android/res/xml/config.xml
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/projects/platformApi/platforms/android/res/xml/config.xml b/spec-cordova/fixtures/projects/platformApi/platforms/android/res/xml/config.xml
deleted file mode 100644
index 645eeb5..0000000
--- a/spec-cordova/fixtures/projects/platformApi/platforms/android/res/xml/config.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version='1.0' encoding='utf-8'?>
-<widget id="io.cordova.hellocordova" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
- <description>
- A sample Apache Cordova application that responds to the deviceready event.
- </description>
- <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="*" />
- <preference name="fullscreen" value="true" />
- <preference name="webviewbounce" value="true" />
-</widget>
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d164a88f/spec-cordova/fixtures/projects/platformApi/platforms/browser/config.xml
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/projects/platformApi/platforms/browser/config.xml b/spec-cordova/fixtures/projects/platformApi/platforms/browser/config.xml
deleted file mode 100644
index 2bb8e47..0000000
--- a/spec-cordova/fixtures/projects/platformApi/platforms/browser/config.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version='1.0' encoding='utf-8'?>
-<widget id="io.cordova.hellocordova" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
- <feature name="Device">
- <param name="browser-package" value="Device" />
- </feature>
- <name>HelloCordova</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="*" />
- <allow-intent href="http://*/*" />
- <allow-intent href="https://*/*" />
- <allow-intent href="tel:*" />
- <allow-intent href="sms:*" />
- <allow-intent href="mailto:*" />
- <allow-intent href="geo:*" />
-</widget>
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d164a88f/spec-cordova/fixtures/projects/platformApi/platforms/browser/cordova/version
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/projects/platformApi/platforms/browser/cordova/version b/spec-cordova/fixtures/projects/platformApi/platforms/browser/cordova/version
deleted file mode 100755
index 8a13bae..0000000
--- a/spec-cordova/fixtures/projects/platformApi/platforms/browser/cordova/version
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/usr/bin/env node
-
-/*
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-*/
-
-// Coho updates this line:
-var VERSION = "4.1.0";
-
-console.log(VERSION);
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d164a88f/spec-cordova/fixtures/projects/platformApi/platforms/browser/cordova/version.bat
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/projects/platformApi/platforms/browser/cordova/version.bat b/spec-cordova/fixtures/projects/platformApi/platforms/browser/cordova/version.bat
deleted file mode 100644
index 3610c17..0000000
--- a/spec-cordova/fixtures/projects/platformApi/platforms/browser/cordova/version.bat
+++ /dev/null
@@ -1,26 +0,0 @@
-:: Licensed to the Apache Software Foundation (ASF) under one
-:: or more contributor license agreements. See the NOTICE file
-:: distributed with this work for additional information
-:: regarding copyright ownership. The ASF licenses this file
-:: to you under the Apache License, Version 2.0 (the
-:: "License"); you may not use this file except in compliance
-:: with the License. You may obtain a copy of the License at
-::
-:: http://www.apache.org/licenses/LICENSE-2.0
-::
-:: Unless required by applicable law or agreed to in writing,
-:: software distributed under the License is distributed on an
-:: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-:: KIND, either express or implied. See the License for the
-:: specific language governing permissions and limitations
-:: under the License.
-
-@ECHO OFF
-SET script_path="%~dp0version"
-IF EXIST %script_path% (
- node %script_path% %*
-) ELSE (
- ECHO.
- ECHO ERROR: Could not find 'version' script in 'cordova' folder, aborting...>&2
- EXIT /B 1
-)
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d164a88f/spec-cordova/fixtures/projects/platformApi/platforms/windows/cordova/Api.js
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/projects/platformApi/platforms/windows/cordova/Api.js b/spec-cordova/fixtures/projects/platformApi/platforms/windows/cordova/Api.js
deleted file mode 100644
index bb56cda..0000000
--- a/spec-cordova/fixtures/projects/platformApi/platforms/windows/cordova/Api.js
+++ /dev/null
@@ -1,3 +0,0 @@
-module.exports = function PlatformApi (argument) {
- this.platform = 'windows';
-};
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d164a88f/spec-cordova/helper.js
----------------------------------------------------------------------
diff --git a/spec-cordova/helper.js b/spec-cordova/helper.js
deleted file mode 100644
index 351e6e4..0000000
--- a/spec-cordova/helper.js
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-*/
-jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d164a88f/spec-cordova/helpers.js
----------------------------------------------------------------------
diff --git a/spec-cordova/helpers.js b/spec-cordova/helpers.js
deleted file mode 100644
index 76686df..0000000
--- a/spec-cordova/helpers.js
+++ /dev/null
@@ -1,170 +0,0 @@
-/**
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-*/
-
-var path = require('path'),
- fs = require('fs'),
- shell = require('shelljs'),
- os = require('os'),
- ConfigParser = require('cordova-common').ConfigParser;
-
-// Just use Android everywhere; we're mocking out any calls to the `android` binary.
-module.exports.testPlatform = 'android';
-
-function getConfigPath(dir) {
- // if path ends with 'config.xml', return it
- if (dir.indexOf('config.xml') == dir.length - 10) {
- return dir;
- }
- // otherwise, add 'config.xml' to the end of it
- return path.join(dir, 'config.xml');
-}
-
-module.exports.tmpDir = function (subdir) {
- var dir = path.join(os.tmpdir(), 'e2e-test');
- if (subdir) {
- dir = path.join(dir, subdir);
- }
- if(fs.existsSync(dir)) {
- shell.rm('-rf', dir);
- }
- shell.mkdir('-p', dir);
- return dir;
-};
-
-// Returns the platform that should be used for testing on this host platform.
-/*
-var host = os.platform();
-if (host.match(/win/)) {
- module.exports.testPlatform = 'wp8';
-} else if (host.match(/darwin/)) {
- module.exports.testPlatform = 'ios';
-} else {
- module.exports.testPlatform = 'android';
-}
-*/
-
-module.exports.setEngineSpec = function (appPath, engine, spec) {
- appPath = getConfigPath(appPath);
- var parser = new ConfigParser(appPath);
-
- parser.removeEngine(engine);
- parser.addEngine(engine, spec);
- parser.write();
-};
-
-module.exports.getEngineSpec = function (appPath, engine) {
- appPath = getConfigPath(appPath);
- var parser = new ConfigParser(appPath),
- engines = parser.getEngines();
-
- for (var i = 0; i < engines.length; i++) {
- if (engines[i].name === module.exports.testPlatform) {
- return engines[i].spec;
- }
- }
- return null;
-};
-
-module.exports.removeEngine = function (appPath, engine) {
- appPath = getConfigPath(appPath);
- var parser = new ConfigParser(appPath);
-
- parser.removeEngine(module.exports.testPlatform);
- parser.write();
-};
-
-module.exports.setPluginSpec = function (appPath, plugin, spec) {
- appPath = getConfigPath(appPath);
- var parser = new ConfigParser(appPath),
- p = parser.getPlugin(plugin),
- variables = [];
-
- if (p) {
- parser.removePlugin(p.name);
- if (p.variables.length && p.variables.length > 0) {
- variables = p.variables;
- }
- }
-
- parser.addPlugin({ 'name': plugin, 'spec': spec }, variables);
- parser.write();
-};
-
-module.exports.getPluginSpec = function (appPath, plugin) {
- appPath = getConfigPath(appPath);
- var parser = new ConfigParser(appPath),
- p = parser.getPlugin(plugin);
-
- if (p) {
- return p.spec;
- }
- return null;
-};
-
-module.exports.getPluginVariable = function (appPath, plugin, variable) {
- appPath = getConfigPath(appPath);
- var parser = new ConfigParser(appPath),
- p = parser.getPlugin(plugin);
-
- if (p && p.variables) {
- return p.variables[variable];
- }
- return null;
-};
-
-module.exports.removePlugin = function (appPath, plugin) {
- appPath = getConfigPath(appPath);
- var parser = new ConfigParser(appPath);
-
- parser.removePlugin(plugin);
- parser.write();
-};
-
-module.exports.getConfigContent = function (appPath) {
- var configFile = path.join(appPath, 'config.xml');
- return fs.readFileSync(configFile, 'utf-8');
-};
-
-module.exports.writeConfigContent = function (appPath, configContent) {
- var configFile = path.join(appPath, 'config.xml');
- fs.writeFileSync(configFile, configContent, 'utf-8');
-};
-
-// Add the toExist matcher.
-beforeEach(function () {
- jasmine.addMatchers({
- 'toExist': function () {
- return {
- compare: function(actual, expected) {
- var result = {};
-
- result.pass = fs.existsSync(actual);
-
- if(result.pass) {
- result.message = 'expected ' + actual + ' to not exist';
- } else {
- result.message = 'expected ' + actual + ' to exist';
- }
-
- return result;
- }
- };
- }
- });
-});
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d164a88f/spec-cordova/jasmine.json
----------------------------------------------------------------------
diff --git a/spec-cordova/jasmine.json b/spec-cordova/jasmine.json
deleted file mode 100644
index 37a6a54..0000000
--- a/spec-cordova/jasmine.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "spec_dir": "spec-cordova",
- "spec_files": [
- "**/*[sS]pec.js",
- "../spec-plugman/**/*[sS]pec.js"
- ],
- "helpers": [
- "helpers.js",
- "helper.js"
- ],
- "stopSpecOnExpectationFailure": false,
- "random": false
-}
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d164a88f/spec-cordova/lazy_load.spec.js
----------------------------------------------------------------------
diff --git a/spec-cordova/lazy_load.spec.js b/spec-cordova/lazy_load.spec.js
deleted file mode 100644
index dc0f816..0000000
--- a/spec-cordova/lazy_load.spec.js
+++ /dev/null
@@ -1,271 +0,0 @@
-/**
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-*/
-
-/* jshint sub:true */
-
-var lazy_load = require('../src/cordova/lazy_load'),
- npmHelper = require('../src/util/npm-helper'),
- config = require('../src/cordova/config'),
- shell = require('shelljs'),
- npm = require('npm'),
- path = require('path'),
- HooksRunner = require('../src/hooks/HooksRunner'),
- request = require('request'),
- fs = require('fs'),
- Q = require('q'),
- platforms = require('../src/platforms/platforms');
-
-describe('lazy_load module', function() {
- var custom_path, cachePackage, fakeLazyLoad;
- beforeEach(function() {
- custom_path = spyOn(config, 'has_custom_path').and.returnValue(false);
- cachePackage = spyOn(npmHelper, 'cachePackage').and.returnValue(Q(path.join('lib', 'dir')));
- fakeLazyLoad = function (id, platform, version) {
- if (platform == 'wp7' || platform == 'wp8') {
- return Q(path.join('lib', 'wp', id, version, platform));
- } else {
- return Q(path.join('lib', platform, id, version, platforms[platform] && platforms[platform].subdirectory ? platforms[platform].subdirectory : ''));
- }
- };
- });
- describe('cordova method (loads stock cordova libs)', function() {
- var custom,
- version;
- beforeEach(function() {
- custom = spyOn(lazy_load, 'custom').and.returnValue(Q(path.join('lib','dir')));
- version = platforms.android.version;
- platforms.android.version = '3.14.15.9265';
- });
- afterEach(function () {
- platforms.android.version = version;
- });
- it('Test 001: should throw if platform is not a stock cordova platform', function(done) {
- lazy_load.cordova('atari').then(function() {
- expect('this call').toEqual('to fail');
- }, function(err) {
- expect('' + err).toContain('Cordova library "atari" not recognized.');
- }).fin(done);
- });
- it('Test 002 : should invoke lazy_load.custom with appropriate url, platform, and version as specified in platforms manifest', function(done) {
- lazy_load.cordova('android').then(function(dir) {
- expect(cachePackage).toHaveBeenCalled();
- expect(dir).toBeDefined();
- done();
- });
- });
- });
-
- describe('custom method (loads custom cordova libs)', function() {
- var exists, fire, rm, mv, readdir;
- beforeEach(function() {
- spyOn(shell, 'mkdir');
- rm = spyOn(shell, 'rm');
- mv = spyOn(shell, 'mv');
- exists = spyOn(fs, 'existsSync').and.returnValue(false);
- readdir = spyOn(fs, 'readdirSync').and.returnValue(['somefile.txt']);
- fire = spyOn(HooksRunner, 'fire').and.returnValue(Q());
- });
-
- it('Test 003 : should callback with no errors and not fire event hooks if library already exists', function(done) {
- exists.and.returnValue(true);
- var mock_platforms = {
- 'platform X': {
- id: 'some id',
- url: 'http://some remote url',
- version: 'three point five'
- }
- };
- lazy_load.custom(mock_platforms, 'platform X').then(function() {
- expect(fire).not.toHaveBeenCalled();
- }, function(err) {
- expect(err).not.toBeDefined();
- }).fin(done);
- });
- it('Test 004 : should callback with no errors and fire event hooks even if library already exists if the lib url is a local dir', function(done) {
- exists.and.returnValue(true);
- var mock_platforms = {
- 'platform X': {
- id: 'some id',
- url: 'some local dir',
- version: 'three point six'
- }
- };
- lazy_load.custom(mock_platforms, 'platform X').then(function() {
- expect(fire).not.toHaveBeenCalled();
- }, function(err) {
- expect(err).not.toBeDefined();
- }).fin(done);
- });
-
- describe('remote URLs for libraries', function() {
- var req,
- events = {},
- fakeRequest = {
- on: jasmine.createSpy().and.callFake(function(event, cb) {
- events[event] = cb;
- return fakeRequest;
- }),
- pipe: jasmine.createSpy().and.callFake(function() { return fakeRequest; })
- };
- beforeEach(function() {
- events = {};
- fakeRequest.on.calls.reset();
- fakeRequest.pipe.calls.reset();
- req = spyOn(request, 'get').and.callFake(function() {
- // Fire the 'end' event shortly.
- setTimeout(function() {
- events['end']();
- }, 10);
- return fakeRequest;
- });
- spyOn(npm, 'load').and.callFake(function(cb) { cb(); });
- spyOn(npm.config, 'get').and.returnValue(null);
- });
-
- it('Test 005 : should call request with appropriate url params', function(done) {
- var url = 'https://github.com/apache/someplugin';
- var with_android_platform = {
- 'android': {
- id: 'random',
- url: url,
- version: '1.0'
- }
- };
- lazy_load.custom(with_android_platform, 'android').then(function() {
- expect(req).toHaveBeenCalledWith({
- url:url
- }, jasmine.any(Function));
- }, function(err) {
- expect(err).not.toBeDefined();
- }).fin(done);
- });
- it('Test 006 : should take into account https-proxy npm configuration var if exists for https:// calls', function(done) {
- var proxy = 'https://somelocalproxy.com';
- npm.config.get.and.returnValue(proxy);
- var url = 'https://github.com/apache/someplugin';
- var with_android_platform = {
- 'android': {
- id: 'random',
- url: url,
- version: '1.0'
- }
- };
- lazy_load.custom(with_android_platform, 'android').then(function() {
- expect(req).toHaveBeenCalledWith({
- url:url,
- proxy:proxy
- }, jasmine.any(Function));
- }, function(err) {
- expect(err).not.toBeDefined();
- }).fin(done);
- });
- it('Test 007 : should take into account proxy npm config var if exists for http:// calls', function(done) {
- var proxy = 'http://somelocalproxy.com';
- npm.config.get.and.returnValue(proxy);
- var url = 'http://github.com/apache/someplugin';
- var with_android_platform = {
- 'android': {
- id: 'random',
- url: url,
- version: '1.0'
- }
- };
- lazy_load.custom(with_android_platform, 'android').then(function() {
- expect(req).toHaveBeenCalledWith({
- url:url,
- proxy:proxy
- }, jasmine.any(Function));
- }, function(err) {
- expect(err).not.toBeDefined();
- }).fin(done);
- });
- });
-
- describe('local paths for libraries', function() {
- it('Test 009 : should return the local path, no symlink', function(done) {
- var mock_platforms = {
- 'X': {
- id: 'id',
- url: '/some/random/lib',
- version: 'three point eight'
- }
- };
- lazy_load.custom(mock_platforms, 'X').then(function(dir) {
- expect(path.normpath(dir)).toEqual('/some/random/lib');
- }, function(err) {
- expect(err).toBeUndefined();
- }).fin(done);
- });
- it('Test 010 : should not file download hook', function(done) {
- var mock_platforms = {
- 'X': {
- id: 'id',
- url: '/some/random/lib',
- version: 'three point nine'
- }
- };
- lazy_load.custom(mock_platforms, 'X').then(function() {
- expect(fire).not.toHaveBeenCalledWith('after_library_download', {platform:'X',url:'/some/random/lib',id:'id',version:'three point nine',path:'/some/random/lib', symlink:false});
- }, function(err) {
- expect(err).toBeUndefined();
- }).fin(done);
- });
- });
- });
-
- describe('based_on_config method', function() {
- var cordova, custom, read;
- beforeEach(function() {
- cordova = spyOn(lazy_load, 'cordova').and.returnValue(Q());
- custom = spyOn(lazy_load, 'custom').and.returnValue(Q());
- });
- it('Test 011 : should invoke custom if a custom lib is specified', function(done) {
- read = spyOn(config, 'read').and.returnValue({
- lib:{
- maybe:{
- url:'you or eye?',
- id:'eye dee',
- version:'four point twenty'
- }
- }
- });
- var p = '/some/random/custom/path';
- custom_path.and.returnValue(p);
- custom.and.callFake(function (platforms, platform) {
- expect(platform).toEqual('maybe');
- expect(platforms[platform].url).toEqual('you or eye?');
- expect(platforms[platform].id).toEqual('eye dee');
- expect(platforms[platform].version).toEqual('four point twenty');
- return fakeLazyLoad(platforms[platform].id, platform, platforms[platform].version);
- });
- lazy_load.based_on_config('yup', 'maybe').then(function() {
- expect(custom).toHaveBeenCalled();
- }, function(err) {
- expect(err).toBeUndefined();
- }).fin(done);
- });
- it('Test 012 : should invoke cordova if no custom lib is specified', function(done) {
- lazy_load.based_on_config('yup', 'ios').then(function() {
- expect(cordova).toHaveBeenCalled();
- }, function(err) {
- expect(err).toBeUndefined();
- }).fin(done);
- });
- });
-});
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d164a88f/spec-cordova/metadata/blackberry_parser.spec.js
----------------------------------------------------------------------
diff --git a/spec-cordova/metadata/blackberry_parser.spec.js b/spec-cordova/metadata/blackberry_parser.spec.js
deleted file mode 100644
index a9fbd20..0000000
--- a/spec-cordova/metadata/blackberry_parser.spec.js
+++ /dev/null
@@ -1,215 +0,0 @@
-/**
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-*/
-
-var blackberryParser = require('../../src/cordova/metadata/blackberry10_parser'),
- util = require('../../src/cordova/util'),
- path = require('path'),
- shell = require('shelljs'),
- fs = require('fs'),
- et = require('elementtree'),
- xmlHelpers = require('cordova-common').xmlHelpers,
- config = require('../../src/cordova/config'),
- Parser = require('../../src/cordova/metadata/parser'),
- ConfigParser = require('cordova-common').ConfigParser;
-
-var cfg = new ConfigParser(path.join(__dirname, '..', 'test-config.xml'));
-
-var TEST_XML = '<?xml version="1.0" encoding="UTF-8"?>\n' +
- '<widget xmlns = "http://www.w3.org/ns/widgets"\n' +
- ' xmlns:cdv = "http://cordova.apache.org/ns/1.0"\n' +
- ' id = "io.cordova.hellocordova"\n' +
- ' version = "0.0.1">\n' +
- ' <name>Hello Cordova</name>\n' +
- ' <description>\n' +
- ' A sample Apache Cordova application that responds to the deviceready event.\n' +
- ' </description>\n' +
- ' <author href="http://cordova.io" email="dev@cordova.apache.org">\n' +
- ' Apache Cordova Team\n' +
- ' </author>\n' +
- ' <content src="index.html" />\n' +
- ' <access origin="*" />\n' +
- ' <preference name="fullscreen" value="true" />\n' +
- ' <preference name="webviewbounce" value="true" />\n' +
- '</widget>\n';
-
-describe('blackberry10 project parser', function() {
- var proj = '/some/path';
- var exists, custom;
- beforeEach(function() {
- exists = spyOn(fs, 'existsSync').and.returnValue(true);
- custom = spyOn(config, 'has_custom_path').and.returnValue(false);
- spyOn(ConfigParser.prototype, 'write');
- spyOn(xmlHelpers, 'parseElementtreeSync').and.callFake(function() {
- return new et.ElementTree(et.XML(TEST_XML));
- });
- });
-
- function wrapper(p, done, post) {
- p.then(post, function(err) {
- expect(err).toBeUndefined();
- }).fin(done);
- }
-
- function errorWrapper(p, done, post) {
- p.then(function() {
- expect('this call').toBe('fail');
- }, post).fin(done);
- }
-
- describe('constructions', function() {
- it('should throw an exception with a path that is not a native blackberry project', function() {
- exists.and.returnValue(false);
- expect(function() {
- new blackberryParser(proj);
- }).toThrow();
- });
- it('should accept a proper native blackberry project path as construction parameter', function() {
- var project;
- expect(function() {
- project = new blackberryParser(proj);
- }).not.toThrow();
- expect(project).toBeDefined();
- });
- it('should be an instance of Parser', function() {
- expect(new blackberryParser(proj) instanceof Parser).toBe(true);
- });
- it('should call super with the correct arguments', function() {
- var call = spyOn(Parser, 'call');
- var p = new blackberryParser(proj);
- expect(call).toHaveBeenCalledWith(p, 'blackberry10', proj);
- });
- });
-
- describe('instance', function() {
- var p, cp, rm, mkdir, is_cordova, write, read;
- var bb_proj = path.join(proj, 'platforms', 'blackberry10');
- beforeEach(function() {
- p = new blackberryParser(bb_proj);
- cp = spyOn(shell, 'cp');
- rm = spyOn(shell, 'rm');
- mkdir = spyOn(shell, 'mkdir');
- is_cordova = spyOn(util, 'isCordova').and.returnValue(proj);
- write = spyOn(fs, 'writeFileSync');
- read = spyOn(fs, 'readFileSync');
- });
-
- describe('update_from_config method', function() {
- var xml_name, xml_pkg, xml_version, xml_access_rm, xml_update,
- xml_append, xml_content, xml_access_add, xml_preference_remove,
- xml_preference_add;
- beforeEach(function() {
- xml_content = jasmine.createSpy('xml content');
- xml_name = jasmine.createSpy('xml name');
- xml_pkg = jasmine.createSpy('xml pkg');
- xml_version = jasmine.createSpy('xml version');
- xml_access_rm = jasmine.createSpy('xml access rm');
- xml_access_add = jasmine.createSpy('xml access add');
- xml_update = jasmine.createSpy('xml update');
- xml_append = jasmine.createSpy('xml append');
- xml_preference_remove = jasmine.createSpy('xml preference rm');
- xml_preference_add = jasmine.createSpy('xml preference add');
- p.xml.name = xml_name;
- p.xml.packageName = xml_pkg;
- p.xml.version = xml_version;
- p.xml.content = xml_content;
- p.xml.access = {
- remove:xml_access_rm,
- add: xml_access_add
- };
- p.xml.update = xml_update;
- p.xml.doc = {
- getroot:function() { return { append:xml_append}; }
- };
- p.xml.preference = {
- add: xml_preference_add,
- remove: xml_preference_remove
- };
- cfg.name = function() { return 'testname'; };
- cfg.packageName = function() { return 'testpkg'; };
- cfg.version = function() { return 'one point oh'; };
- });
- });
- describe('www_dir method', function() {
- it('should return /www', function() {
- expect(p.www_dir()).toEqual(path.join(bb_proj, 'www'));
- });
- });
- describe('config_xml method', function() {
- it('should return the location of the config.xml', function() {
- expect(p.config_xml()).toEqual(path.join(proj, 'platforms', 'blackberry10', 'www', 'config.xml'));
- });
- });
- describe('update_www method', function() {
-
- it('should rm project-level www and cp in platform agnostic www', function() {
- p.update_www();
- expect(rm).toHaveBeenCalled();
- expect(cp).toHaveBeenCalled();
- });
- });
- describe('update_overrides method', function() {
- it('should do nothing if merges directory does not exist', function() {
- exists.and.returnValue(false);
- p.update_overrides();
- expect(cp).not.toHaveBeenCalled();
- });
- it('should copy merges path into www', function() {
- p.update_overrides();
- expect(cp).toHaveBeenCalledWith('-rf', path.join(proj, 'merges', 'blackberry10', '*'), path.join(proj, 'platforms', 'blackberry10', 'www'));
- });
- });
- describe('update_project method', function() {
- var config, www, overrides, svn, parse;
- beforeEach(function() {
- config = spyOn(p, 'update_from_config');
- www = spyOn(p, 'update_www');
- overrides = spyOn(p, 'update_overrides');
- svn = spyOn(util, 'deleteSvnFolders');
- parse = spyOn(JSON, 'parse').and.returnValue({blackberry:{qnx:{}}});
- });
- it('should call update_from_config', function(done) {
- wrapper(p.update_project(), done, function() {
- expect(config).toHaveBeenCalled();
- });
- });
- it('should throw if update_from_config throws', function(done) {
- var err = new Error('uh oh!');
- config.and.callFake(function() { throw err; });
- errorWrapper(p.update_project({}), done, function(e) {
- expect(e).toEqual(err);
- });
- });
- it('should not call update_www', function(done) {
- wrapper(p.update_project(), done, function() {
- expect(www).not.toHaveBeenCalled();
- });
- });
- it('should call update_overrides', function(done) {
- wrapper(p.update_project(), done, function() {
- expect(overrides).toHaveBeenCalled();
- });
- });
- it('should call deleteSvnFolders', function(done) {
- wrapper(p.update_project(), done, function() {
- expect(svn).toHaveBeenCalled();
- });
- });
- });
- });
-});
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d164a88f/spec-cordova/metadata/browser_parser.spec.js
----------------------------------------------------------------------
diff --git a/spec-cordova/metadata/browser_parser.spec.js b/spec-cordova/metadata/browser_parser.spec.js
deleted file mode 100644
index 29ee5ee..0000000
--- a/spec-cordova/metadata/browser_parser.spec.js
+++ /dev/null
@@ -1,98 +0,0 @@
-/**
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-*/
-
-var browserParser = require('../../src/cordova/metadata/browser_parser'),
- util = require('../../src/cordova/util'),
- path = require('path'),
- shell = require('shelljs'),
- fs = require('fs'),
- Parser = require('../../src/cordova/metadata/parser');
-
-describe('browser project parser', function() {
- var proj = path.join('some', 'path');
- var exists;
-
- beforeEach(function() {
- exists = spyOn(fs, 'existsSync').and.returnValue(true);
- spyOn(browserParser,'dirExists').and.returnValue(true);
- });
-
- describe('constructions', function() {
- it('should create an instance with a path', function() {
- expect(function() {
- var p = new browserParser(proj);
- expect(p.path).toEqual(proj);
- }).not.toThrow();
- });
- it('should be an instance of Parser', function() {
- expect(new browserParser(proj) instanceof Parser).toBe(true);
- });
- it('should call super with the correct arguments', function() {
- var call = spyOn(Parser, 'call');
- var p = new browserParser(proj);
- expect(call).toHaveBeenCalledWith(p, 'browser', proj);
- });
- });
-
- describe('instance', function() {
- var p, cp, rm, mkdir, is_cordova;
- var browser_proj = path.join(proj, 'platforms', 'browser');
-
- beforeEach(function() {
- p = new browserParser(browser_proj);
- cp = spyOn(shell, 'cp');
- rm = spyOn(shell, 'rm');
- mkdir = spyOn(shell, 'mkdir');
- is_cordova = spyOn(util, 'isCordova').and.returnValue(proj);
- });
-
- describe('www_dir method', function() {
- it('should return /www', function() {
- expect(p.www_dir()).toEqual(path.join(browser_proj, 'www'));
- });
- });
-
- describe('config_xml method', function() {
- it('should return the location of config.xml', function() {
- expect(p.config_xml()).toEqual(path.join(proj, 'platforms', 'browser', 'config.xml'));
- });
- });
-
- describe('update_www method', function() {
- it('should rm project-level www and cp in platform agnostic www', function() {
- p.update_www();
- expect(rm).toHaveBeenCalled();
- expect(cp).toHaveBeenCalled();
- });
- });
-
- describe('update_overrides method', function() {
- it('should do nothing if merges directory does not exist', function() {
- exists.and.returnValue(false);
- p.update_overrides();
- expect(cp).not.toHaveBeenCalled();
- });
-
- it('should copy merges path into www', function() {
- p.update_overrides();
- expect(cp).toHaveBeenCalledWith('-rf', path.join(proj, 'merges', 'browser', '*'), path.join(proj, 'platforms', 'browser', 'www'));
- });
- });
- });
-});
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d164a88f/spec-cordova/metadata/parser.spec.js
----------------------------------------------------------------------
diff --git a/spec-cordova/metadata/parser.spec.js b/spec-cordova/metadata/parser.spec.js
deleted file mode 100644
index d0b93f1..0000000
--- a/spec-cordova/metadata/parser.spec.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-*/
-
-var fs = require('fs'),
- Parser = require('../../src/cordova/metadata/parser'),
- ParserHelper = require('../../src/cordova/metadata/parserhelper/ParserHelper');
-
-describe('base parser', function() {
-
- var exists, parser;
-
- beforeEach(function() {
- exists = spyOn(fs, 'existsSync');
- parser = new Parser();
- });
-
- describe('properties', function() {
-
- it('should have properties named path and platform', function() {
- expect(parser.path).not.toBeUndefined();
- expect(parser.platform).not.toBeUndefined();
- });
-
- it('should have a property named helper that is an instace of ParserHelper', function() {
- var descriptor = Object.getOwnPropertyDescriptor(parser, 'helper');
- expect(descriptor).not.toBeUndefined();
- expect(descriptor.value instanceof ParserHelper).toBe(true);
- });
-
- it('should have an immutable helper property', function() {
- var value = 'foo';
- parser.helpers = value;
- expect(parser.helper instanceof ParserHelper).toBe(true);
- });
-
- });
-
-});
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d164a88f/spec-cordova/metadata/parserhelper/ParserHelper.spec.js
----------------------------------------------------------------------
diff --git a/spec-cordova/metadata/parserhelper/ParserHelper.spec.js b/spec-cordova/metadata/parserhelper/ParserHelper.spec.js
deleted file mode 100644
index e62a1f4..0000000
--- a/spec-cordova/metadata/parserhelper/ParserHelper.spec.js
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-*/
-
-var path = require('path'),
- ParserHelper = require('../../../src/cordova/metadata/parserhelper/ParserHelper'),
- ConfigParser = require('cordova-common').ConfigParser;
-
-// Create a real config object before mocking out everything.
-var xml = path.join(__dirname, '..', '..', 'test-config.xml');
-var cfg = new ConfigParser(xml);
-
-describe('ParserHelper', function() {
-
- describe('constructions', function() {
-
- it('should pass platform name as a constructor parameter', function() {
- var ph = new ParserHelper();
- expect(ph.platform).toEqual('');
- ph = new ParserHelper('some-platform');
- expect(ph.platform).toEqual('some-platform');
- });
-
- });
-
- describe('instance', function() {
-
- var parserHelper;
-
- beforeEach(function() {
- parserHelper = new ParserHelper();
- });
-
- describe('getOrientation method', function() {
-
- it('should return the global orientation value', function() {
- expect(parserHelper.getOrientation(cfg)).toEqual('portrait');
- });
- it('should return the platform-specific orientation value', function() {
- var parserHelperAndroid = new ParserHelper('android');
- expect(parserHelperAndroid.getOrientation(cfg)).toEqual('landscape');
- });
-
- });
-
- });
-
-});
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d164a88f/spec-cordova/metadata/parserhelper/preferences.spec.js
----------------------------------------------------------------------
diff --git a/spec-cordova/metadata/parserhelper/preferences.spec.js b/spec-cordova/metadata/parserhelper/preferences.spec.js
deleted file mode 100644
index 0b4ecff..0000000
--- a/spec-cordova/metadata/parserhelper/preferences.spec.js
+++ /dev/null
@@ -1,147 +0,0 @@
-/**
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-*/
-
-var path = require('path'),
- fs = require('fs'),
- events = require('cordova-common').events,
- preferences = require('../../../src/cordova/metadata/parserhelper/preferences'),
- ConfigParser = require('cordova-common').ConfigParser;
-
-// Create a real config object before mocking out everything.
-var xml = path.join(__dirname, '..', '..', 'test-config.xml');
-var cfg = new ConfigParser(xml);
-
-describe('preferences', function() {
-
- describe('properties', function() {
-
- it('should define global orientation constants', function() {
- expect(preferences.ORIENTATION_DEFAULT).toEqual('default');
- expect(preferences.ORIENTATION_PORTRAIT).toEqual('portrait');
- expect(preferences.ORIENTATION_LANDSCAPE).toEqual('landscape');
- expect(preferences.ORIENTATION_ALL).toEqual('all');
-
- expect(preferences.ORIENTATION_GLOBAL_ORIENTATIONS).toEqual([ 'default', 'portrait', 'landscape' ]);
- expect(preferences.ORIENTATION_SPECIFIC_TO_A_PLATFORM_ORIENTATIONS.ios).toEqual([ 'all' ]);
- expect(preferences.ORIENTATION_SPECIFIC_TO_A_PLATFORM_ORIENTATIONS.foobar).toBeUndefined();
- });
-
- });
-
- describe('methods', function() {
-
- var readFile, emit;
-
- beforeEach(function() {
- readFile = spyOn(fs, 'readFileSync');
- emit = spyOn(events, 'emit');
- });
-
- describe('isDefaultOrientation', function() {
-
- it('should return true if an orientation is the default orientation', function() {
- expect(preferences.isDefaultOrientation('default')).toBe(true);
- });
- it('should return false if an orientation is not the default orientation', function() {
- expect(preferences.isDefaultOrientation('some-orientation')).toBe(false);
- });
-
- });
-
- describe('isGlobalOrientation', function() {
-
- it('should return true if an orientation is a global orientation', function() {
- expect(preferences.isGlobalOrientation('portrait')).toBe(true);
- });
- it('should return false if an orientation is a global orientation', function() {
- expect(preferences.isGlobalOrientation('some-orientation')).toBe(false);
- });
-
- });
-
- describe('isOrientationSpecificToAPlatform', function() {
-
- it('should return true if an orientation is specific to a platform', function() {
- expect(preferences.isOrientationSpecificToAPlatform('all', 'ios')).toBe(true);
- expect(preferences.isOrientationSpecificToAPlatform('sensorLandscape', 'android')).toBe(true);
-
- });
- it('should return false if an orientation is not a specific to a platform', function() {
- expect(preferences.isOrientationSpecificToAPlatform('some-orientation', 'foobar')).toBe(false);
- });
-
- });
-
- describe('getOrientation', function() {
-
- it('should handle no platform', function() {
- expect(preferences.getOrientation(cfg)).toEqual('portrait');
- expect(emit).not.toHaveBeenCalled();
- });
- it('should handle undefined platform-specific orientation', function() {
- expect(preferences.getOrientation(cfg, 'ios')).toEqual('portrait');
- expect(emit).not.toHaveBeenCalled();
- });
- it('should handle platform-specific orientation', function() {
- expect(preferences.getOrientation(cfg, 'android')).toEqual('landscape');
- });
- it('should handle orientation specific to a platform', function() {
- var configXml, configParser;
-
- configXml = '<?xml version="1.0" encoding="UTF-8"?><widget><preference name="orientation" value="all" /></widget>';
- readFile.and.returnValue(configXml);
- configParser = new ConfigParser(xml);
-
- expect(preferences.getOrientation(configParser, 'ios')).toEqual('all');
-
- configXml = '<?xml version="1.0" encoding="UTF-8"?><widget><preference name="orientation" value="sensorLandscape" /></widget>';
- readFile.and.returnValue(configXml);
- configParser = new ConfigParser(xml);
-
- expect(preferences.getOrientation(configParser, 'android')).toEqual('sensorLandscape');
- });
-
- it('should handle no orientation', function() {
- var configXml = '<?xml version="1.0" encoding="UTF-8"?><widget></widget>';
- readFile.and.returnValue(configXml);
- var configParser = new ConfigParser(xml);
- expect(preferences.getOrientation(configParser)).toEqual('');
- expect(emit).not.toHaveBeenCalled();
- });
- it('should handle invalid global orientation', function() {
- var configXml = '<?xml version="1.0" encoding="UTF-8"?><widget><preference name="orientation" value="foobar" /></widget>';
- readFile.and.returnValue(configXml);
- var configParser = new ConfigParser(xml);
- expect(preferences.getOrientation(configParser)).toEqual('default');
- expect(emit).toHaveBeenCalledWith('warn', 'Unsupported global orientation: foobar');
- expect(emit).toHaveBeenCalledWith('warn', 'Defaulting to value: default');
- });
-
- it('should handle custom platform-specific orientation', function() {
- var configXml = '<?xml version="1.0" encoding="UTF-8"?><widget><platform name="some-platform"><preference name="orientation" value="foobar" /></platform></widget>';
- readFile.and.returnValue(configXml);
- var configParser = new ConfigParser(xml);
- expect(preferences.getOrientation(configParser, 'some-platform')).toEqual('foobar');
- });
-
- });
-
- });
-
-});
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org