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

Commit

Permalink
Unit tests for isHTMLBRElement
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Claudio Procida authored and facebook-github-bot committed Dec 6, 2019
1 parent e869fcb commit bb81765
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/component/utils/__tests__/isHTMLBRElement-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @emails oncall+draft-js
* @flow strict-local
* @format
*/

'use strict';

const isHTMLBRElement = require('isHTMLBRElement');

test('isHTMLBRElement recognizes null', () => {
expect(isHTMLBRElement(null)).toBe(false);
});

test('isHTMLBRElement recognizes BR elements in same document', () => {
const br = document.createElement('br');
expect(isHTMLBRElement(br)).toBe(true);
});

test('isHTMLBRElement recognizes BR elements in iframed document', () => {
const iframe = document.createElement('iframe');
if (document.body != null) {
document.body.appendChild(iframe);
const doc = iframe.contentDocument;
const br = doc.createElement('br');
expect(isHTMLBRElement(br)).toBe(true);
}
});

0 comments on commit bb81765

Please sign in to comment.