提交 e57d21dc 编写于 作者: P pissang 提交者: Yi Shen

test: add alert if scroll changed during action recording

上级 4a9f6ec2
......@@ -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
[]
\ No newline at end of file
......@@ -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
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册