Domanda

I have loaded my fixtures with:

var fixture = loadFixtures("path/fixture.html");

And I am trying to find one DIV#ID whether it is exists using this below code:

expect(fixture.find('DIV#ID')).toBe();

But, I am getting the error: TypeError: Cannot read property 'find' of undefined

Please help me to find my div#id from my loaded fixtures using JASMINE JS Framework.

È stato utile?

Soluzione

After loading/reading fixtures, you have to set the fixtures then.

var fixtures =  readFixtures("header.html");
setFixtures(fixtures);

From the set fixtures you can find the DOM element like:

expect($('body')).toHaveId("DIV#ID");

This works for me.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top