Skip to content

Commit

Permalink
Close #3385 Close missing save button after login (#3757) (#3761)
Browse files Browse the repository at this point in the history
  • Loading branch information
offtherailz authored May 16, 2019
1 parent 1dd45e8 commit abc2cc0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions web/client/reducers/__tests__/config-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,17 @@ describe('Test the mapConfig reducer', () => {
});
expect(mapConfig({}, {type: MAP_CREATED, resourceId: 2})).toEqual({});
});
it('test MAP_INFO_LOADED accepts string or numeric mapId', () => {
var state = mapConfig({}, {type: 'MAP_CONFIG_LOADED', mapId: "1", config: { version: 2, map: {center: {x: 1, y: 1}, zoom: 11, layers: [] }}});
state = mapConfig(state, {type: "MAP_INFO_LOADED", mapId: 1, info: {canEdit: true, canDelete: true}});
expect(state.map).toExist();
expect(state.map.info).toExist();
expect(state.map.info.canEdit).toBe(true);
state = {};
state = mapConfig({}, {type: 'MAP_CONFIG_LOADED', mapId: 1, config: { version: 2, map: {center: {x: 1, y: 1}, zoom: 11, layers: [] }}});
state = mapConfig(state, {type: "MAP_INFO_LOADED", mapId: "1", info: {canEdit: true, canDelete: true}});
expect(state.map).toExist();
expect(state.map.info).toExist();
expect(state.map.info.canEdit).toBe(true);
});
});
2 changes: 1 addition & 1 deletion web/client/reducers/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function mapConfig(state = null, action) {
}
case MAP_INFO_LOADED:
map = state && state.map && state.map.present ? state.map.present : state && state.map;
if (map && map.mapId === action.mapId) {
if (map && `${map.mapId}` === `${action.mapId}`) {
map = assign({}, map, {info: action.info});
return assign({}, state, {map: map});
}
Expand Down

0 comments on commit abc2cc0

Please sign in to comment.