Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4FE1D11863 for ; Thu, 10 Jul 2014 15:41:29 +0000 (UTC) Received: (qmail 13202 invoked by uid 500); 10 Jul 2014 15:41:29 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 13154 invoked by uid 500); 10 Jul 2014 15:41:29 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 13130 invoked by uid 99); 10 Jul 2014 15:41:29 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Jul 2014 15:41:29 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id DF2459AB3B8; Thu, 10 Jul 2014 15:41:28 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: mmocny@apache.org To: commits@cordova.apache.org Date: Thu, 10 Jul 2014 15:41:28 -0000 Message-Id: <48265a3cdaa243a5929c1c5585aa4aad@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [01/26] cordova-plugin-test-harness has moved Repository: cordova-labs Updated Branches: refs/heads/cdvtest 500da73f2 -> ce08dd6c6 http://git-wip-us.apache.org/repos/asf/cordova-labs/blob/ce08dd6c/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/light-combo-box-bg.png ---------------------------------------------------------------------- diff --git a/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/light-combo-box-bg.png b/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/light-combo-box-bg.png deleted file mode 100755 index f619677..0000000 Binary files a/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/light-combo-box-bg.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/cordova-labs/blob/ce08dd6c/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/light-combo-box-bg2x.png ---------------------------------------------------------------------- diff --git a/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/light-combo-box-bg2x.png b/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/light-combo-box-bg2x.png deleted file mode 100755 index 57663ca..0000000 Binary files a/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/light-combo-box-bg2x.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/cordova-labs/blob/ce08dd6c/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/light-grips.png ---------------------------------------------------------------------- diff --git a/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/light-grips.png b/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/light-grips.png deleted file mode 100755 index 1692347..0000000 Binary files a/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/light-grips.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/cordova-labs/blob/ce08dd6c/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/light-sprites2x.png ---------------------------------------------------------------------- diff --git a/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/light-sprites2x.png b/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/light-sprites2x.png deleted file mode 100755 index a70f5dc..0000000 Binary files a/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/light-sprites2x.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/cordova-labs/blob/ce08dd6c/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/pop-up-triangle-dark.png ---------------------------------------------------------------------- diff --git a/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/pop-up-triangle-dark.png b/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/pop-up-triangle-dark.png deleted file mode 100755 index 53e79bc..0000000 Binary files a/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/pop-up-triangle-dark.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/cordova-labs/blob/ce08dd6c/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/pop-up-triangle.png ---------------------------------------------------------------------- diff --git a/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/pop-up-triangle.png b/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/pop-up-triangle.png deleted file mode 100755 index 0467cc5..0000000 Binary files a/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/pop-up-triangle.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/cordova-labs/blob/ce08dd6c/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/search-bg.png ---------------------------------------------------------------------- diff --git a/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/search-bg.png b/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/search-bg.png deleted file mode 100755 index 54181ee..0000000 Binary files a/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/search-bg.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/cordova-labs/blob/ce08dd6c/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/search-bg2x.png ---------------------------------------------------------------------- diff --git a/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/search-bg2x.png b/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/search-bg2x.png deleted file mode 100755 index f886480..0000000 Binary files a/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/search-bg2x.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/cordova-labs/blob/ce08dd6c/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/search.svg ---------------------------------------------------------------------- diff --git a/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/search.svg b/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/search.svg deleted file mode 100755 index d18a4fa..0000000 --- a/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/search.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - Slice 1 - Created with Sketch (http://www.bohemiancoding.com/sketch) - - - - - - - \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-labs/blob/ce08dd6c/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/search_bw.svg ---------------------------------------------------------------------- diff --git a/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/search_bw.svg b/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/search_bw.svg deleted file mode 100755 index 9ab9e71..0000000 --- a/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/search_bw.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - -]> - - - http://git-wip-us.apache.org/repos/asf/cordova-labs/blob/ce08dd6c/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/search_dark.svg ---------------------------------------------------------------------- diff --git a/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/search_dark.svg b/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/search_dark.svg deleted file mode 100755 index 9ab9e71..0000000 --- a/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/search_dark.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - -]> - - - http://git-wip-us.apache.org/repos/asf/cordova-labs/blob/ce08dd6c/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/search_light.svg ---------------------------------------------------------------------- diff --git a/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/search_light.svg b/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/search_light.svg deleted file mode 100755 index 0c0dff6..0000000 --- a/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/search_light.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - Slice 1 - Created with Sketch (http://www.bohemiancoding.com/sketch) - - - - - - - \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-labs/blob/ce08dd6c/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/spinner.png ---------------------------------------------------------------------- diff --git a/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/spinner.png b/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/spinner.png deleted file mode 100755 index ae457fa..0000000 Binary files a/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/spinner.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/cordova-labs/blob/ce08dd6c/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/spinner2x.png ---------------------------------------------------------------------- diff --git a/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/spinner2x.png b/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/spinner2x.png deleted file mode 100755 index 3b77ee6..0000000 Binary files a/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/img/spinner2x.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/cordova-labs/blob/ce08dd6c/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/package.json ---------------------------------------------------------------------- diff --git a/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/package.json b/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/package.json deleted file mode 100755 index 03c64ef..0000000 --- a/cordova-plugin-test-framework/www/assets/topcoat-0.7.5/package.json +++ /dev/null @@ -1,85 +0,0 @@ -{ - "name": "topcoat", - "version": "0.7.5", - "description": "CSS for clean and fast web apps", - "main": "Gruntfile.js", - "directories": { - "doc": "doc", - "test": "test" - }, - "dependencies": { - "topcoat-utils": "~0.1.3", - "topcoat-radio-button-base": "~0.1.1", - "topcoat-button-base": "~0.6.0", - "topcoat-radio-button": "~0.1.2", - "topcoat-navigation-bar-base": "~0.4.0", - "topcoat-navigation-bar": "~0.4.2", - "topcoat-input-base": "~0.4.1", - "topcoat-list-base": "~0.4.1", - "topcoat-list": "~0.5.0", - "topcoat-search-input": "~0.3.0", - "topcoat-search-input-base": "~0.1.2", - "topcoat-checkbox": "~0.4.0", - "topcoat-checkbox-base": "~0.1.3", - "topcoat-button": "~0.5.3", - "topcoat-icon-button": "~0.3.3", - "topcoat-button-bar-base": "~0.1.1", - "topcoat-button-bar": "~0.1.0", - "topcoat-textarea": "~0.3.0", - "topcoat-theme": "~0.5.24", - "topcoat-text-input": "~0.3.4", - "topcoat-textarea-base": "~0.3.2", - "topcoat-notification": "~0.1.1", - "topcoat-notification-base": "0.0.1", - "topcoat-tab-bar": "~0.1.0", - "topcoat-switch": "~0.1.3", - "topcoat-switch-base": "~0.1.0", - "topcoat-range-base": "0.0.3", - "topcoat-range": "~0.1.0" - }, - "devDependencies": { - "grunt": "~0.4.1", - "grunt-contrib-copy": "~0.4.1", - "grunt-contrib-jade": "~0.4.0", - "grunt-contrib-watch": "~0.1.4", - "grunt-contrib-clean": "~0.4.1", - "grunt-exec": "~0.4.2", - "grunt-contrib-cssmin": "~0.5.0", - "jade": "~0.28.2", - "grunt-contrib-stylus": "~0.6.0", - "grunt-contrib-htmlmin": "~0.1.3", - "prompt": "*", - "csv": "*", - "topdoc-theme": "~0.2.7", - "grunt-topdoc": "~0.1.3", - "grunt-autoprefixer": "~0.2.20130806" - }, - "scripts": { - "test": "grunt test", - "prepublish": "grunt" - }, - "repository": { - "type": "git", - "url": "git://github.com/topcoat/topcoat.git" - }, - "bugs": { - "url": "https://github.com/topcoat/topcoat/issues" - }, - "license": { - "type": "Apache", - "url": "https://github.com/topcoat/topcoat/blob/master/LICENSE" - }, - "keywords": [ - "css", - "ui", - "ux", - "pattern", - "library", - "mobile", - "desktop", - "native", - "application", - "web", - "standards" - ] -} http://git-wip-us.apache.org/repos/asf/cordova-labs/blob/ce08dd6c/cordova-plugin-test-framework/www/jasmine_helpers.js ---------------------------------------------------------------------- diff --git a/cordova-plugin-test-framework/www/jasmine_helpers.js b/cordova-plugin-test-framework/www/jasmine_helpers.js deleted file mode 100644 index 364bd57..0000000 --- a/cordova-plugin-test-framework/www/jasmine_helpers.js +++ /dev/null @@ -1,94 +0,0 @@ -/* - * - * 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. - * -*/ - -'use strict'; - -exports.setUpJasmine = function() { - // Set up jasmine - var jasmine = jasmineRequire.core(jasmineRequire); - jasmineRequire.html(jasmine); - var jasmineEnv = jasmine.currentEnv_ = new jasmine.Env(); - - jasmine.DEFAULT_TIMEOUT_INTERVAL = 5000; - jasmineEnv.catchExceptions(false); - - // Set up jasmine interface - var jasmineInterface = Object.create(null); - jasmineInterface.jasmine = jasmine; - - // Fill in jasmineInterface with built-ins - var jasmine_env_functions = ['describe', - 'xdescribe', - 'it', - 'xit', - 'beforeEach', - 'afterEach', - 'expect', - 'pending', - 'spyOn', - 'addCustomEqualityTester', - 'addMatchers']; - - jasmine_env_functions.forEach(function(fn) { - jasmineInterface[fn] = jasmineEnv[fn].bind(jasmineEnv); - }); - jasmineInterface.clock = jasmineEnv.clock; - - // Add Reporters - addJasmineReporters(jasmineInterface, jasmineEnv); - - // Add Spec Filter - jasmineEnv.specFilter = function(spec) { - //console.log(spec.getFullName()); - return true; - }; - - return jasmineInterface; -} - -function addJasmineReporters(jasmineInterface, jasmineEnv) { - jasmineInterface.jsApiReporter = new jasmineInterface.jasmine.JsApiReporter({ timer: new jasmineInterface.jasmine.Timer() }); - jasmineEnv.addReporter(jasmineInterface.jsApiReporter); - - jasmineInterface.htmlReporter = new jasmineInterface.jasmine.HtmlReporter({ - env: jasmineEnv, - queryString: function() { return null; }, - onRaiseExceptionsClick: function() { }, - getContainer: function() { return document.getElementById('content'); }, - createElement: function() { return document.createElement.apply(document, arguments); }, - createTextNode: function() { return document.createTextNode.apply(document, arguments); }, - timer: new jasmineInterface.jasmine.Timer() - }); - jasmineInterface.htmlReporter.initialize(); - jasmineEnv.addReporter(jasmineInterface.htmlReporter); - - /* - if (window.medic.enabled) { - jasmineRequire.medic(jasmineInterface.jasmine); - jasmineInterface.MedicReporter = new jasmineInterface.jasmine.MedicReporter({ - env: jasmineEnv, - log: { logurl: window.medic.logurl } - }); - jasmineInterface.MedicReporter.initialize(); - jasmineEnv.addReporter(jasmineInterface.MedicReporter); - } - */ -} http://git-wip-us.apache.org/repos/asf/cordova-labs/blob/ce08dd6c/cordova-plugin-test-framework/www/main.js ---------------------------------------------------------------------- diff --git a/cordova-plugin-test-framework/www/main.js b/cordova-plugin-test-framework/www/main.js deleted file mode 100644 index a39a6bc..0000000 --- a/cordova-plugin-test-framework/www/main.js +++ /dev/null @@ -1,213 +0,0 @@ -/* - * - * 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. - * -*/ - -'use strict'; - -// TODO: re-add medic - -/******************************************************************************/ - -function getMode(callback) { - var mode = localStorage.getItem('cdvtests-mode') || 'main'; - callback(mode); -} - -function setMode(mode) { - var handlers = { - 'main': runMain, - 'auto': runAutoTests, - 'manual': runManualTests - } - if (!handlers.hasOwnProperty(mode)) { - console.error("Unsupported mode: " + mode); - console.error("Defaulting to 'main'"); - mode = 'main'; - } - - localStorage.setItem('cdvtests-mode', mode); - clearContent(); - - handlers[mode](); -} - -/******************************************************************************/ - -function clearContent() { - var content = document.getElementById('content'); - content.innerHTML = ''; - var log = document.getElementById('log--content'); - log.innerHTML = ''; - var buttons = document.getElementById('buttons'); - buttons.innerHTML = ''; - - setLogVisibility(false); -} - -/******************************************************************************/ - -function setTitle(title) { - var el = document.getElementById('title'); - el.textContent = title; -} - -/******************************************************************************/ - -function setLogVisibility(visible) { - if (visible) { - document.getElementById('log').classList.add('expanded'); - } else { - document.getElementById('log').classList.remove('expanded'); - } -} - -function toggleLogVisibility() { - var log = document.getElementById('log'); - if (log.classList.contains('expanded')) { - log.classList.remove('expanded'); - } else { - log.classList.add('expanded'); - } -} - -/******************************************************************************/ - -function attachEvents() { - document.getElementById('log--title').addEventListener('click', toggleLogVisibility); -} - -/******************************************************************************/ - -function wrapConsole() { - var origConsole = window.console; - - function appendToOnscreenLog(type, args) { - var el = document.getElementById('log--content'); - var div = document.createElement('div'); - div.classList.add('log--content--line'); - div.classList.add('log--content--line--' + type); - div.textContent = Array.prototype.slice.apply(args).map(function(arg) { - return (typeof arg === 'string') ? arg : JSON.stringify(arg); - }).join(' '); - el.appendChild(div); - // scroll to bottom - el.scrollTop = el.scrollHeight; - } - - function createCustomLogger(type) { - return function() { - origConsole[type].apply(origConsole, arguments); - //window.medic.log.apply(window.medic.log, arguments); - appendToOnscreenLog(type, arguments); - setLogVisibility(true); - } - } - - window.console = { - log: createCustomLogger('log'), - warn: createCustomLogger('warn'), - error: createCustomLogger('error'), - } -} - -/******************************************************************************/ - -function createActionButton(title, callback) { - var buttons = document.getElementById('buttons'); - var div = document.createElement('div'); - var button = document.createElement('a'); - button.textContent = title; - button.onclick = function(e) { - e.preventDefault(); - callback(); - }; - button.classList.add('topcoat-button'); - div.appendChild(button); - buttons.appendChild(div); -} - -/******************************************************************************/ -/******************************************************************************/ -/******************************************************************************/ - -function runAutoTests() { - setTitle('Auto Tests'); - - createActionButton('Again', setMode.bind(null, 'auto')); - createActionButton('Reset App', location.reload.bind(location)); - createActionButton('Back', setMode.bind(null, 'main')); - - var cdvtests = cordova.require('org.apache.cordova.test-framework.cdvtests'); - cdvtests.defineAutoTests(); - - // Run the tests! - var jasmineEnv = window.jasmine.getEnv(); - jasmineEnv.execute(); -} - -/******************************************************************************/ - -function runManualTests() { - setTitle('Manual Tests'); - - createActionButton('Reset App', location.reload.bind(location)); - createActionButton('Back', setMode.bind(null, 'main')); - - var contentEl = document.getElementById('content'); - var beforeEach = function(title) { - clearContent(); - setTitle(title || 'Manual Tests'); - createActionButton('Reset App', location.reload.bind(location)); - createActionButton('Back', setMode.bind(null, 'manual')); - } - var cdvtests = cordova.require('org.apache.cordova.test-framework.cdvtests'); - cdvtests.defineManualTests(contentEl, beforeEach, createActionButton); -} - -/******************************************************************************/ - -function runMain() { - setTitle('Cordova Tests'); - - createActionButton('Auto Tests', setMode.bind(null, 'auto')); - createActionButton('Manual Tests', setMode.bind(null, 'manual')); - createActionButton('Reset App', location.reload.bind(location)); -} - -/******************************************************************************/ - -exports.init = function() { - /* - window.medic.load(function() { - if (window.medic.enabled) { - setMode('auto'); - } else { - } - }); - */ - // TODO: have a way to opt-out of console wrapping in case line numbers are important. - // ...Or find a custom way to print line numbers using stack or something. - attachEvents(); - wrapConsole(); - - getMode(setMode); -}; - -/******************************************************************************/ http://git-wip-us.apache.org/repos/asf/cordova-labs/blob/ce08dd6c/cordova-plugin-test-framework/www/tests.js ---------------------------------------------------------------------- diff --git a/cordova-plugin-test-framework/www/tests.js b/cordova-plugin-test-framework/www/tests.js deleted file mode 100644 index 39e42ec..0000000 --- a/cordova-plugin-test-framework/www/tests.js +++ /dev/null @@ -1,108 +0,0 @@ -/* - * - * 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. - * -*/ - -'use strict'; - -exports.tests = Object.create(null); - -function getTestsObject(api) { - return exports.tests[api] = exports.tests[api] || { enabled: true }; -} - -function requireAllTestModules() { - // This finds all js-modules named "tests" (regardless of plugins they came from) - var test_modules = cordova.require('cordova/plugin_list') - .map(function(jsmodule) { - return jsmodule.id; - }) - .filter(function(id) { - return /\.tests$/.test(id); - }); - - // Map auto / manual test definitions for each, but without actually running the handlers - test_modules.forEach(function(id) { - try { - var plugintests = cordova.require(id); - - if (plugintests.hasOwnProperty('defineAutoTests')) { - getTestsObject(id).defineAutoTests = function() { - describe(id + ' >>', plugintests.defineAutoTests.bind(plugintests)); - }; - } - - if (plugintests.hasOwnProperty('defineManualTests')) { - getTestsObject(id).defineManualTests = plugintests.defineManualTests.bind(plugintests); - } - } catch(ex) { - console.warn('Failed to load tests: ', id); - return; - } - }); -} - -function createJasmineInterface() { - var jasmine_helpers = require('./jasmine_helpers'); - var jasmineInterface = jasmine_helpers.setUpJasmine(); - return jasmineInterface; -} - -function attachJasmineInterfaceToGlobal() { - var jasmineInterface = createJasmineInterface(); - for (var property in jasmineInterface) { - window[property] = jasmineInterface[property]; - } -} - -function detachJasmineInterfaceFromGlobal() { - var jasmineInterface = createJasmineInterface(); - for (var property in jasmineInterface) { - delete window[property]; - } -} - -exports.defineAutoTests = function() { - requireAllTestModules(); - attachJasmineInterfaceToGlobal(); - - Object.keys(exports.tests).forEach(function(key) { - if (!exports.tests[key].enabled) - return; - if (!exports.tests[key].hasOwnProperty('defineAutoTests')) - return; - exports.tests[key].defineAutoTests(); - }); -}; - -exports.defineManualTests = function(contentEl, beforeEach, createActionButton) { - requireAllTestModules(); - detachJasmineInterfaceFromGlobal(); - - Object.keys(exports.tests).forEach(function(key) { - if (!exports.tests[key].enabled) - return; - if (!exports.tests[key].hasOwnProperty('defineManualTests')) - return; - createActionButton(key, function() { - beforeEach(key); - exports.tests[key].defineManualTests(contentEl, createActionButton); - }); - }); -};