Skip to content

Commit 7a6cb0c

Browse files
committed
Add test case for "formatOmitEmptyValue" option
1 parent 4d1d08a commit 7a6cb0c

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/worldmap.test.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,26 @@ describe('Worldmap', () => {
517517
expect(worldMap.circles[0]._popup._content).toBe('Sweden: 1\nSweden: 2');
518518
});
519519
});
520+
521+
describe('when a data point has a value of NaN', () => {
522+
beforeEach(() => {
523+
ctrl.data = new DataBuilder()
524+
.withCountryAndValue('SE', NaN)
525+
.build();
526+
});
527+
528+
it('should create a popup which contains n/a', () => {
529+
worldMap.drawCircles();
530+
expect(worldMap.circles[0]._popup._content).toBe('Sweden: n/a');
531+
});
532+
533+
it('should create a popup which should not contain n/a, when formatOmitEmptyValue is set', () => {
534+
ctrl.panel.formatOmitEmptyValue = true;
535+
worldMap.drawCircles();
536+
expect(worldMap.circles[0]._popup._content).toBe('Sweden');
537+
});
538+
});
539+
520540
});
521541

522542
describe('WorldmapFoundation', () => {

0 commit comments

Comments
 (0)