@@ -5,17 +5,35 @@ test('.toBeEmptyDOMElement', () => {
55 <span data-testid="not-empty">
66 <span data-testid="empty"></span>
77 <svg data-testid="svg-empty"></svg>
8- </span>` )
8+ </span>
9+ <span data-testid="with-comment"><!-- This Comment --></span>
10+ <span data-testid="with-multiple-comments"><!-- Comment1 --><!-- Comment2 --></span>
11+ <span data-testid="with-element"><span></span></span>
12+ <span data-testid="with-element-and-comment"><!--Comment--><span></span></span>
13+ <span data-testid="with-whitespace"> </span>
14+ <span data-testid="with-text">Text</span>` )
915
1016 const empty = queryByTestId ( 'empty' )
1117 const notEmpty = queryByTestId ( 'not-empty' )
1218 const svgEmpty = queryByTestId ( 'svg-empty' )
19+ const withComment = queryByTestId ( 'with-comment' )
20+ const withMultipleComments = queryByTestId ( 'with-multiple-comments' )
21+ const withElement = queryByTestId ( 'with-element' )
22+ const withElementAndComment = queryByTestId ( 'with-element-and-comment' )
23+ const withWhitespace = queryByTestId ( 'with-whitespace' )
24+ const withText = queryByTestId ( 'with-whitespace' )
1325 const nonExistantElement = queryByTestId ( 'not-exists' )
1426 const fakeElement = { thisIsNot : 'an html element' }
1527
1628 expect ( empty ) . toBeEmptyDOMElement ( )
1729 expect ( svgEmpty ) . toBeEmptyDOMElement ( )
1830 expect ( notEmpty ) . not . toBeEmptyDOMElement ( )
31+ expect ( withComment ) . toBeEmptyDOMElement ( )
32+ expect ( withMultipleComments ) . toBeEmptyDOMElement ( )
33+ expect ( withElement ) . not . toBeEmptyDOMElement ( )
34+ expect ( withElementAndComment ) . not . toBeEmptyDOMElement ( )
35+ expect ( withWhitespace ) . not . toBeEmptyDOMElement ( )
36+ expect ( withText ) . not . toBeEmptyDOMElement ( )
1937
2038 // negative test cases wrapped in throwError assertions for coverage.
2139 expect ( ( ) => expect ( empty ) . not . toBeEmptyDOMElement ( ) ) . toThrowError ( )
@@ -24,6 +42,18 @@ test('.toBeEmptyDOMElement', () => {
2442
2543 expect ( ( ) => expect ( notEmpty ) . toBeEmptyDOMElement ( ) ) . toThrowError ( )
2644
45+ expect ( ( ) => expect ( withComment ) . not . toBeEmptyDOMElement ( ) ) . toThrowError ( )
46+
47+ expect ( ( ) => expect ( withMultipleComments ) . not . toBeEmptyDOMElement ( ) ) . toThrowError ( )
48+
49+ expect ( ( ) => expect ( withElement ) . toBeEmptyDOMElement ( ) ) . toThrowError ( )
50+
51+ expect ( ( ) => expect ( withElementAndComment ) . toBeEmptyDOMElement ( ) ) . toThrowError ( )
52+
53+ expect ( ( ) => expect ( withWhitespace ) . toBeEmptyDOMElement ( ) ) . toThrowError ( )
54+
55+ expect ( ( ) => expect ( withText ) . toBeEmptyDOMElement ( ) ) . toThrowError ( )
56+
2757 expect ( ( ) => expect ( fakeElement ) . toBeEmptyDOMElement ( ) ) . toThrowError ( )
2858
2959 expect ( ( ) => {
0 commit comments