Touchgui/plugins/org.apache.cordova.splashscreen/tests/tests.js

changeset 0
e8ccd40d0ef6
equal deleted inserted replaced
-1:000000000000 0:0aa1b54ea438
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 exports.defineAutoTest = function () {
23 describe('Splashscreen (cordova)', function () {
24 it("splashscreen.spec.1 should exist", function () {
25 expect(navigator.splashscreen).toBeDefined();
26 });
27
28 it("splashscreen.spec.2 exec method should exist", function () {
29 expect(navigator.splashscreen.show).toBeDefined();
30 expect(typeof navigator.splashscreen.show).toBe('function');
31 });
32
33 it("splashscreen.spec.3 exec method should exist", function () {
34 expect(navigator.splashscreen.hide).toBeDefined();
35 expect(typeof navigator.splashscreen.hide).toBe('function');
36 });
37 });
38 };
39
40 exports.defineManualTests = function (contentEl, createActionButton) {
41 function showFor(duration) {
42 navigator.splashscreen.show();
43 window.setTimeout(function () {
44 navigator.splashscreen.hide();
45 }, 1000 * duration);
46 }
47
48 contentEl.innerHTML = '<h1>Splashscreen Tests</h1>' +
49 '<h3>Note for WP: AutoHideSplashScreen must be set to false in config.xml</h3>' +
50 '<div id="show1"></div>' +
51 'Expected result: Will show the Cordova splashscreen for 1 second' +
52 '</p> <div id="show5"></div>' +
53 'Expected result: Will show the Cordova splashscreen for 5 seconds';
54
55 createActionButton('Show for 1 second', function () {
56 showFor(1);
57 }, 'show1');
58
59 createActionButton('Show for 5 seconds', function () {
60 showFor(5);
61 }, 'show5');
62 };

mercurial