mercredi 12 septembre 2018

How to create a spy variable in a function in javascript using jasmine

I've created a function for this input field. I'm really stuck with on how to write test cases for this function using jasmine. The parameter in the function changes depending on the input field it is on. (Code Below for Reference)

<input type="text" class="ipClass" onfocusout="return 
        outputFunction('uniqueIdOne') id="uniqueIdOne">

<input type="text" class="ipClass" onfocusout="return 
        outputFunction('uniqueIdTwo') id="uniqueIdTwo">


function outputFunction(id){
var inputValue = document.getElementby(id).value;
if(value == "10")
  return inputValue;
else
  return inputValue;
}

Aucun commentaire:

Enregistrer un commentaire