Skip to content

Commit

Permalink
fix #1949 Double Click & Save on TestCase
Browse files Browse the repository at this point in the history
  • Loading branch information
MorganLmd committed Sep 25, 2019
1 parent ae177dd commit e7254f6
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions source/src/main/webapp/js/pages/TestCaseScript.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@

var canUpdate = false;
var allDelete = false;
var loadedPropertiesNumber = -1;
var Tags = [];
$.when($.getScript("js/global/global.js"), $.getScript("js/global/autocomplete.js")).then(function() {
$(document).ready(function() {
loadedPropertiesNumber = -1;
initModalDataLib();
$("#nav-property").on('mouseenter', 'a', function(ev) {
try {
Expand Down Expand Up @@ -551,6 +553,11 @@ function setAllSort() {


function saveScript(property) {

if (!isPropertyListDisplayed()) {
return;
}

// Disable the save button to avoid double click.
$("#saveScript").attr("disabled", true);

Expand Down Expand Up @@ -652,6 +659,15 @@ function saveScript(property) {

}

function isPropertyListDisplayed() {

var displayedPropertiesNumber = document.getElementById('propList').getElementsByTagName('li').length;
if (loadedPropertiesNumber === -1 || displayedPropertiesNumber < loadedPropertiesNumber) {
return false;
}
return true;
}

function deleteFnct(property) {
var linkToProperty = null;

Expand Down Expand Up @@ -1120,10 +1136,9 @@ function loadPropertiesAndDraw(test, testcase, testcaseinfo, propertyToFocus, ca
propertyList.push(property.property);
}
}

loadedPropertiesNumber = propertyList.length;
localStorage.setItem("properties", JSON.stringify(propertyList));
localStorage.setItem("secondaryProperties", JSON.stringify(propertyList));

sortProperties("#propTable");
sortSecondaryProperties("#propTable");

Expand Down

0 comments on commit e7254f6

Please sign in to comment.