@wordpress/dom-ready
Advanced tools
Comparing version 0.1.0-beta.1 to 0.1.0-beta.2
{ | ||
"name": "@wordpress/dom-ready", | ||
"version": "0.1.0-beta.1", | ||
"version": "0.1.0-beta.2", | ||
"description": "Execute callback after the DOM is loaded.", | ||
"homepage": "https://github.com/WordPress/packages/tree/master/packages/domReady/README.md", | ||
"homepage": "https://github.com/WordPress/packages/tree/master/packages/dom-ready/README.md", | ||
"author": "WordPress", | ||
@@ -7,0 +7,0 @@ "keywords": [ |
@@ -1,2 +0,2 @@ | ||
# @wordpress/domReady | ||
# @wordpress/dom-ready | ||
@@ -10,3 +10,3 @@ Executes a function after the DOM has loaded. | ||
```bash | ||
npm install @wordpress/domReady --save | ||
npm install @wordpress/dom-ready --save | ||
``` | ||
@@ -17,3 +17,3 @@ | ||
```JS | ||
import domReady from '@wordpress/domReady'; | ||
import domReady from '@wordpress/dom-ready'; | ||
@@ -20,0 +20,0 @@ domReady( function() { |
@@ -6,26 +6,26 @@ import domReady from '../'; | ||
it( 'should call the callback.', () => { | ||
let callback = jest.fn(() => {}); | ||
let callback = jest.fn( () => {} ); | ||
domReady( callback ); | ||
expect( callback ).toHaveBeenCalled(); | ||
}); | ||
}); | ||
} ); | ||
} ); | ||
describe( 'when document readystate is still loading', () => { | ||
it( 'should add the callback as an event listener to the DOMContentLoaded event.', () => { | ||
let addEventListener = jest.fn(() => {}); | ||
let addEventListener = jest.fn( () => {} ); | ||
Object.defineProperty( document, 'readyState', { | ||
value: 'loading', | ||
}); | ||
} ); | ||
Object.defineProperty( document, 'addEventListener', { | ||
value: addEventListener, | ||
}); | ||
} ); | ||
let callback = jest.fn(() => {}); | ||
let callback = jest.fn( () => {} ); | ||
domReady( callback ); | ||
expect( callback ).not.toHaveBeenCalled(); | ||
expect( addEventListener ).toHaveBeenCalledWith( 'DOMContentLoaded', callback ); | ||
}); | ||
}); | ||
}); | ||
} ); | ||
} ); | ||
} ); |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
3054
1
1