CB-10636 Add JSHint for plugins
Fixed autotests
This commit is contained in:
parent
e401a4de0f
commit
5ea854d8c3
16
.jshintrc
Normal file
16
.jshintrc
Normal file
@ -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
|
||||||
|
}
|
||||||
|
}
|
4
.travis.yml
Normal file
4
.travis.yml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
language: node_js
|
||||||
|
sudo: false
|
||||||
|
node_js:
|
||||||
|
- "4.2"
|
@ -17,6 +17,8 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
[](https://travis-ci.org/apache/cordova-plugin-splashscreen)
|
||||||
|
|
||||||
# cordova-plugin-splashscreen
|
# cordova-plugin-splashscreen
|
||||||
|
|
||||||
This plugin displays and hides a splash screen during application launch.
|
This plugin displays and hides a splash screen during application launch.
|
||||||
|
@ -34,6 +34,10 @@
|
|||||||
"cordova-windows",
|
"cordova-windows",
|
||||||
"cordova-tizen"
|
"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": [
|
"engines": [
|
||||||
{
|
{
|
||||||
"name": "cordova-android",
|
"name": "cordova-android",
|
||||||
@ -41,5 +45,8 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"author": "Apache Software Foundation",
|
"author": "Apache Software Foundation",
|
||||||
"license": "Apache-2.0"
|
"license": "Apache-2.0",
|
||||||
|
"devDependencies": {
|
||||||
|
"jshint": "^2.6.0"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* global PluginResult */
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
show: function (success, fail, args, env) {
|
show: function (success, fail, args, env) {
|
||||||
var result = new PluginResult(args, env);
|
var result = new PluginResult(args, env);
|
||||||
|
@ -18,17 +18,18 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Default parameter values including image size can be changed in `config.xml`
|
// Default parameter values including image size can be changed in `config.xml`
|
||||||
var splashImageWidth = 170;
|
var splashImageWidth = 170;
|
||||||
var splashImageHeight = 200;
|
var splashImageHeight = 200;
|
||||||
var position = { x: 0, y: 0, width: splashImageWidth, height: splashImageHeight };
|
var position = { x: 0, y: 0, width: splashImageWidth, height: splashImageHeight };
|
||||||
var splash = null; //
|
|
||||||
var localSplash; // the image to display
|
var localSplash; // the image to display
|
||||||
var localSplashImage;
|
var localSplashImage;
|
||||||
var bgColor = "#464646";
|
var bgColor = "#464646";
|
||||||
var imageSrc = 'img/logo.png';
|
var imageSrc = 'img/logo.png';
|
||||||
var splashScreenDelay = 3000; // in milliseconds
|
var splashScreenDelay = 3000; // in milliseconds
|
||||||
var showSplashScreen = true; // show splashcreen by default
|
var showSplashScreen = true; // show splashcreen by default
|
||||||
|
var cordova = require('cordova');
|
||||||
var configHelper = cordova.require('cordova/confighelper');
|
var configHelper = cordova.require('cordova/confighelper');
|
||||||
|
|
||||||
function updateImageLocation() {
|
function updateImageLocation() {
|
||||||
@ -103,7 +104,6 @@ function readPreferencesFromCfg(cfg) {
|
|||||||
} catch(e) {
|
} catch(e) {
|
||||||
var msg = '[Browser][SplashScreen] Error occured on loading preferences from config.xml: ' + JSON.stringify(e);
|
var msg = '[Browser][SplashScreen] Error occured on loading preferences from config.xml: ' + JSON.stringify(e);
|
||||||
console.error(msg);
|
console.error(msg);
|
||||||
error(msg);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* global win:true */
|
||||||
|
|
||||||
( function() {
|
( function() {
|
||||||
|
|
||||||
win = null;
|
win = null;
|
||||||
|
@ -19,18 +19,20 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
exports.defineAutoTest = function () {
|
/* jshint jasmine: true */
|
||||||
|
|
||||||
|
exports.defineAutoTests = function () {
|
||||||
describe('Splashscreen (cordova)', function () {
|
describe('Splashscreen (cordova)', function () {
|
||||||
it("splashscreen.spec.1 should exist", function () {
|
it("splashscreen.spec.1 should exist", function () {
|
||||||
expect(navigator.splashscreen).toBeDefined();
|
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(navigator.splashscreen.show).toBeDefined();
|
||||||
expect(typeof navigator.splashscreen.show).toBe('function');
|
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(navigator.splashscreen.hide).toBeDefined();
|
||||||
expect(typeof navigator.splashscreen.hide).toBe('function');
|
expect(typeof navigator.splashscreen.hide).toBe('function');
|
||||||
});
|
});
|
||||||
|
@ -20,17 +20,16 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*jslint sloppy:true */
|
/*jslint sloppy:true */
|
||||||
/*global Windows:true, require, module, window, document, WinJS */
|
/*global WinJS */
|
||||||
|
|
||||||
var cordova = require('cordova'),
|
var cordova = require('cordova');
|
||||||
channel = require('cordova/channel');
|
|
||||||
|
|
||||||
var isPhone = (cordova.platformId == "windows") && WinJS.Utilities.isPhone;
|
var isPhone = (cordova.platformId == "windows") && WinJS.Utilities.isPhone;
|
||||||
var isHosted = window.location.protocol.indexOf('http') === 0;
|
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 bgColor = "#464646"; // default backgrond color; TDOO - read it from .appxmanifest
|
||||||
var splashImageSrc = (isHosted ? "ms-appx-web" : "ms-appx") + ":///images/"
|
var splashImageSrc = (isHosted ? "ms-appx-web" : "ms-appx") + ":///images/" +
|
||||||
+ (isPhone ? "splashscreenphone.png" : "splashscreen.png");
|
(isPhone ? "splashscreenphone.png" : "splashscreen.png");
|
||||||
|
|
||||||
var SplashScreen = {
|
var SplashScreen = {
|
||||||
setBGColor: function (cssBGColor) {
|
setBGColor: function (cssBGColor) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user