Skip to content

Commit

Permalink
#9783: resolve test review: (#9818)
Browse files Browse the repository at this point in the history
Description:
- In dashboard, fix issue of not hiding zoom icon in tbl widget in case of removing connection from map to tbl
- write unit test for the changes
  • Loading branch information
mahmoudadel54 authored Dec 14, 2023
1 parent e45def9 commit c6abc8b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,12 @@ describe('widgets tableWidget enhancer', () => {
{
widgetType: "table", id: "123456", mapSync: true
}, {
widgetType: 'map', id: "connectedMapID1", dependenciesMap: {
widgetType: 'map', id: "connectedMapID1", mapSync: true, dependenciesMap: {
mapSync: "123456"
}
},
{
widgetType: 'map', id: "connectedMapID2", dependenciesMap: {
widgetType: 'map', id: "connectedMapID2", mapSync: true, dependenciesMap: {
mapSync: "123456"
}
}, {
Expand All @@ -117,7 +117,7 @@ describe('widgets tableWidget enhancer', () => {
}, {}, "", { crs: "", maxZoom: null }
);
expect(props.widgets.length).toEqual(4);
let mapWidgetsConnectedWithTbl = props.widgets.filter(i=>i.widgetType === 'map' && i?.dependenciesMap && i?.dependenciesMap?.mapSync?.includes(props.id)) || [];
let mapWidgetsConnectedWithTbl = props.widgets.filter(i=>i.widgetType === 'map' && i?.dependenciesMap && i?.dependenciesMap?.mapSync?.includes(props.id) && i.mapSync) || [];
expect(mapWidgetsConnectedWithTbl.length).toEqual(2);
done();
}));
Expand All @@ -144,7 +144,7 @@ describe('widgets tableWidget enhancer', () => {
expect(props).toExist();
expect(props.gridTools.length).toEqual(0);
expect(props.widgets.length).toEqual(2);
let mapWidgetsConnectedWithTbl = props.widgets.filter(i=>i.widgetType === 'map' && i?.dependenciesMap && i?.dependenciesMap?.mapSync?.includes(props.id)) || [];
let mapWidgetsConnectedWithTbl = props.widgets.filter(i=>i.widgetType === 'map' && i?.dependenciesMap && i?.dependenciesMap?.mapSync?.includes(props.id) && i.mapSync) || [];
expect(mapWidgetsConnectedWithTbl.length).toEqual(0);
done();
}));
Expand Down
2 changes: 1 addition & 1 deletion web/client/components/widgets/enhancers/tableWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const withSorting = () => withPropsOnChange(["gridEvents"], ({ gridEvents = {},
export default compose(
compose(connect(null, (dispatch, ownProps)=>{
let isTblDashboard = ownProps?.enableZoomInTblWidget && ownProps?.widgetType === 'table' && ownProps?.isDashboardOpened;
let mapWidgetsConnectedWithTbl = ownProps?.widgets?.filter(i=>i.widgetType === 'map' && i?.dependenciesMap && i?.dependenciesMap?.mapSync?.includes(ownProps.id)) || [];
let mapWidgetsConnectedWithTbl = ownProps?.widgets?.filter(i=>i.widgetType === 'map' && i?.dependenciesMap && i?.dependenciesMap?.mapSync?.includes(ownProps.id) && i.mapSync) || [];
let isTblSyncWithMap = ownProps?.mapSync || mapWidgetsConnectedWithTbl.length;
let isTblWidgetInMapViewer = ownProps?.widgetType === 'table' && !isTblDashboard && ownProps?.enableZoomInTblWidget;
return {
Expand Down

0 comments on commit c6abc8b

Please sign in to comment.