All pastes #829427 Raw Edit

Something

public text v1 · immutable
#829427 ·published 2007-12-23 04:03 UTC
rendered paste body
  if ((windmill.runTests == true) || (windmill.xhr.xhrResponse.result.method.split(".")[0] == 'commands')){
    try {
      //Wait/open needs to not grab the next action immediately
      if ((windmill.xhr.xhrResponse.result.method.split(".")[0] == 'waits')){
        windmill.controller.stopLoop();
      }   
      if (windmill.xhr.xhrResponse.result.method.indexOf('.') != -1){
        //if asserts.assertNotSomething we need to set the result to !result
        if(windmill.xhr.xhrResponse.result.method.indexOf('asserts.assertNot') != -1){
          var mArray = windmill.xhr.xhrResponse.result.method.split(".");
          var m = mArray[1].replace('Not','');             
          var result = !windmill.controller[mArray[0]][m](windmill.xhr.xhrResponse.result.params);
        }
        //Normal asserts and waits
        else{
          var mArray = windmill.xhr.xhrResponse.result.method.split(".");                       
          var result = windmill.controller[mArray[0]][mArray[1]](windmill.xhr.xhrResponse.result.params);
        }
      }   
      //Every other action that isn't namespaced
      else{ 
        var result = windmill.controller[windmill.xhr.xhrResponse.result.method](windmill.xhr.xhrResponse.result.params);
      }   
    }   
    catch (error) { 
      windmill.ui.results.writeResult("<font color=\"#FF0000\">There was an error in the "+
              windmill.xhr.xhrResponse.result.method+" action. "+error+"</font>");
      windmill.ui.results.writeResult("<br>Action: <b>" + windmill.xhr.xhrResponse.result.method + 
              "</b><br>Parameters: " + fleegix.json.serialize(windmill.xhr.xhrResponse.result.params) +
              "<br>Test Result: <font color=\"#FF0000\"><b>" + result + '</b></font>');     

      result = false;
      //If the option to throw errors is set
      if ($('throwDebug').checked == true){
        if (console.log){
          console.log(error);
        }
        else { throw(error); }
      }   
      else {
        if (!$('toggleBreak').checked) {
          windmill.controller.continueLoop();
        }
      }   
    }   
  }