You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by mm...@apache.org on 2014/07/18 19:58:07 UTC
git commit: CB-7168 Moving Device autotests to plugin (aka new-style
tests)
Repository: cordova-plugin-device
Updated Branches:
refs/heads/master 4abfe6ec9 -> f62e825e6
CB-7168 Moving Device autotests to plugin (aka new-style tests)
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/commit/f62e825e
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/tree/f62e825e
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/diff/f62e825e
Branch: refs/heads/master
Commit: f62e825e677a47effa3369589e391b2a6ae7dd02
Parents: 4abfe6e
Author: Michal Mocny <mm...@gmail.com>
Authored: Fri Jul 18 13:57:44 2014 -0400
Committer: Michal Mocny <mm...@gmail.com>
Committed: Fri Jul 18 13:57:44 2014 -0400
----------------------------------------------------------------------
tests/plugin.xml | 31 ++++++++++++++++++++++
tests/tests.js | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 103 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/blob/f62e825e/tests/plugin.xml
----------------------------------------------------------------------
diff --git a/tests/plugin.xml b/tests/plugin.xml
new file mode 100644
index 0000000..e9f918c
--- /dev/null
+++ b/tests/plugin.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
+ xmlns:rim="http://www.blackberry.com/ns/widgets"
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ id="org.apache.cordova.device.tests"
+ version="0.2.11-dev">
+ <name>Cordova Device Plugin Tests</name>
+ <license>Apache 2.0</license>
+
+ <js-module src="tests.js" name="tests">
+ </js-module>
+</plugin>
http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/blob/f62e825e/tests/tests.js
----------------------------------------------------------------------
diff --git a/tests/tests.js b/tests/tests.js
new file mode 100644
index 0000000..e22b7c1
--- /dev/null
+++ b/tests/tests.js
@@ -0,0 +1,72 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+exports.defineAutoTests = function() {
+ describe('Device Information (window.device)', function () {
+ it("should exist", function() {
+ expect(window.device).toBeDefined();
+ });
+
+ it("should contain a platform specification that is a string", function() {
+ expect(window.device.platform).toBeDefined();
+ expect((new String(window.device.platform)).length > 0).toBe(true);
+ });
+
+ it("should contain a version specification that is a string", function() {
+ expect(window.device.version).toBeDefined();
+ expect((new String(window.device.version)).length > 0).toBe(true);
+ });
+
+ it("should contain a UUID specification that is a string or a number", function() {
+ expect(window.device.uuid).toBeDefined();
+ if (typeof window.device.uuid == 'string' || typeof window.device.uuid == 'object') {
+ expect((new String(window.device.uuid)).length > 0).toBe(true);
+ } else {
+ expect(window.device.uuid > 0).toBe(true);
+ }
+ });
+
+ it("should contain a cordova specification that is a string", function() {
+ expect(window.device.cordova).toBeDefined();
+ expect((new String(window.device.cordova)).length > 0).toBe(true);
+ });
+
+ it("should depend on the precense of cordova.version string", function() {
+ expect(window.cordova.version).toBeDefined();
+ expect((new String(window.cordova.version)).length > 0).toBe(true);
+ });
+
+ it("should contain device.cordova equal to cordova.version", function() {
+ expect(window.device.cordova).toBe(window.cordova.version);
+ });
+
+ it("should contain a model specification that is a string", function() {
+ expect(window.device.model).toBeDefined();
+ expect((new String(window.device.model)).length > 0).toBe(true);
+ });
+ });
+};
+
+exports.defineManualTests = function(contentEl, createActionButton) {
+ createActionButton('Dump device', function() {
+ console.log(JSON.stringify(window.device, null, '\t'));
+ });
+};