diff --git a/README.md b/README.md index 94b8a5af..e69ece0f 100644 --- a/README.md +++ b/README.md @@ -491,7 +491,7 @@ toContainHTML(htmlText: string) ``` Assert whether a string representing a HTML element is contained in another -element: +element. The string should contain valid html, and not any incomplete html. #### Examples @@ -500,7 +500,15 @@ element: ``` ```javascript +// These are valid uses expect(getByTestId('parent')).toContainHTML('') +expect(getByTestId('parent')).toContainHTML('') +expect(getByTestId('parent')).not.toContainHTML('
') + +// These won't work +expect(getByTestId('parent')).toContainHTML('data-testid="child"') +expect(getByTestId('parent')).toContainHTML('data-testid') +expect(getByTestId('parent')).toContainHTML('
') ``` > Chances are you probably do not need to use this matcher. We encourage testing