1
1
import DataBuilder from '../test/data_builder' ;
2
- import { createBasicMap } from '../test/map_builder' ;
2
+ import { createBasicMap } from '../test/map_builder' ;
3
3
import $ from 'jquery' ;
4
- import PluginSettings from " ./settings" ;
4
+ import PluginSettings from ' ./settings' ;
5
5
import { TemplateSrv } from 'grafana/app/features/templating/template_srv' ;
6
6
7
-
8
7
describe ( 'Worldmap' , ( ) => {
9
-
10
8
let worldMap ;
11
9
let ctrl ;
12
10
@@ -398,7 +396,6 @@ describe('Worldmap', () => {
398
396
expect ( worldMap . circles [ 0 ] . _popup . _content ) . toBe ( 'Sweden: 1\nSweden: 2' ) ;
399
397
} ) ;
400
398
} ) ;
401
-
402
399
} ) ;
403
400
404
401
describe ( 'WorldmapFoundation' , ( ) => {
@@ -461,10 +458,8 @@ describe('WorldmapFoundation', () => {
461
458
expect ( document . getElementsByClassName ( 'leaflet-control-attribution' ) [ 0 ] ) . toBeUndefined ( ) ;
462
459
} ) ;
463
460
} ) ;
464
-
465
461
} ) ;
466
462
467
-
468
463
describe ( 'ClickthroughLinks' , ( ) => {
469
464
/*
470
465
* These tests proof the clickthrough link works.
@@ -494,18 +489,14 @@ describe('ClickthroughLinks', () => {
494
489
495
490
describe ( 'when a Worldmap is created with clickthrough-links enabled' , ( ) => {
496
491
beforeEach ( ( ) => {
497
-
498
492
// Create map.
499
493
ctrl . panel . clickthroughUrl = 'http://foo.bar' ;
500
494
ctrl . settings = new PluginSettings ( ctrl . panel , templateSrvMock , { } ) ;
501
495
worldMap . createMap ( ) ;
502
496
503
497
// Load data and draw circles.
504
- ctrl . data = new DataBuilder ( )
505
- . withCountryAndValue ( 'SE' , 1 )
506
- . build ( ) ;
498
+ ctrl . data = new DataBuilder ( ) . withCountryAndValue ( 'SE' , 1 ) . build ( ) ;
507
499
worldMap . drawCircles ( ) ;
508
-
509
500
} ) ;
510
501
511
502
it ( 'should have registered a second click event' , ( ) => {
@@ -514,7 +505,6 @@ describe('ClickthroughLinks', () => {
514
505
} ) ;
515
506
516
507
it ( 'should do its job when actually clicked' , ( ) => {
517
-
518
508
// Setup interaction mock for "window.location.assign".
519
509
// https://remarkablemark.org/blog/2018/11/17/mock-window-location/
520
510
Object . defineProperty ( window . location , 'assign' , {
@@ -526,24 +516,19 @@ describe('ClickthroughLinks', () => {
526
516
worldMap . circles [ 0 ] . fire ( 'click' ) ;
527
517
expect ( window . location . assign ) . toHaveBeenCalledWith ( 'http://foo.bar' ) ;
528
518
} ) ;
529
-
530
519
} ) ;
531
520
532
521
describe ( 'when a Worldmap is created with clickthrough-links enabled to another window' , ( ) => {
533
522
beforeEach ( ( ) => {
534
-
535
523
// Create map.
536
524
ctrl . panel . clickthroughUrl = 'http://foo.bar' ;
537
- ctrl . panel . clickthroughOptions = { windowName : 'test' } ;
525
+ ctrl . panel . clickthroughOptions = { windowName : 'test' } ;
538
526
ctrl . settings = new PluginSettings ( ctrl . panel , templateSrvMock , { } ) ;
539
527
worldMap . createMap ( ) ;
540
528
541
529
// Load data and draw circles.
542
- ctrl . data = new DataBuilder ( )
543
- . withCountryAndValue ( 'SE' , 1 )
544
- . build ( ) ;
530
+ ctrl . data = new DataBuilder ( ) . withCountryAndValue ( 'SE' , 1 ) . build ( ) ;
545
531
worldMap . drawCircles ( ) ;
546
-
547
532
} ) ;
548
533
549
534
it ( 'should have registered a second click event' , ( ) => {
@@ -552,7 +537,6 @@ describe('ClickthroughLinks', () => {
552
537
} ) ;
553
538
554
539
it ( 'should do its job when actually clicked' , ( ) => {
555
-
556
540
// Setup interaction mock for "window.open".
557
541
// https://remarkablemark.org/blog/2018/11/17/mock-window-location/
558
542
Object . defineProperty ( window , 'open' , {
@@ -564,7 +548,5 @@ describe('ClickthroughLinks', () => {
564
548
worldMap . circles [ 0 ] . fire ( 'click' ) ;
565
549
expect ( window . open ) . toHaveBeenCalledWith ( 'http://foo.bar' , 'test' ) ;
566
550
} ) ;
567
-
568
551
} ) ;
569
-
570
552
} ) ;
0 commit comments