Skip to content

Commit abc2cc0

Browse files
authored
Close #3385 Close missing save button after login (#3757) (#3761)
1 parent 1dd45e8 commit abc2cc0

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

web/client/reducers/__tests__/config-test.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,17 @@ describe('Test the mapConfig reducer', () => {
115115
});
116116
expect(mapConfig({}, {type: MAP_CREATED, resourceId: 2})).toEqual({});
117117
});
118+
it('test MAP_INFO_LOADED accepts string or numeric mapId', () => {
119+
var state = mapConfig({}, {type: 'MAP_CONFIG_LOADED', mapId: "1", config: { version: 2, map: {center: {x: 1, y: 1}, zoom: 11, layers: [] }}});
120+
state = mapConfig(state, {type: "MAP_INFO_LOADED", mapId: 1, info: {canEdit: true, canDelete: true}});
121+
expect(state.map).toExist();
122+
expect(state.map.info).toExist();
123+
expect(state.map.info.canEdit).toBe(true);
124+
state = {};
125+
state = mapConfig({}, {type: 'MAP_CONFIG_LOADED', mapId: 1, config: { version: 2, map: {center: {x: 1, y: 1}, zoom: 11, layers: [] }}});
126+
state = mapConfig(state, {type: "MAP_INFO_LOADED", mapId: "1", info: {canEdit: true, canDelete: true}});
127+
expect(state.map).toExist();
128+
expect(state.map.info).toExist();
129+
expect(state.map.info.canEdit).toBe(true);
130+
});
118131
});

web/client/reducers/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function mapConfig(state = null, action) {
5454
}
5555
case MAP_INFO_LOADED:
5656
map = state && state.map && state.map.present ? state.map.present : state && state.map;
57-
if (map && map.mapId === action.mapId) {
57+
if (map && `${map.mapId}` === `${action.mapId}`) {
5858
map = assign({}, map, {info: action.info});
5959
return assign({}, state, {map: map});
6060
}

0 commit comments

Comments
 (0)