@d3fc/d3fc-element
Advanced tools
Comparing version 6.0.0 to 6.0.1
@@ -6,2 +6,10 @@ # Change Log | ||
## 6.0.1 (2020-07-14) | ||
**Note:** Version bump only for package @d3fc/d3fc-element | ||
# 6.0.0 (2020-04-16) | ||
@@ -8,0 +16,0 @@ |
{ | ||
"name": "@d3fc/d3fc-element", | ||
"version": "6.0.0", | ||
"version": "6.0.1", | ||
"description": "Custom HTML elements that make it easier to create responsive visualisations that integrate easily with other UI frameworks (e.g. React, Angular)", | ||
@@ -20,3 +20,2 @@ "license": "MIT", | ||
"bundle": "npx rollup -c ../../scripts/rollup.config.js", | ||
"test": "npx jasmine --config=../../scripts/jasmine.json", | ||
"start": "npm start --prefix ../d3fc -- --configPkg=d3fc-element" | ||
@@ -27,3 +26,3 @@ }, | ||
}, | ||
"gitHead": "42460bbd9e769aa24b07ae8e6dc7037c63d3bea8" | ||
"gitHead": "3c6890b82dbb430bafd52420c0dd506861f16f5d" | ||
} |
@@ -1,2 +0,1 @@ | ||
import jsdom from 'jsdom'; | ||
import requestRedraw from '../src/requestRedraw'; | ||
@@ -6,6 +5,3 @@ | ||
let document; | ||
beforeEach(() => { | ||
document = jsdom.jsdom(); | ||
global.requestAnimationFrame = () => {}; | ||
@@ -16,2 +12,6 @@ }); | ||
delete global.requestAnimationFrame; | ||
// Jest triggers test environment setup/teardown per test suite, | ||
// not per test, so we reset '__d3fc-elements__' after each test here. | ||
delete document['__d3fc-elements__']; | ||
}); | ||
@@ -18,0 +18,0 @@ |
@@ -23,6 +23,4 @@ describe('group', () => { | ||
beforeEach(() => { | ||
addEventListener = jasmine.createSpy('addEventListener'); | ||
global.addEventListener = addEventListener; | ||
removeEventListener = jasmine.createSpy('removeEventListener'); | ||
global.removeEventListener = removeEventListener; | ||
addEventListener = jest.spyOn(global, 'addEventListener'); | ||
removeEventListener = jest.spyOn(global, 'removeEventListener'); | ||
group = new Group(); | ||
@@ -32,22 +30,22 @@ }); | ||
afterEach(() => { | ||
delete global.addEventListener; | ||
delete global.removeEventListener; | ||
addEventListener.mockRestore(); | ||
removeEventListener.mockRestore(); | ||
}); | ||
it('should not add a listener if no auto-resize attribute present when connected', () => { | ||
spyOn(group, 'hasAttribute').and.returnValue(false); | ||
jest.spyOn(group, 'hasAttribute').mockImplementation(() => false); | ||
group.connectedCallback(); | ||
expect(addEventListener.calls.any()).toEqual(false); | ||
expect(addEventListener).not.toHaveBeenCalled(); | ||
}); | ||
it('should not add a listener if no auto-resize attribute is false when connected', () => { | ||
spyOn(group, 'hasAttribute').and.returnValue(true); | ||
spyOn(group, 'getAttribute').and.returnValue('false'); | ||
jest.spyOn(group, 'hasAttribute').mockImplementation(() => true); | ||
jest.spyOn(group, 'getAttribute').mockImplementation(() => 'false'); | ||
group.connectedCallback(); | ||
expect(addEventListener.calls.any()).toEqual(false); | ||
expect(addEventListener).not.toHaveBeenCalled(); | ||
}); | ||
it('should add a listener if auto-resize attribute is present when connected', () => { | ||
spyOn(group, 'hasAttribute').and.returnValue(true); | ||
spyOn(group, 'getAttribute').and.returnValue(''); | ||
jest.spyOn(group, 'hasAttribute').mockImplementation(() => true); | ||
jest.spyOn(group, 'getAttribute').mockImplementation(() => ''); | ||
group.connectedCallback(); | ||
@@ -58,4 +56,4 @@ expect(addEventListener).toHaveBeenCalledWith('resize', group.__autoResizeListener__); | ||
it('should add a listener if auto-resize attribute has a non false value when connected', () => { | ||
spyOn(group, 'hasAttribute').and.returnValue(true); | ||
spyOn(group, 'getAttribute').and.returnValue('true'); | ||
jest.spyOn(group, 'hasAttribute').mockImplementation(() => true); | ||
jest.spyOn(group, 'getAttribute').mockImplementation(() => 'true'); | ||
group.connectedCallback(); | ||
@@ -66,4 +64,4 @@ expect(addEventListener).toHaveBeenCalledWith('resize', group.__autoResizeListener__); | ||
it('should remove a listener when disconnected', () => { | ||
spyOn(group, 'hasAttribute').and.returnValue(true); | ||
spyOn(group, 'getAttribute').and.returnValue('true'); | ||
jest.spyOn(group, 'hasAttribute').mockImplementation(() => true); | ||
jest.spyOn(group, 'getAttribute').mockImplementation(() => 'true'); | ||
group.connectedCallback(); | ||
@@ -76,4 +74,4 @@ const listener = group.__autoResizeListener__; | ||
group.disconnectedCallback(); | ||
expect(removeEventListener.calls.count()).toEqual(1); | ||
expect(removeEventListener).toHaveBeenCalledTimes(1); | ||
}); | ||
}); |
61184
18
866