@@ -345,6 +345,49 @@ describe('Worldmap', () => {
345
345
} ) ;
346
346
} ) ;
347
347
348
+ describe ( 'when the data has two points at the same spot' , ( ) => {
349
+ beforeEach ( ( ) => {
350
+ ctrl . data = new DataBuilder ( )
351
+ . withCountryAndValue ( 'SE' , 1 )
352
+ . withCountryAndValue ( 'SE' , 2 )
353
+ . build ( ) ;
354
+ worldMap . drawCircles ( ) ;
355
+ } ) ;
356
+
357
+ it ( 'should draw just one circle on the map' , ( ) => {
358
+ expect ( worldMap . circles . length ) . toBe ( 1 ) ;
359
+ } ) ;
360
+
361
+ it ( 'should create a single circle popup with both data point values' , ( ) => {
362
+ expect ( worldMap . circles [ 0 ] . _popup . _content ) . toBe ( 'Sweden: 1\nSweden: 2' ) ;
363
+ } ) ;
364
+ } ) ;
365
+
366
+ describe ( 'when the data is updated with two points at the same spot' , ( ) => {
367
+ beforeEach ( ( ) => {
368
+ ctrl . data = new DataBuilder ( )
369
+ . withCountryAndValue ( 'SE' , 1 )
370
+ . withCountryAndValue ( 'IE' , 1 )
371
+ . build ( ) ;
372
+ worldMap . drawCircles ( ) ;
373
+
374
+ ctrl . data = new DataBuilder ( )
375
+ . withCountryAndValue ( 'SE' , 1 )
376
+ . withCountryAndValue ( 'IE' , 1 )
377
+ . withCountryAndValue ( 'SE' , 2 )
378
+ . build ( ) ;
379
+ worldMap . drawCircles ( ) ;
380
+ } ) ;
381
+
382
+ it ( 'should draw just one circle on the map' , ( ) => {
383
+ expect ( worldMap . circles . length ) . toBe ( 2 ) ;
384
+ } ) ;
385
+
386
+ it ( 'should create a single circle popup with both data point values' , ( ) => {
387
+ expect ( worldMap . circles [ 0 ] . _popup . _content ) . toBe ( 'Sweden: 1\nSweden: 2' ) ;
388
+ } ) ;
389
+ } ) ;
390
+
348
391
afterEach ( ( ) => {
349
392
const fixture : HTMLElement = document . getElementById ( 'fixture' ) ! ;
350
393
document . body . removeChild ( fixture ) ;
0 commit comments