react-lazy-load-image-component
Version:
React Component to lazy load images using a HOC to track window scroll position.
25 lines (20 loc) • 681 B
JavaScript
import isIntersectionObserverAvailable from './intersection-observer';
describe('isIntersectionObserverAvailable', function() {
it('returns true if IntersectionObserver is available', function() {
window.IntersectionObserver = {};
window.IntersectionObserverEntry = {
prototype: {
isIntersecting: () => null,
},
};
expect(isIntersectionObserverAvailable()).toBe(true);
});
it('returns false if IntersectionObserver is not available', function() {
delete window.IntersectionObserver;
window.IntersectionObserverEntry = {
prototype: {},
};
delete window.IntersectionObserverEntry;
expect(isIntersectionObserverAvailable()).toBe(false);
});
});