@testing-library/dom
Advanced tools
Comparing version 6.5.1 to 6.6.0
@@ -179,7 +179,7 @@ 'use strict'; | ||
function prettyDOM(dom, maxLength, options) { | ||
if (dom === void 0) { | ||
if (!dom) { | ||
dom = getDocument().body; | ||
} | ||
if (maxLength === void 0) { | ||
if (typeof maxLength !== 'number') { | ||
maxLength = getMaxLength(dom); | ||
@@ -196,2 +196,15 @@ } | ||
var domTypeName = typeof dom; | ||
if (domTypeName === 'object') { | ||
domTypeName = dom.constructor.name; | ||
} else { | ||
// To don't fall with `in` operator | ||
dom = {}; | ||
} | ||
if (!('outerHTML' in dom)) { | ||
throw new TypeError("Expected an element or document but got " + domTypeName); | ||
} | ||
var debugContent = prettyFormat(dom, _extends({ | ||
@@ -198,0 +211,0 @@ plugins: [DOMElement, DOMCollection], |
@@ -173,7 +173,7 @@ import _extends from '@babel/runtime/helpers/esm/extends'; | ||
function prettyDOM(dom, maxLength, options) { | ||
if (dom === void 0) { | ||
if (!dom) { | ||
dom = getDocument().body; | ||
} | ||
if (maxLength === void 0) { | ||
if (typeof maxLength !== 'number') { | ||
maxLength = getMaxLength(dom); | ||
@@ -190,2 +190,15 @@ } | ||
var domTypeName = typeof dom; | ||
if (domTypeName === 'object') { | ||
domTypeName = dom.constructor.name; | ||
} else { | ||
// To don't fall with `in` operator | ||
dom = {}; | ||
} | ||
if (!('outerHTML' in dom)) { | ||
throw new TypeError("Expected an element or document but got " + domTypeName); | ||
} | ||
var debugContent = prettyFormat(dom, _extends({ | ||
@@ -192,0 +205,0 @@ plugins: [DOMElement, DOMCollection], |
@@ -31,3 +31,11 @@ "use strict"; | ||
function prettyDOM(dom = (0, _helpers.getDocument)().body, maxLength = getMaxLength(dom), options) { | ||
function prettyDOM(dom, maxLength, options) { | ||
if (!dom) { | ||
dom = (0, _helpers.getDocument)().body; | ||
} | ||
if (typeof maxLength !== 'number') { | ||
maxLength = getMaxLength(dom); | ||
} | ||
if (maxLength === 0) { | ||
@@ -41,2 +49,15 @@ return ''; | ||
let domTypeName = typeof dom; | ||
if (domTypeName === 'object') { | ||
domTypeName = dom.constructor.name; | ||
} else { | ||
// To don't fall with `in` operator | ||
dom = {}; | ||
} | ||
if (!('outerHTML' in dom)) { | ||
throw new TypeError(`Expected an element or document but got ${domTypeName}`); | ||
} | ||
const debugContent = (0, _prettyFormat.default)(dom, (0, _extends2.default)({ | ||
@@ -43,0 +64,0 @@ plugins: [DOMElement, DOMCollection], |
{ | ||
"name": "@testing-library/dom", | ||
"version": "6.5.1", | ||
"version": "6.6.0", | ||
"description": "Simple and complete DOM testing utilities that encourage good testing practices.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -30,3 +30,3 @@ <div align="center"> | ||
[![All Contributors](https://img.shields.io/badge/all_contributors-73-orange.svg?style=flat-square)](#contributors) | ||
[![All Contributors](https://img.shields.io/badge/all_contributors-74-orange.svg?style=flat-square)](#contributors) | ||
[![PRs Welcome][prs-badge]][prs] | ||
@@ -228,2 +228,3 @@ [![Code of Conduct][coc-badge]][coc] | ||
<td align="center"><a href="http://olzhas.de"><img src="https://avatars3.githubusercontent.com/u/15848876?v=4" width="100px;" alt="Olzhas Askar"/><br /><sub><b>Olzhas Askar</b></sub></a><br /><a href="https://github.com/testing-library/dom-testing-library/commits?author=pheeria" title="Code">💻</a> <a href="https://github.com/testing-library/dom-testing-library/commits?author=pheeria" title="Tests">⚠️</a></td> | ||
<td align="center"><a href="https://twitter.com/mbelsky_"><img src="https://avatars1.githubusercontent.com/u/3923527?v=4" width="100px;" alt="Max Belsky"/><br /><sub><b>Max Belsky</b></sub></a><br /><a href="https://github.com/testing-library/dom-testing-library/commits?author=mbelsky" title="Code">💻</a> <a href="https://github.com/testing-library/dom-testing-library/commits?author=mbelsky" title="Tests">⚠️</a></td> | ||
</tr> | ||
@@ -230,0 +231,0 @@ </table> |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1647836
15034
283