File size: 596 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import isHTMLElement from '../../utils/isHTMLElement';

describe('isHTMLElement', () => {
  it('should return true when value is HTMLElement', () => {
    expect(isHTMLElement(document.createElement('input'))).toBeTruthy();
  });

  it('should return true when HTMLElement is inside an iframe', () => {
    const iframe = document.createElement('iframe');
    document.body.append(iframe);

    const iframeDocument = iframe.contentDocument!;
    const input = iframeDocument.createElement('input');
    iframeDocument.body.append(input);
    expect(isHTMLElement(input)).toBeTruthy();
  });
});