在jquery-jasmine 文档中(我已经列出了文档的确切版本,以防它们发生变化)。
它描述:
toContainHtml(字符串)
expect($('<div><ul></ul><h1>header</h1></div>')).toContainHtml('<ul></ul>')
toHtml(字符串)
expect($('<div><span></span></div>')).toHaveHtml('<span></span>')
什么时候应该使用 toContainHtml(),什么时候应该使用 toHaveHtml()?从示例中我无法区分。