Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion web/client/epics/__tests__/geoProcessing-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1049,13 +1049,20 @@ describe('geoProcessing epics', () => {
});
it('LPlongitudinalMapLayoutGPTEpic', (done) => {
const NUM_ACTIONS = 1;
const startActions = [updateMapLayout("test")];
const startActions = [updateMapLayout({
right: 300,
boundingSidebarRect: { right: 50 },
boundingMapRect: { right: 300 }
})];
testEpic(LPlongitudinalMapLayoutGPTEpic, NUM_ACTIONS, startActions, actions => {
expect(actions.length).toBe(NUM_ACTIONS);
const [
action1
] = actions;
expect(action1.type).toEqual(updateMapLayout().type);
expect(action1.layout.right).toBe(470);
expect(action1.layout.boundingMapRect.right).toBe(470);
expect(action1.layout.boundingSidebarRect.right).toBe(50);
done();
}, {
controls: {
Expand Down
9 changes: 7 additions & 2 deletions web/client/epics/geoProcessing.js
Original file line number Diff line number Diff line change
Expand Up @@ -1059,13 +1059,18 @@ export const LPlongitudinalMapLayoutGPTEpic = (action$, store) =>
action$.ofType(UPDATE_MAP_LAYOUT)
.filter(({source}) => isGeoProcessingEnabledSelector(store.getState()) && source !== GPT_CONTROL_NAME)
.map(({layout}) => {
const boundingSidebarRect = {
...(layout.boundingSidebarRect || {}),
right: layout?.boundingSidebarRect?.right ?? 40
};
const action = updateMapLayout({
...layout,
right: OFFSET + (layout?.boundingSidebarRect?.right ?? 0),
right: OFFSET + boundingSidebarRect.right,
boundingMapRect: {
...(layout.boundingMapRect || {}),
right: OFFSET + (layout?.boundingSidebarRect?.right ?? 0)
right: OFFSET + boundingSidebarRect.right
},
boundingSidebarRect,
rightPanel: true
});
return { ...action, source: GPT_CONTROL_NAME }; // add an argument to avoid infinite loop.
Expand Down
9 changes: 7 additions & 2 deletions web/client/epics/longitudinalProfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,13 +369,18 @@ export const LPlongitudinalMapLayoutEpic = (action$, store) =>
action$.ofType(UPDATE_MAP_LAYOUT)
.filter(({source}) => isDockOpenSelector(store.getState()) && source !== CONTROL_NAME)
.map(({layout}) => {
const boundingSidebarRect = {
...(layout.boundingSidebarRect || {}),
right: layout?.boundingSidebarRect?.right ?? 40
};
const action = updateMapLayout({
...layout,
right: OFFSET + (layout?.boundingSidebarRect?.right ?? 0),
right: OFFSET + boundingSidebarRect.right,
boundingMapRect: {
...(layout.boundingMapRect || {}),
right: OFFSET + (layout?.boundingSidebarRect?.right ?? 0)
right: OFFSET + boundingSidebarRect.right
},
boundingSidebarRect,
rightPanel: true
});
return { ...action, source: CONTROL_NAME }; // add an argument to avoid infinite loop.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe('dynamiclegend epics', () => {
expect(actions[0].source).toBe(CONTROL_NAME);
expect(actions[0].layout.right).toBe(DEFAULT_PANEL_WIDTH + (layout?.boundingSidebarRect?.right ?? 0));
expect(actions[0].layout.rightPanel).toBe(true);
expect(actions[0].layout.boundingMapRect.right).toBe(DEFAULT_PANEL_WIDTH);
expect(actions[0].layout.boundingMapRect.right).toBe(DEFAULT_PANEL_WIDTH + (layout?.boundingSidebarRect?.right ?? 0));
expect(actions[0].layout.boundingSidebarRect.right).toBe(200);
done();
},
Expand Down
9 changes: 7 additions & 2 deletions web/client/plugins/DynamicLegend/epics/dynamiclegend.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,18 @@ export const dynamicLegendMapLayoutEpic = (action$, store) =>
return !isFloatingSelector(store.getState()) && enabledSelector(store.getState()) && isNil(source);
})
.map(({layout}) => {
const boundingSidebarRect = {
...(layout.boundingSidebarRect || {}),
right: layout?.boundingSidebarRect?.right ?? 40
};
const newLayout = {
...layout,
right: OFFSET + (layout?.boundingSidebarRect?.right ?? 0),
right: OFFSET + boundingSidebarRect.right,
boundingMapRect: {
...(layout.boundingMapRect || {}),
right: OFFSET
right: OFFSET + boundingSidebarRect.right
},
boundingSidebarRect,
rightPanel: true
};
const action = updateMapLayout(newLayout);
Expand Down
21 changes: 21 additions & 0 deletions web/client/plugins/Isochrone/epics/__tests__/isochrone-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,27 @@ describe('Isochrone Epics', () => {
mockStore.getState()
);
});

it('should default missing boundingSidebarRect right to 40', (done) => {
const layout = {
right: 300,
boundingMapRect: { right: 300 }
};

testEpic(
addTimeoutEpic(isochroneMapLayoutEpic, 10),
1,
updateMapLayout(layout),
actions => {
expect(actions[0].type).toBe(UPDATE_MAP_LAYOUT);
expect(actions[0].layout.right).toBe(460);
expect(actions[0].layout.boundingMapRect.right).toBe(460);
expect(actions[0].layout.boundingSidebarRect.right).toBe(40);
done();
},
mockStore.getState()
);
});
});

describe('isochroneSearchByLocationNameEpic', () => {
Expand Down
9 changes: 7 additions & 2 deletions web/client/plugins/Isochrone/epics/isochrone.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,18 @@ export const isochroneMapLayoutEpic = (action$, store) =>
action$.ofType(UPDATE_MAP_LAYOUT)
.filter(({source}) => enabledSelector(store.getState()) && isNil(source))
.map(({layout}) => {
const boundingSidebarRect = {
...(layout.boundingSidebarRect || {}),
right: layout?.boundingSidebarRect?.right ?? 40
};
const action = updateMapLayout({
...layout,
right: OFFSET + (layout?.boundingSidebarRect?.right ?? 0),
right: OFFSET + boundingSidebarRect.right,
boundingMapRect: {
...(layout.boundingMapRect || {}),
right: OFFSET + (layout?.boundingSidebarRect?.right ?? 0)
right: OFFSET + boundingSidebarRect.right
},
boundingSidebarRect,
rightPanel: true
});
return { ...action, source: CONTROL_NAME };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ describe('Itinerary Epics', () => {

testEpic(itineraryMapLayoutEpic, 1, action, (actions) => {
expect(actions[0].type).toBe(UPDATE_MAP_LAYOUT);
expect(actions[0].layout.right).toBe(420);
expect(actions[0].layout.right).toBe(460);
}, state, done);
});

Expand Down
9 changes: 7 additions & 2 deletions web/client/plugins/Itinerary/epics/itinerary.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,18 @@ export const itineraryMapLayoutEpic = (action$, store) =>
action$.ofType(UPDATE_MAP_LAYOUT)
.filter(({source}) => enabledSelector(store.getState()) && isNil(source))
.map(({layout}) => {
const boundingSidebarRect = {
...(layout.boundingSidebarRect || {}),
right: layout?.boundingSidebarRect?.right ?? 40
};
const action = updateMapLayout({
...layout,
right: OFFSET + (layout?.boundingSidebarRect?.right ?? 0),
right: OFFSET + boundingSidebarRect.right,
boundingMapRect: {
...(layout.boundingMapRect || {}),
right: OFFSET + (layout?.boundingSidebarRect?.right ?? 0)
right: OFFSET + boundingSidebarRect.right
},
boundingSidebarRect,
rightPanel: true
});
return { ...action, source: CONTROL_NAME };
Expand Down
Loading