CB-10636 Add JSHint for plugins

Fixed autotests


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/commit/5ea854d8
Tree: 
http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/tree/5ea854d8
Diff: 
http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/diff/5ea854d8

Branch: refs/heads/3.2.x
Commit: 5ea854d8c3671751778a67095b3ec36a55e0c71b
Parents: e401a4d
Author: daserge <[email protected]>
Authored: Fri Feb 19 12:04:40 2016 +0300
Committer: daserge <[email protected]>
Committed: Fri Feb 19 12:18:29 2016 +0300

----------------------------------------------------------------------
 .jshintrc                        | 16 ++++++++++++++++
 .travis.yml                      |  4 ++++
 README.md                        |  2 ++
 package.json                     |  9 ++++++++-
 src/blackberry10/index.js        |  2 ++
 src/browser/SplashScreenProxy.js |  4 ++--
 src/tizen/SplashScreenProxy.js   |  2 ++
 tests/tests.js                   |  8 +++++---
 www/windows/SplashScreenProxy.js | 11 +++++------
 9 files changed, 46 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/blob/5ea854d8/.jshintrc
----------------------------------------------------------------------
diff --git a/.jshintrc b/.jshintrc
new file mode 100644
index 0000000..cf48aac
--- /dev/null
+++ b/.jshintrc
@@ -0,0 +1,16 @@
+{
+    "browser": true
+  , "devel": true
+  , "bitwise": true
+  , "undef": true
+  , "trailing": true
+  , "quotmark": false
+  , "indent": 4
+  , "unused": "vars"
+  , "latedef": "nofunc"
+  , "globals": {
+        "module": false,
+        "exports": false,
+        "require": false
+    }
+}

http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/blob/5ea854d8/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..b9af4c5
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,4 @@
+language: node_js
+sudo: false
+node_js:
+  - "4.2"

http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/blob/5ea854d8/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index f3c0b93..8fe3707 100644
--- a/README.md
+++ b/README.md
@@ -17,6 +17,8 @@
 #         under the License.
 -->
 
+[![Build 
Status](https://travis-ci.org/apache/cordova-plugin-splashscreen.svg?branch=master)](https://travis-ci.org/apache/cordova-plugin-splashscreen)
+
 # cordova-plugin-splashscreen
 
 This plugin displays and hides a splash screen during application launch.

http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/blob/5ea854d8/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 4f17756..64a61ae 100644
--- a/package.json
+++ b/package.json
@@ -34,6 +34,10 @@
     "cordova-windows",
     "cordova-tizen"
   ],
+  "scripts": {
+    "test": "npm run jshint",
+    "jshint": "node node_modules/jshint/bin/jshint www && node 
node_modules/jshint/bin/jshint src && node node_modules/jshint/bin/jshint tests"
+  },
   "engines": [
     {
       "name": "cordova-android",
@@ -41,5 +45,8 @@
     }
   ],
   "author": "Apache Software Foundation",
-  "license": "Apache-2.0"
+  "license": "Apache-2.0",
+  "devDependencies": {
+    "jshint": "^2.6.0"
+  }
 }

http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/blob/5ea854d8/src/blackberry10/index.js
----------------------------------------------------------------------
diff --git a/src/blackberry10/index.js b/src/blackberry10/index.js
index bd7e48c..c682506 100644
--- a/src/blackberry10/index.js
+++ b/src/blackberry10/index.js
@@ -14,6 +14,8 @@
  * limitations under the License.
  */
 
+/* global PluginResult */
+
 module.exports = {
     show: function (success, fail, args, env) {
         var result = new PluginResult(args, env);

http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/blob/5ea854d8/src/browser/SplashScreenProxy.js
----------------------------------------------------------------------
diff --git a/src/browser/SplashScreenProxy.js b/src/browser/SplashScreenProxy.js
index d19f8c8..68843ff 100644
--- a/src/browser/SplashScreenProxy.js
+++ b/src/browser/SplashScreenProxy.js
@@ -18,17 +18,18 @@
  * under the License.
  *
 */
+
 // Default parameter values including image size can be changed in `config.xml`
 var splashImageWidth = 170;
 var splashImageHeight = 200;
 var position = { x: 0, y: 0, width: splashImageWidth, height: 
splashImageHeight }; 
-var splash = null; //
 var localSplash; // the image to display
 var localSplashImage;
 var bgColor = "#464646";
 var imageSrc = 'img/logo.png';
 var splashScreenDelay = 3000; // in milliseconds
 var showSplashScreen = true; // show splashcreen by default
+var cordova = require('cordova');
 var configHelper = cordova.require('cordova/confighelper');
 
 function updateImageLocation() {
@@ -103,7 +104,6 @@ function readPreferencesFromCfg(cfg) {
     } catch(e) {
         var msg = '[Browser][SplashScreen] Error occured on loading 
preferences from config.xml: ' + JSON.stringify(e);
         console.error(msg);
-        error(msg);
     }
 }
 

http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/blob/5ea854d8/src/tizen/SplashScreenProxy.js
----------------------------------------------------------------------
diff --git a/src/tizen/SplashScreenProxy.js b/src/tizen/SplashScreenProxy.js
index fbd9f35..e2eb36b 100644
--- a/src/tizen/SplashScreenProxy.js
+++ b/src/tizen/SplashScreenProxy.js
@@ -19,6 +19,8 @@
  *
 */
 
+/* global win:true */
+
 ( function() {
 
 win = null;

http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/blob/5ea854d8/tests/tests.js
----------------------------------------------------------------------
diff --git a/tests/tests.js b/tests/tests.js
index 8c4d22b..7b55a81 100644
--- a/tests/tests.js
+++ b/tests/tests.js
@@ -19,18 +19,20 @@
  *
 */
 
-exports.defineAutoTest = function () {
+/* jshint jasmine: true */
+
+exports.defineAutoTests = function () {
     describe('Splashscreen (cordova)', function () {
         it("splashscreen.spec.1 should exist", function () {
             expect(navigator.splashscreen).toBeDefined();
         });
 
-        it("splashscreen.spec.2 exec method should exist", function () {
+        it("splashscreen.spec.2 show method should exist", function () {
             expect(navigator.splashscreen.show).toBeDefined();
             expect(typeof navigator.splashscreen.show).toBe('function');
         });
 
-        it("splashscreen.spec.3 exec method should exist", function () {
+        it("splashscreen.spec.3 hide method should exist", function () {
             expect(navigator.splashscreen.hide).toBeDefined();
             expect(typeof navigator.splashscreen.hide).toBe('function');
         });

http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/blob/5ea854d8/www/windows/SplashScreenProxy.js
----------------------------------------------------------------------
diff --git a/www/windows/SplashScreenProxy.js b/www/windows/SplashScreenProxy.js
index 271a14c..1c54883 100644
--- a/www/windows/SplashScreenProxy.js
+++ b/www/windows/SplashScreenProxy.js
@@ -20,17 +20,16 @@
 */
 
 /*jslint sloppy:true */
-/*global Windows:true, require, module, window, document, WinJS */
+/*global WinJS */
 
-var cordova = require('cordova'),
-    channel = require('cordova/channel');
+var cordova = require('cordova');
 
 var isPhone = (cordova.platformId == "windows") && WinJS.Utilities.isPhone;
 var isHosted = window.location.protocol.indexOf('http') === 0;
-var localSplash = null;
+var localSplash = null, localSplashImage = null;
 var bgColor = "#464646"; // default backgrond color; TDOO - read it from 
.appxmanifest
-var splashImageSrc = (isHosted ? "ms-appx-web" : "ms-appx") + ":///images/"
-    + (isPhone ? "splashscreenphone.png" : "splashscreen.png");
+var splashImageSrc = (isHosted ? "ms-appx-web" : "ms-appx") + ":///images/" +
+    (isPhone ? "splashscreenphone.png" : "splashscreen.png");
 
 var SplashScreen = {
     setBGColor: function (cssBGColor) {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to