Skip to content

Commit

Permalink
#9567: resolve comments' review
Browse files Browse the repository at this point in the history
  • Loading branch information
mahmoudadel54 committed Nov 9, 2023
1 parent 0d9a5a0 commit 84642c1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,23 @@ describe('widgets tableWidget enhancer', () => {
const container = document.getElementById('container');
expect(container).toExist();

});
it('tableWidget with gridTools including zoom icon for dashboard viewer in case of just table is added [No maps added]', (done) => {
const Sink = tableWidget(createSink( props => {
expect(props).toExist();
expect(props.gridTools.length).toEqual(0);
done();
}));
ReactDOM.render( <Provider store={store}><Sink enableZoomInTblWidget={"true"} id="123456" mapSync={false} widgetType={"table"} isDashboardOpened={"true"} updateProperty={(id, path, value) => {
expect(path).toBe("dependencies.extentObj");
expect(id).toBe("123456");
expect(value).toEqual({
bbox: [-10, 0, 0, -10]
}, {}, "", { crs: "EPSG:4326", maxZoom: null });
}}/></Provider>, document.getElementById("container"));
const container = document.getElementById('container');
expect(container).toExist();

});
it('tableWidget with gridTools including zoom icon for dashboard viewer [not enable zoom in config]', (done) => {
const Sink = tableWidget(createSink( props => {
Expand Down
4 changes: 2 additions & 2 deletions web/client/components/widgets/enhancers/tableWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ const withSorting = () => withPropsOnChange(["gridEvents"], ({ gridEvents = {},
*/
export default compose(
compose(connect(null, (dispatch, ownProps)=>{
let isTblDashboard = ownProps?.enableZoomInTblWidget && ownProps?.mapSync && ownProps?.widgetType === 'table' && ownProps?.isDashboardOpened;
let isTblWidgetInMapViewer = ownProps?.widgetType && !isTblDashboard && ownProps?.enableZoomInTblWidget;
let isTblDashboard = ownProps?.enableZoomInTblWidget && ownProps?.widgetType === 'table' && ownProps?.isDashboardOpened;
let isTblWidgetInMapViewer = ownProps?.widgetType === 'table' && !isTblDashboard && ownProps?.enableZoomInTblWidget;
let isTblSyncWithMap = ownProps?.mapSync;
return {
gridTools: (isTblSyncWithMap && isTblDashboard) || (isTblWidgetInMapViewer) ? gridTools.map((t) => ({
Expand Down

0 comments on commit 84642c1

Please sign in to comment.