Previously, elementToString() function would trying to clone any object passed to it for displaying in the test result. However, this would fail if the user is trying to test anything against a non-DOM object, such as a function. This commit make sure that the element is clonable before attempting to clone it.
…y to check element existence. This is a speed improvement, since a jQuery method does not need to be called. Also updated the README to provide more examples/documentation.
* trim-text-when-matching-with-toHaveText: Trim text before comparing with toHaveText
When an element contains whitespace as part of the text (such as when creating the HTML string with a templating library like _.template() in Underscore.js), jQuery will return the preceding line breaks when calling #text() on such an element. When we use toHaveText, we get false even though the text does match.
…ere with mock