문제

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.

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top