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 2013/10/29 21:39:07 UTC

git commit: remember your location across restarts

Updated Branches:
  refs/heads/cdvtest d2df95374 -> 88ae03c89


remember your location across restarts


Project: http://git-wip-us.apache.org/repos/asf/cordova-labs/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-labs/commit/88ae03c8
Tree: http://git-wip-us.apache.org/repos/asf/cordova-labs/tree/88ae03c8
Diff: http://git-wip-us.apache.org/repos/asf/cordova-labs/diff/88ae03c8

Branch: refs/heads/cdvtest
Commit: 88ae03c8936e599ca3ff9d022ff204dcd2b64cfd
Parents: d2df953
Author: Michal Mocny <mm...@gmail.com>
Authored: Tue Oct 29 16:38:52 2013 -0400
Committer: Michal Mocny <mm...@gmail.com>
Committed: Tue Oct 29 16:38:52 2013 -0400

----------------------------------------------------------------------
 cordova-app-test-harness/www/main.js | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-labs/blob/88ae03c8/cordova-app-test-harness/www/main.js
----------------------------------------------------------------------
diff --git a/cordova-app-test-harness/www/main.js b/cordova-app-test-harness/www/main.js
index 34d1402..a972a33 100644
--- a/cordova-app-test-harness/www/main.js
+++ b/cordova-app-test-harness/www/main.js
@@ -11,7 +11,12 @@ function getURLParameter(name) {
 }
 
 function getMode() {
-  return getURLParameter('mode') || 'main';
+  return getURLParameter('mode') || localStorage['mode'] || 'main';
+}
+
+function setMode(mode) {
+  localStorage['mode'] = mode;
+  location.href = 'index.html?mode=' + mode;
 }
 
 function setTitle(title) {
@@ -48,8 +53,8 @@ function logger() {
 
 function runMain() {
   setTitle('Cordova Tests');
-  createButton('Auto Tests', function() { location.href = 'index.html?mode=autotests'; });
-  createButton('Manual Tests', function() { location.href = 'index.html?mode=manualtests'; });
+  createButton('Auto Tests', function() { setMode('autotests'); });
+  createButton('Manual Tests', function() { setMode('manualtests'); });
 
   setDeviceInfo();
 }
@@ -77,7 +82,7 @@ function setDeviceInfo() {
 
 function runAutoTests() {
   setTitle('Auto Tests');
-  createButton('Back', function() { location.href = 'index.html'; });
+  createButton('Back', function() { setMode('main'); });
 
   var jasmine = jasmineRequire.core(jasmineRequire);
   jasmineRequire.html(jasmine);
@@ -139,14 +144,14 @@ function runAutoTests() {
 
 function runManualTests() {
   setTitle('Manual Tests');
-  createButton('Back', function() { location.href = 'index.html'; });
+  createButton('Back', function() { setMode('main'); });
 }
 
 /******************************************************************************/
 
 function runUnknownMode() {
   setTitle('Unknown Mode');
-  createButton('Reset', function() { location.href = 'index.html'; });
+  createButton('Reset', function() { setMode('main'); });
 }
 
 /******************************************************************************/