File tree Expand file tree Collapse file tree 1 file changed +23
-3
lines changed
packages/autocomplete-js/src/utils/__tests__ Expand file tree Collapse file tree 1 file changed +23
-3
lines changed Original file line number Diff line number Diff line change 1+ import { getHTMLElement } from '../getHTMLElement' ;
2+
13describe ( 'getHTMLElement' , ( ) => {
2- test . todo ( 'with element returns the element' ) ;
4+ afterEach ( ( ) => {
5+ document . body . innerHTML = '' ;
6+ } ) ;
7+
8+ test ( 'with element returns the element' , ( ) => {
9+ const element = document . createElement ( 'div' ) ;
10+ document . body . appendChild ( element ) ;
11+
12+ expect ( getHTMLElement ( element ) ) . toEqual ( element ) ;
13+ } ) ;
14+
15+ test ( 'with a string returns the element if exists' , ( ) => {
16+ const element = document . createElement ( 'div' ) ;
17+ document . body . appendChild ( element ) ;
318
4- test . todo ( 'with a string returns the element if exists' ) ;
19+ expect ( getHTMLElement ( 'div' ) ) . toEqual ( element ) ;
20+ } ) ;
521
6- test . todo ( 'with a string throws invariant if does not exist' ) ;
22+ test ( 'with a string throws invariant if does not exist' , ( ) => {
23+ expect ( ( ) => {
24+ getHTMLElement ( 'div' ) ;
25+ } ) . toThrow ( 'The element "div" is not in the document.' ) ;
26+ } ) ;
727} ) ;
You can’t perform that action at this time.
0 commit comments