Skip to content

Commit 75c34ed

Browse files
committed
Add test for customization of Leaflet Popup's "autoWidth" option
1 parent 1e5b37d commit 75c34ed

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# Changelog
22

33
## development
4+
- Add test for customization of Leaflet Popup's "autoWidth" option
45

56
## v0.13.0
67
- Update basemaps URL to the new CARTO CDN URL. Thanks, @skgsergio!
78
- Editor UI cleanups. Thanks, @matschaffer!
9+
- Upgrade to jQuery 3.5.1
810

911
## v0.12.0
1012
- Add `formatOmitEmptyValue` settings parameter to hide `n/a` value. Thanks, @iruizr7!

src/libs/leaflet.test.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import * as L from './leaflet';
2+
3+
describe('Leaflet', () => {
4+
describe('when creating a popup', () => {
5+
it('should have an autoWidth option, defaulting to true', () => {
6+
let popup = new L.popup();
7+
popup._initLayout();
8+
popup._updateLayout();
9+
10+
expect(popup.options.autoWidth).toBe(true);
11+
expect(popup._contentNode.style.width).toBe(popup.options.minWidth + 1 + 'px');
12+
});
13+
14+
it('should not compute its width automatically when autoWidth option is false', () => {
15+
let popup = new L.popup({ autoWidth: false });
16+
popup._initLayout();
17+
popup._updateLayout();
18+
19+
expect(popup.options.autoWidth).toBe(false);
20+
expect(popup._contentNode.style.width).toBe('');
21+
});
22+
});
23+
});

0 commit comments

Comments
 (0)