arnaucube
arnaucube/openEventsPlatformAppPublic Self-hosted repository
openEventsPlatformApp/plugins/cordova-plugin-splashscreen/tests/tests.js
plugins/cordova-plugin-splashscreen/tests/tests.jsRaw
 1/*
 2 *
 3 * Licensed to the Apache Software Foundation (ASF) under one
 4 * or more contributor license agreements.  See the NOTICE file
 5 * distributed with this work for additional information
 6 * regarding copyright ownership.  The ASF licenses this file
 7 * to you under the Apache License, Version 2.0 (the
 8 * "License"); you may not use this file except in compliance
 9 * with the License.  You may obtain a copy of the License at
10 *
11 *   http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied.  See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20*/
21
22/* jshint jasmine: true */
23
24exports.defineAutoTests = function () {
25    describe('Splashscreen (cordova)', function () {
26        it("splashscreen.spec.1 should exist", function () {
27            expect(navigator.splashscreen).toBeDefined();
28        });
29
30        it("splashscreen.spec.2 show method should exist", function () {
31            expect(navigator.splashscreen.show).toBeDefined();
32            expect(typeof navigator.splashscreen.show).toBe('function');
33        });
34
35        it("splashscreen.spec.3 hide method should exist", function () {
36            expect(navigator.splashscreen.hide).toBeDefined();
37            expect(typeof navigator.splashscreen.hide).toBe('function');
38        });
39    });
40};
41
42exports.defineManualTests = function (contentEl, createActionButton) {
43    function showFor(duration) {
44        navigator.splashscreen.show();
45        window.setTimeout(function () {
46            navigator.splashscreen.hide();
47        }, 1000 * duration);
48    }
49
50    contentEl.innerHTML = '<h1>Splashscreen Tests</h1>' +
51        '<h3>Note for WP: AutoHideSplashScreen must be set to false in config.xml</h3>' +
52        '<div id="show1"></div>' +
53        'Expected result: Will show the Cordova splashscreen for 1 second' +
54        '</p> <div id="show5"></div>' +
55        'Expected result: Will show the Cordova splashscreen for 5 seconds';
56
57    createActionButton('Show for 1 second', function () {
58        showFor(1);
59    }, 'show1');
60
61    createActionButton('Show for 5 seconds', function () {
62        showFor(5);
63    }, 'show5');
64};