@@ -425,6 +425,11 @@ function checkAROPosition(gd, aro) {
425
425
}
426
426
427
427
// some made-up values for testing
428
+ // NOTE: The pixel values are intentionally set so that 2*pixel is never greater
429
+ // than the mock's margin. This is so that annotations are not unintentionally
430
+ // clipped out because they exceed the plotting area. The reason for using twice
431
+ // the pixel value is because the annotation test requires plotting 2
432
+ // annotations, the second having arrow components twice as long as the first.
428
433
var aroPositionsX = [ {
429
434
// aros referring to data
430
435
ref : 'range' ,
@@ -433,21 +438,21 @@ var aroPositionsX = [{
433
438
size : 1.5 ,
434
439
// for the case when annotations specifies arrow in pixels, this value
435
440
// is read instead of value[1]
436
- pixel : 50
441
+ pixel : 25
437
442
} ,
438
443
{
439
444
// aros referring to domains
440
445
ref : 'domain' ,
441
446
value : [ 0.2 , 0.75 ] ,
442
447
size : 0.3 ,
443
- pixel : 60
448
+ pixel : 30
444
449
} ,
445
450
{
446
451
// aros referring to paper
447
452
ref : 'paper' ,
448
453
value : [ 0.25 , 0.8 ] ,
449
454
size : 0.35 ,
450
- pixel : 70
455
+ pixel : 35
451
456
} ,
452
457
] ;
453
458
var aroPositionsY = [ {
@@ -469,7 +474,7 @@ var aroPositionsY = [{
469
474
// aros referring to paper
470
475
ref : 'paper' ,
471
476
value : [ 0.2 , 0.85 ] ,
472
- pixel : 80 ,
477
+ pixel : 45 ,
473
478
size : .3
474
479
}
475
480
] ;
@@ -559,7 +564,7 @@ function test_correct_aro_positions() {
559
564
testCombos . forEach ( testDomRefAROCombo ) ;
560
565
}
561
566
562
- function runComboTests ( productItems , testCombo , start_stop , filter ) {
567
+ function runComboTests ( productItems , testCombo , start_stop , filter , keep_graph_div ) {
563
568
var testCombos = [ ...iterable . cartesianProduct ( productItems ) ] ;
564
569
testCombos = testCombos . map ( ( c , i ) => c . concat ( [ 'graph-' + i ] ) ) ;
565
570
if ( filter ) {
@@ -569,7 +574,7 @@ function runComboTests(productItems,testCombo,start_stop,filter) {
569
574
testCombos = testCombos . slice ( start_stop . start , start_stop . stop ) ;
570
575
}
571
576
console . log ( "Executing " + testCombos . length + " tests" ) ;
572
- var tc = testCombos . map ( c => testCombo ( c , false ) ) . reduce ( ( a , v ) => a . then ( v ) ) ;
577
+ var tc = testCombos . map ( c => testCombo ( c , keep_graph_div ) ) . reduce ( ( a , v ) => a . then ( v ) ) ;
573
578
}
574
579
575
580
var testImageComboMock = Lib . extendDeep ( { } ,
@@ -674,16 +679,17 @@ function testAnnotationCombo(combo,keep_graph_div) {
674
679
} ) ;
675
680
}
676
681
677
- function runAnnotationTests ( start_stop , filter ) {
682
+ function runAnnotationTests ( start_stop , filter , keep_graph_div ) {
678
683
runComboTests ( [
679
684
axisTypes , axisTypes , axisPairs , aroPositionsX , aroPositionsY , arrowAxis
680
685
] ,
681
- testAnnotationCombo , start_stop , filter ) ;
686
+ testAnnotationCombo , start_stop , filter , keep_graph_div ) ;
682
687
}
683
688
684
689
module . exports = {
685
690
runImageTests : runImageTests ,
686
691
testImageCombo : testImageCombo ,
687
692
runAnnotationTests : runAnnotationTests ,
688
- testAnnotationCombo : testAnnotationCombo
693
+ testAnnotationCombo : testAnnotationCombo ,
694
+ findAROByColor : findAROByColor
689
695
} ;
0 commit comments