vendredi 29 mai 2015

How to test this function with jasmine-jquery?

This is the function I want to test, but I don't know how it works.

conflictModalCancel: function () {
    this.$(":disabled").prop("disabled", false);
},

What I have done so far:

describe("function conflictModalCancel", function(){

    beforeAll(function(){
        loadFixtures('addvehicle.html');
    });

    it ("should set property disabled", function(){
        view.conflictModalCancel();
        expect($("selectTypeWrapper")).toHaveProp("disabled");
        expect($("selectTypeWrapper").prop("disabled")).toBe(false);
    });
});

And the fixture file I am loading looks like this:

<div id="selectTypeWrapper" type="disabled" disabled="true">
    <div id=".panel">
        <div id=".panel-collapse"></div>
    </div>
</div>
<div id=":disabled"></div>
<select id="selectLanguage"></select>

I am new to all this stuff and I probably misunderstood something. Can you please help me to write this test for me to understand how to handle such problems?

Aucun commentaire:

Enregistrer un commentaire