mercredi 4 février 2015

jasmine test wasn't run when injected string contains \

I'm currently trying to write a jasmine unit test to test that my password field does not contain special characters.


Alas, the following unit test works:



it("should display error for string:'1special char ~'", function() {
mockControls.password.val("1special char ~");
mockControls.confirmpassword.val("1special char ~");
mockControls.submitpassword.click();
expect(...)
});


But this one doesnt:



it("should display error for string:'1special char \\'", function() {
mockControls.password.val("1special char \\");
mockControls.confirmpassword.val("1special char \\");
mockControls.submitpassword.click();
expect(...)
});


When the latter unit test is run, jasmine (using resharper unit test runner in VS2013) responds with "Inconclusive: Test wasn't run"


Any clue on why this is?


note that mockControls is created like thus:



var mockControls = {
password: $('<input type="password" id="password"/>'),
confirmpassword: $('<input type="password" id="confirmpassword"/>'),
submitpassword: $('<input id="submitpassword"/>')
}

Aucun commentaire:

Enregistrer un commentaire