Skip to content
This repository was archived by the owner on Feb 6, 2023. It is now read-only.

Commit bb81765

Browse files
Claudio Procidafacebook-github-bot
Claudio Procida
authored andcommitted
Unit tests for isHTMLBRElement
Summary: Adds a unit test for isHTMLBRElement, for the cases null, same document, iframed document Reviewed By: mrkev Differential Revision: D18831442 fbshipit-source-id: af4702f25f7a28cc786078e770023e1c44fdb674
1 parent e869fcb commit bb81765

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* Copyright (c) Facebook, Inc. and its affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @emails oncall+draft-js
8+
* @flow strict-local
9+
* @format
10+
*/
11+
12+
'use strict';
13+
14+
const isHTMLBRElement = require('isHTMLBRElement');
15+
16+
test('isHTMLBRElement recognizes null', () => {
17+
expect(isHTMLBRElement(null)).toBe(false);
18+
});
19+
20+
test('isHTMLBRElement recognizes BR elements in same document', () => {
21+
const br = document.createElement('br');
22+
expect(isHTMLBRElement(br)).toBe(true);
23+
});
24+
25+
test('isHTMLBRElement recognizes BR elements in iframed document', () => {
26+
const iframe = document.createElement('iframe');
27+
if (document.body != null) {
28+
document.body.appendChild(iframe);
29+
const doc = iframe.contentDocument;
30+
const br = doc.createElement('br');
31+
expect(isHTMLBRElement(br)).toBe(true);
32+
}
33+
});

0 commit comments

Comments
 (0)