From eb2c75e80f522d7ee34ab19a6df556e26238f7b8 Mon Sep 17 00:00:00 2001 From: Benoit DUMONT Date: Sat, 30 Mar 2024 21:48:50 +0100 Subject: [PATCH] Improved navigation between execution and script page (small fix). --- source/src/main/webapp/js/pages/TestCaseExecution.js | 4 ++-- source/src/main/webapp/js/pages/TestCaseScript.js | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/source/src/main/webapp/js/pages/TestCaseExecution.js b/source/src/main/webapp/js/pages/TestCaseExecution.js index 4a0f4ccbf..525d44080 100644 --- a/source/src/main/webapp/js/pages/TestCaseExecution.js +++ b/source/src/main/webapp/js/pages/TestCaseExecution.js @@ -2260,9 +2260,9 @@ Step.prototype.show = function (a) { url.hash = '#stepId=' + object.step + "-" + object.index; stepFocus = object.step + "-" + object.index; window.history.pushState({}, '', url); - $("#editTcStepInfo").parent().attr("href", "./TestCaseScript.jsp?test=" + encodeURI(object.test) + "&testcase=" + encodeURI(object.testcase) + '#stepId=' + object.step); + $("#editTcStepInfo").parent().attr("href", "./TestCaseScript.jsp?test=" + encodeURI(object.test) + "&testcase=" + encodeURI(object.testcase) + '&stepId=' + object.step); } else if (stepFocus != 99999) { - $("#editTcStepInfo").parent().attr("href", "./TestCaseScript.jsp?test=" + encodeURI(object.test) + "&testcase=" + encodeURI(object.testcase) + '#stepId=' + object.step); + $("#editTcStepInfo").parent().attr("href", "./TestCaseScript.jsp?test=" + encodeURI(object.test) + "&testcase=" + encodeURI(object.testcase) + '&stepId=' + object.step); } for (var i = 0; i < object.steps.length; i++) { diff --git a/source/src/main/webapp/js/pages/TestCaseScript.js b/source/src/main/webapp/js/pages/TestCaseScript.js index fd3c90850..7d1324b6a 100644 --- a/source/src/main/webapp/js/pages/TestCaseScript.js +++ b/source/src/main/webapp/js/pages/TestCaseScript.js @@ -86,7 +86,7 @@ $.when($.getScript("js/global/global.js") var oneclickcreation = GetURLParameter("oneclickcreation"); var tabactive = GetURLParameter("tabactive"); - var step = GetURLAnchorValue("stepId"); + var step = GetURLParameter("stepId"); displayHeaderLabel(doc); displayGlobalLabel(doc); @@ -681,8 +681,11 @@ function saveScript(property) { if (tutorielId !== null && startStep !== null) { tutorialParameters = "&tutorielId=" + tutorielId + "&startStep=" + startStep; } - - var new_uri = parser.pathname + "?test=" + encodeURI(GetURLParameter("test")) + "&testcase=" + encodeURI(GetURLParameter("testcase")) + tutorialParameters + "&tabactive=" + tabActive + window.location.hash; + var url_step = ""; + if (!(isEmpty(stepData))) { + url_step = "&stepId=" + encodeURI(stepData.stepId); + } + var new_uri = parser.pathname + "?test=" + encodeURI(GetURLParameter("test")) + "&testcase=" + encodeURI(GetURLParameter("testcase")) + tutorialParameters + url_step + "&tabactive=" + tabActive; // If the 1st 2 characters are // we remove 1 of them. if ((new_uri[0] === '/') && (new_uri[1] === '/')) { new_uri = new_uri[0] + new_uri.slice(2);