You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
2.3 KiB

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