dom-testing-library
Advanced tools
Comparing version 3.11.0 to 3.11.1
@@ -16,3 +16,3 @@ 'use strict'; | ||
var inNode = typeof process !== 'undefined' && process.versions !== undefined && process.versions.node !== undefined; | ||
var window = htmlElement.ownerDocument.defaultView; | ||
var window = htmlElement.ownerDocument && htmlElement.ownerDocument.defaultView || undefined; | ||
var inCypress = typeof window !== 'undefined' && window.Cypress; | ||
@@ -19,0 +19,0 @@ /* istanbul ignore else */ |
@@ -8,12 +8,8 @@ 'use strict'; | ||
var _mutationobserverShim = require('@sheerun/mutationobserver-shim'); | ||
var _helpers = require('./helpers'); | ||
var _mutationobserverShim2 = _interopRequireDefault(_mutationobserverShim); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function waitForDomChange() { | ||
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, | ||
_ref$container = _ref.container, | ||
container = _ref$container === undefined ? getDocument() : _ref$container, | ||
container = _ref$container === undefined ? (0, _helpers.getDocument)() : _ref$container, | ||
_ref$timeout = _ref.timeout, | ||
@@ -33,5 +29,3 @@ timeout = _ref$timeout === undefined ? 4500 : _ref$timeout, | ||
}, timeout); | ||
/* istanbul ignore next */ | ||
var MutationObserverConstructor = typeof window !== 'undefined' && typeof window.MutationObserver !== 'undefined' ? window.MutationObserver : _mutationobserverShim2.default; | ||
var observer = new MutationObserverConstructor(function (mutationsList) { | ||
var observer = (0, _helpers.newMutationObserver)(function (mutationsList) { | ||
onDone(null, mutationsList); | ||
@@ -55,10 +49,2 @@ }); | ||
function getDocument() { | ||
/* istanbul ignore if */ | ||
if (typeof window === 'undefined') { | ||
throw new Error('Could not find default container'); | ||
} | ||
return window.document; | ||
} | ||
exports.waitForDomChange = waitForDomChange; |
@@ -8,12 +8,8 @@ 'use strict'; | ||
var _mutationobserverShim = require('@sheerun/mutationobserver-shim'); | ||
var _helpers = require('./helpers'); | ||
var _mutationobserverShim2 = _interopRequireDefault(_mutationobserverShim); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function waitForElement(callback) { | ||
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, | ||
_ref$container = _ref.container, | ||
container = _ref$container === undefined ? getDocument() : _ref$container, | ||
container = _ref$container === undefined ? (0, _helpers.getDocument)() : _ref$container, | ||
_ref$timeout = _ref.timeout, | ||
@@ -35,5 +31,3 @@ timeout = _ref$timeout === undefined ? 4500 : _ref$timeout, | ||
var timer = setTimeout(onTimeout, timeout); | ||
/* istanbul ignore next */ | ||
var MutationObserverConstructor = typeof window !== 'undefined' && typeof window.MutationObserver !== 'undefined' ? window.MutationObserver : _mutationobserverShim2.default; | ||
var observer = new MutationObserverConstructor(onMutation); | ||
var observer = (0, _helpers.newMutationObserver)(onMutation); | ||
observer.observe(container, mutationObserverOptions); | ||
@@ -71,10 +65,2 @@ function onDone(error, result) { | ||
function getDocument() { | ||
/* istanbul ignore if */ | ||
if (typeof window === 'undefined') { | ||
throw new Error('Could not find default container'); | ||
} | ||
return window.document; | ||
} | ||
exports.waitForElement = waitForElement; |
{ | ||
"name": "dom-testing-library", | ||
"version": "3.11.0", | ||
"version": "3.11.1", | ||
"description": "Simple and complete DOM testing utilities that encourage good testing practices.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -19,3 +19,3 @@ <div align="center"> | ||
[](#contributors) | ||
[](#contributors) | ||
[![PRs Welcome][prs-badge]][prs] | ||
@@ -28,2 +28,8 @@ [![Code of Conduct][coc-badge]][coc] | ||
<div align="center"> | ||
<a href="https://testingjavascript.com"> | ||
<img width="500" alt="TestingJavaScript.com Learn the smart, efficient way to test any JavaScript application." src="https://raw.githubusercontent.com/kentcdodds/dom-testing-library/master/other/testingjavascript.jpg" /> | ||
</a> | ||
</div> | ||
## The problem | ||
@@ -1061,2 +1067,3 @@ | ||
| [<img src="https://avatars3.githubusercontent.com/u/881986?v=4" width="100px;"/><br /><sub><b>dadamssg</b></sub>](https://github.com/dadamssg)<br />[💻](https://github.com/kentcdodds/dom-testing-library/commits?author=dadamssg "Code") | [<img src="https://avatars1.githubusercontent.com/u/186971?v=4" width="100px;"/><br /><sub><b>Neil Kistner</b></sub>](https://neilkistner.com/)<br />[💻](https://github.com/kentcdodds/dom-testing-library/commits?author=wyze "Code") | [<img src="https://avatars3.githubusercontent.com/u/1448597?v=4" width="100px;"/><br /><sub><b>Ben Chauvette</b></sub>](http://bdchauvette.net/)<br />[💻](https://github.com/kentcdodds/dom-testing-library/commits?author=bdchauvette "Code") | [<img src="https://avatars2.githubusercontent.com/u/777527?v=4" width="100px;"/><br /><sub><b>Jeff Baumgardt</b></sub>](https://github.com/JeffBaumgardt)<br />[💻](https://github.com/kentcdodds/dom-testing-library/commits?author=JeffBaumgardt "Code") [📖](https://github.com/kentcdodds/dom-testing-library/commits?author=JeffBaumgardt "Documentation") | [<img src="https://avatars0.githubusercontent.com/u/4658208?v=4" width="100px;"/><br /><sub><b>Matan Kushner</b></sub>](http://matchai.me)<br />[💻](https://github.com/kentcdodds/dom-testing-library/commits?author=matchai "Code") [📖](https://github.com/kentcdodds/dom-testing-library/commits?author=matchai "Documentation") [🤔](#ideas-matchai "Ideas, Planning, & Feedback") [⚠️](https://github.com/kentcdodds/dom-testing-library/commits?author=matchai "Tests") | [<img src="https://avatars2.githubusercontent.com/u/5779538?v=4" width="100px;"/><br /><sub><b>Alex Wendte</b></sub>](http://www.wendtedesigns.com/)<br />[💻](https://github.com/kentcdodds/dom-testing-library/commits?author=themostcolm "Code") [📖](https://github.com/kentcdodds/dom-testing-library/commits?author=themostcolm "Documentation") [⚠️](https://github.com/kentcdodds/dom-testing-library/commits?author=themostcolm "Tests") | [<img src="https://avatars0.githubusercontent.com/u/2196208?v=4" width="100px;"/><br /><sub><b>Tamas Fodor</b></sub>](https://github.com/ruffle1986)<br />[📖](https://github.com/kentcdodds/dom-testing-library/commits?author=ruffle1986 "Documentation") | | ||
| [<img src="https://avatars3.githubusercontent.com/u/14793495?v=4" width="100px;"/><br /><sub><b>Benjamin Eckardt</b></sub>](https://github.com/BenjaminEckardt)<br />[💻](https://github.com/kentcdodds/dom-testing-library/commits?author=BenjaminEckardt "Code") | | ||
@@ -1063,0 +1070,0 @@ <!-- ALL-CONTRIBUTORS-LIST:END --> |
@@ -8,2 +8,3 @@ import {Matcher, MatcherOptions} from './matches' | ||
export type QueryByAttribute = ( | ||
attribute: string, | ||
container: HTMLElement, | ||
@@ -15,2 +16,3 @@ id: Matcher, | ||
export type AllByAttribute = ( | ||
attribute: string, | ||
container: HTMLElement, | ||
@@ -17,0 +19,0 @@ id: Matcher, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
31
1105
507212
5679