|
|
|
@ -66,23 +66,15 @@ describe('DashboardControls', () => { |
|
|
|
|
expect(scene._urlSync.getKeys()).toEqual(['_dash.hideTimePicker', '_dash.hideVariables', '_dash.hideLinks']); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
it('should return url state', () => { |
|
|
|
|
it('should not return url state for hide flags', () => { |
|
|
|
|
const scene = buildTestScene(); |
|
|
|
|
expect(scene.getUrlState()).toEqual({ |
|
|
|
|
'_dash.hideTimePicker': undefined, |
|
|
|
|
'_dash.hideVariables': undefined, |
|
|
|
|
'_dash.hideLinks': undefined, |
|
|
|
|
}); |
|
|
|
|
expect(scene.getUrlState()).toEqual({}); |
|
|
|
|
scene.setState({ |
|
|
|
|
hideTimeControls: true, |
|
|
|
|
hideVariableControls: true, |
|
|
|
|
hideLinksControls: true, |
|
|
|
|
}); |
|
|
|
|
expect(scene.getUrlState()).toEqual({ |
|
|
|
|
'_dash.hideTimePicker': 'true', |
|
|
|
|
'_dash.hideVariables': 'true', |
|
|
|
|
'_dash.hideLinks': 'true', |
|
|
|
|
}); |
|
|
|
|
expect(scene.getUrlState()).toEqual({}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
it('should update from url', () => { |
|
|
|
@ -114,19 +106,16 @@ describe('DashboardControls', () => { |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
it('should not call setState if no changes', () => { |
|
|
|
|
const scene = buildTestScene(); |
|
|
|
|
const scene = buildTestScene({ hideTimeControls: true, hideVariableControls: true, hideLinksControls: true }); |
|
|
|
|
const setState = jest.spyOn(scene, 'setState'); |
|
|
|
|
|
|
|
|
|
scene.updateFromUrl({ |
|
|
|
|
'_dash.hideTimePicker': 'true', |
|
|
|
|
'_dash.hideVariables': 'true', |
|
|
|
|
'_dash.hideLinks': 'true', |
|
|
|
|
}); |
|
|
|
|
scene.updateFromUrl({ |
|
|
|
|
'_dash.hideTimePicker': 'true', |
|
|
|
|
'_dash.hideVariables': 'true', |
|
|
|
|
'_dash.hideLinks': 'true', |
|
|
|
|
}); |
|
|
|
|
expect(setState).toHaveBeenCalledTimes(1); |
|
|
|
|
|
|
|
|
|
expect(setState).toHaveBeenCalledTimes(0); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|