From cd8e3c8854a592b726af85d3d2f170f3ca0b5b35 Mon Sep 17 00:00:00 2001 From: Gabriel Zayas Date: Tue, 27 Jun 2023 19:12:55 +0900 Subject: [PATCH 1/2] Clean up JavaScript --- app/views/magic_test/_context_menu.html.erb | 7 ++-- app/views/magic_test/_finders.html | 15 ++++---- app/views/magic_test/_javascript_helpers.html | 34 +++++++++---------- app/views/magic_test/_key_codes.html | 3 +- app/views/magic_test/_mutation_observer.html | 16 +++------ app/views/magic_test/_storage.html | 4 +-- 6 files changed, 34 insertions(+), 45 deletions(-) diff --git a/app/views/magic_test/_context_menu.html.erb b/app/views/magic_test/_context_menu.html.erb index 40370ca..9467937 100644 --- a/app/views/magic_test/_context_menu.html.erb +++ b/app/views/magic_test/_context_menu.html.erb @@ -11,9 +11,8 @@ enableKeyboardShortcuts(); }); - function enableKeyboardShortcuts() { - // Ctrl+A to generate an assertion + // Ctrl+A to generate an assertion. function keydown(event) { if (event.ctrlKey && event.shiftKey && event.key === 'A') { event.preventDefault(); @@ -31,6 +30,8 @@ var target = ""; var options = ""; var accept = "You selected:\n\r" + text + "\n\rOk: Type `flush` into debugger console to add to test.\nCancel: To select new text." + + // TODO: We should use try...catch here. if (window.confirm(accept)) { testingOutput.push({action: action, target: target, options: options}); sessionStorage.setItem("testingOutput", JSON.stringify(testingOutput)); @@ -59,6 +60,8 @@ var target = ""; var options = ""; var accept = "You selected:\n\r" + text + "\n\rOk: Type `flush` into debugger console to add to test.\nCancel: To select new text." + + // TODO: We should use try...catch here. if (window.confirm(accept)) { testingOutput.push({action: action, target: target, options: options}); sessionStorage.setItem("testingOutput", JSON.stringify(testingOutput)); diff --git a/app/views/magic_test/_finders.html b/app/views/magic_test/_finders.html index eeb9eea..8e7c197 100644 --- a/app/views/magic_test/_finders.html +++ b/app/views/magic_test/_finders.html @@ -1,20 +1,19 @@ diff --git a/app/views/magic_test/_javascript_helpers.html b/app/views/magic_test/_javascript_helpers.html index d9ff750..a0f89f4 100644 --- a/app/views/magic_test/_javascript_helpers.html +++ b/app/views/magic_test/_javascript_helpers.html @@ -1,31 +1,30 @@ diff --git a/app/views/magic_test/_key_codes.html b/app/views/magic_test/_key_codes.html index ea99b4f..f867050 100644 --- a/app/views/magic_test/_key_codes.html +++ b/app/views/magic_test/_key_codes.html @@ -46,5 +46,4 @@ } return codes[charCode]; } - - \ No newline at end of file + diff --git a/app/views/magic_test/_mutation_observer.html b/app/views/magic_test/_mutation_observer.html index 9bf22eb..ea85bfd 100644 --- a/app/views/magic_test/_mutation_observer.html +++ b/app/views/magic_test/_mutation_observer.html @@ -1,15 +1,14 @@ \ No newline at end of file + diff --git a/app/views/magic_test/_storage.html b/app/views/magic_test/_storage.html index ae85b24..dbbeb02 100644 --- a/app/views/magic_test/_storage.html +++ b/app/views/magic_test/_storage.html @@ -4,6 +4,4 @@ sessionStorage.setItem("testingOutput", JSON.stringify([])); } } - - - \ No newline at end of file + From 30e05b36d8189d4397d12d7d8b21c614c82ee9ef Mon Sep 17 00:00:00 2001 From: Gabriel Zayas Date: Tue, 27 Jun 2023 19:30:53 +0900 Subject: [PATCH 2/2] Remove TODOs about try...catch --- app/views/magic_test/_context_menu.html.erb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/views/magic_test/_context_menu.html.erb b/app/views/magic_test/_context_menu.html.erb index 9467937..81e01de 100644 --- a/app/views/magic_test/_context_menu.html.erb +++ b/app/views/magic_test/_context_menu.html.erb @@ -30,8 +30,6 @@ var target = ""; var options = ""; var accept = "You selected:\n\r" + text + "\n\rOk: Type `flush` into debugger console to add to test.\nCancel: To select new text." - - // TODO: We should use try...catch here. if (window.confirm(accept)) { testingOutput.push({action: action, target: target, options: options}); sessionStorage.setItem("testingOutput", JSON.stringify(testingOutput)); @@ -60,8 +58,6 @@ var target = ""; var options = ""; var accept = "You selected:\n\r" + text + "\n\rOk: Type `flush` into debugger console to add to test.\nCancel: To select new text." - - // TODO: We should use try...catch here. if (window.confirm(accept)) { testingOutput.push({action: action, target: target, options: options}); sessionStorage.setItem("testingOutput", JSON.stringify(testingOutput));