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

Reset internal attribution control cache when removing from map #9052

Merged
merged 1 commit into from
Dec 2, 2019
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
1 change: 1 addition & 0 deletions src/ui/control/attribution_control.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ class AttributionControl {
this._map.off('resize', this._updateCompact);

this._map = (undefined: any);
this._attribHTML = (undefined: any);
}

_updateEditLink() {
Expand Down
13 changes: 13 additions & 0 deletions test/unit/ui/control/attribution.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,19 @@ test('AttributionControl shows custom attribution if customAttribution option is
t.end();
});

test('AttributionControl shows custom attribution if customAttribution option is provided, control is removed and added back', (t) => {
const map = createMap(t);
const attributionControl = new AttributionControl({
customAttribution: 'Custom string'
});
map.addControl(attributionControl);
map.removeControl(attributionControl);
map.addControl(attributionControl);

t.equal(attributionControl._innerContainer.innerHTML, 'Custom string');
t.end();
});

test('AttributionControl in compact mode shows custom attribution if customAttribution option is provided', (t) => {
const map = createMap(t);
const attributionControl = new AttributionControl({
Expand Down