Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix default state of map reducers #1345

Merged
merged 1 commit into from
Dec 13, 2016
Merged
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
7 changes: 7 additions & 0 deletions web/client/reducers/__tests__/map-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,13 @@ describe('Test the map reducer', () => {
expect(state.mapOptions.view).toExist();
expect(state.mapOptions.view.resolutions).toNotExist();
expect(state.mapOptions.view.prop).toBe('prop');

// add map scales with no initial state
state = mapConfig(undefined, action);
expect(state).toExist();
expect(state.mapOptions).toExist();
expect(state.mapOptions.view).toExist();
expect(state.mapOptions.view.resolutions).toExist();
});

it('zoom to extent', () => {
Expand Down
2 changes: 1 addition & 1 deletion web/client/reducers/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var assign = require('object-assign');
var MapUtils = require('../utils/MapUtils');
var CoordinatesUtils = require('../utils/CoordinatesUtils');

function mapConfig(state = null, action) {
function mapConfig(state = {}, action) {
switch (action.type) {
case CHANGE_MAP_VIEW:
const {type, ...params} = action;
Expand Down