.catch(() => this.mounted && this.setState({ loading: false }));
};
- handleHotspotUpdate = async () => {
+ handleHotspotUpdate = async (statusUpdate = false) => {
const { hotspotKey } = this.props;
- await this.props.onUpdateHotspot(hotspotKey);
+ if (statusUpdate) {
+ await this.props.onUpdateHotspot(hotspotKey);
+ } else {
+ await this.fetchHotspot();
+ }
};
handleOpenComment = () => {
commentTextRef: React.RefObject<HTMLTextAreaElement>;
onOpenComment: () => void;
onCloseComment: () => void;
- onUpdateHotspot: () => Promise<void>;
+ onUpdateHotspot: (statusUpdate?: boolean) => Promise<void>;
securityCategories: T.StandardSecurityCategories;
}
</div>
</div>
<div className="huge-spacer-left">
- <Status hotspot={hotspot} onStatusChange={props.onUpdateHotspot} />
+ <Status hotspot={hotspot} onStatusChange={() => props.onUpdateHotspot(true)} />
</div>
</div>
expect(getSecurityHotspotDetails).toHaveBeenCalledWith(newHotspotKey);
});
-it('should refresh hotspot on update', () => {
+it('should refresh hotspot list on status update', () => {
const onUpdateHotspot = jest.fn();
const wrapper = shallowRender({ onUpdateHotspot });
- wrapper.find(HotspotViewerRenderer).simulate('updateHotspot');
+ wrapper
+ .find(HotspotViewerRenderer)
+ .props()
+ .onUpdateHotspot(true);
expect(onUpdateHotspot).toHaveBeenCalled();
});
+it('should NOT refresh hotspot list on assignee/comment updates', () => {
+ const onUpdateHotspot = jest.fn();
+ const wrapper = shallowRender({ onUpdateHotspot });
+ wrapper
+ .find(HotspotViewerRenderer)
+ .props()
+ .onUpdateHotspot();
+ expect(onUpdateHotspot).not.toHaveBeenCalled();
+});
+
it('should open comment form when scroll to comment', () => {
const wrapper = shallowRender();
const mockTextRef = ({ current: { focus: jest.fn() } } as any) as React.RefObject<
],
}
}
- onStatusChange={[MockFunction]}
+ onStatusChange={[Function]}
/>
</div>
</div>
],
}
}
- onStatusChange={[MockFunction]}
+ onStatusChange={[Function]}
/>
</div>
</div>
],
}
}
- onStatusChange={[MockFunction]}
+ onStatusChange={[Function]}
/>
</div>
</div>
],
}
}
- onStatusChange={[MockFunction]}
+ onStatusChange={[Function]}
/>
</div>
</div>
],
}
}
- onStatusChange={[MockFunction]}
+ onStatusChange={[Function]}
/>
</div>
</div>