This is an automated email from the ASF dual-hosted git repository.

shenyi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git

commit e57d21dcfbaf3b33146b49acb04a4f44a8ff83b0
Author: pissang <bm2736...@gmail.com>
AuthorDate: Wed Sep 11 17:02:55 2019 +0800

    test: add alert if scroll changed during action recording
---
 test/runTest/actions/__meta__.json |  3 ++-
 test/runTest/actions/axes.json     |  1 +
 test/runTest/recorder/recorder.js  | 15 +++++++++++++--
 3 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/test/runTest/actions/__meta__.json 
b/test/runTest/actions/__meta__.json
index 8af1757..d9b9e28 100644
--- a/test/runTest/actions/__meta__.json
+++ b/test/runTest/actions/__meta__.json
@@ -127,5 +127,6 @@
   "treemap-obama": 1,
   "treemap-option": 1,
   "treemap-option2": 1,
-  "visualMap-categories": 1
+  "visualMap-categories": 1,
+  "axes": 0
 }
\ No newline at end of file
diff --git a/test/runTest/actions/axes.json b/test/runTest/actions/axes.json
new file mode 100644
index 0000000..0637a08
--- /dev/null
+++ b/test/runTest/actions/axes.json
@@ -0,0 +1 @@
+[]
\ No newline at end of file
diff --git a/test/runTest/recorder/recorder.js 
b/test/runTest/recorder/recorder.js
index fc74b38..44c6323 100644
--- a/test/runTest/recorder/recorder.js
+++ b/test/runTest/recorder/recorder.js
@@ -196,6 +196,7 @@ function notify(title, message) {
 
 function keyboardRecordingHandler(e) {
     if (e.key.toLowerCase() === 'r' && e.shiftKey) {
+        let $iframe = getIframe();
         if (!app.recordingAction) {
             // Create a new action if currentAction has ops.
             if (!app.currentAction || app.currentAction.ops.length > 0) {
@@ -204,7 +205,6 @@ function keyboardRecordingHandler(e) {
 
             app.recordingAction = app.currentAction;
             if (app.recordingAction) {
-                let $iframe = getIframe();
                 app.recordingAction.scrollY = $iframe.contentWindow.scrollY;
                 app.recordingAction.scrollX = $iframe.contentWindow.scrollX;
                 app.recordingAction.timestamp = Date.now();
@@ -213,8 +213,19 @@ function keyboardRecordingHandler(e) {
             }
         }
         else {
+            if (app.recordingAction &&
+                (app.recordingAction.scrollY !== $iframe.contentWindow.scrollY
+             || app.recordingAction.scrollX !== 
$iframe.contentWindow.scrollX)) {
+                app.recordingAction.ops = [];
+                app.$alert('You can\'t scroll the page during the action 
recording. Please create another action after scrolled to the next demo.', 
'Recording Fail', {
+                    confirmButtonText: 'Get!'
+                });
+
+            }
+            else {
+                saveData();
+            }
             app.recordingAction = null;
-            saveData();
         }
         // Get scroll
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@echarts.apache.org
For additional commands, e-mail: commits-h...@echarts.apache.org

Reply via email to