문제

In the jquery-jasmine documentation (I've listed the exact revision of the docs in case they change).

It describes:

toContainHtml(string)

expect($('<div><ul></ul><h1>header</h1></div>')).toContainHtml('<ul></ul>')

toHaveHtml(string)

expect($('<div><span></span></div>')).toHaveHtml('<span></span>')

When should I use toContainHtml() and when should I use toHaveHtml()? From the examples I can't tell the difference.

도움이 되었습니까?

해결책

Judging by this ticket on jasmine-jquery's github page

toHaveHtml() is more exacting using a == check

Whereas toContainHtml() uses an indexOf() check.

However the example in the documentation doesn't really demonstrate this, so I'm still not certain.

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