mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
[Feature] Dashboard filter indicators (#7908)
* dashboard filter indicators * add/fix unit tests
This commit is contained in:
@@ -28,6 +28,19 @@ describe('AnchorLink', () => {
|
||||
anchorLinkId: 'CHART-123',
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
global.window = Object.create(window);
|
||||
Object.defineProperty(window, 'location', {
|
||||
value: {
|
||||
hash: '#' + props.anchorLinkId,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
delete global.window.location.value;
|
||||
});
|
||||
|
||||
it('should scroll the AnchorLink into view upon mount', () => {
|
||||
const callback = sinon.spy();
|
||||
const clock = sinon.useFakeTimers();
|
||||
@@ -35,11 +48,7 @@ describe('AnchorLink', () => {
|
||||
scrollIntoView: callback,
|
||||
});
|
||||
|
||||
const wrapper = shallow(<AnchorLink {...props} />);
|
||||
wrapper.instance().getLocationHash = () => (props.anchorLinkId);
|
||||
wrapper.update();
|
||||
|
||||
wrapper.instance().componentDidMount();
|
||||
shallow(<AnchorLink {...props} />);
|
||||
clock.tick(2000);
|
||||
expect(callback.callCount).toEqual(1);
|
||||
stub.restore();
|
||||
|
||||
Reference in New Issue
Block a user