@@ -1372,13 +1372,21 @@ describe('Chart.controllers.bar', function() {
1372
1372
1373
1373
var meta = chart . getDatasetMeta ( 1 ) ;
1374
1374
var bar = meta . data [ 0 ] ;
1375
+ var helpers = window . Chart . helpers ;
1375
1376
1376
1377
// Change default
1377
1378
chart . options . elements . rectangle . backgroundColor = 'rgb(128, 128, 128)' ;
1378
1379
chart . options . elements . rectangle . borderColor = 'rgb(15, 15, 15)' ;
1379
1380
chart . options . elements . rectangle . borderWidth = 3.14 ;
1380
1381
1381
- // Remove to defaults
1382
+ chart . update ( ) ;
1383
+ expect ( bar . _model . backgroundColor ) . toBe ( 'rgb(128, 128, 128)' ) ;
1384
+ expect ( bar . _model . borderColor ) . toBe ( 'rgb(15, 15, 15)' ) ;
1385
+ expect ( bar . _model . borderWidth ) . toBe ( 3.14 ) ;
1386
+ meta . controller . setHoverStyle ( bar ) ;
1387
+ expect ( bar . _model . backgroundColor ) . toBe ( helpers . getHoverColor ( 'rgb(128, 128, 128)' ) ) ;
1388
+ expect ( bar . _model . borderColor ) . toBe ( helpers . getHoverColor ( 'rgb(15, 15, 15)' ) ) ;
1389
+ expect ( bar . _model . borderWidth ) . toBe ( 3.14 ) ;
1382
1390
meta . controller . removeHoverStyle ( bar ) ;
1383
1391
expect ( bar . _model . backgroundColor ) . toBe ( 'rgb(128, 128, 128)' ) ;
1384
1392
expect ( bar . _model . borderColor ) . toBe ( 'rgb(15, 15, 15)' ) ;
@@ -1389,6 +1397,14 @@ describe('Chart.controllers.bar', function() {
1389
1397
chart . data . datasets [ 1 ] . borderColor = [ 'rgb(9, 9, 9)' , 'rgb(0, 0, 0)' ] ;
1390
1398
chart . data . datasets [ 1 ] . borderWidth = [ 2.5 , 5 ] ;
1391
1399
1400
+ chart . update ( ) ;
1401
+ expect ( bar . _model . backgroundColor ) . toBe ( 'rgb(255, 255, 255)' ) ;
1402
+ expect ( bar . _model . borderColor ) . toBe ( 'rgb(9, 9, 9)' ) ;
1403
+ expect ( bar . _model . borderWidth ) . toBe ( 2.5 ) ;
1404
+ meta . controller . setHoverStyle ( bar ) ;
1405
+ expect ( bar . _model . backgroundColor ) . toBe ( helpers . getHoverColor ( 'rgb(255, 255, 255)' ) ) ;
1406
+ expect ( bar . _model . borderColor ) . toBe ( helpers . getHoverColor ( 'rgb(9, 9, 9)' ) ) ;
1407
+ expect ( bar . _model . borderWidth ) . toBe ( 2.5 ) ;
1392
1408
meta . controller . removeHoverStyle ( bar ) ;
1393
1409
expect ( bar . _model . backgroundColor ) . toBe ( 'rgb(255, 255, 255)' ) ;
1394
1410
expect ( bar . _model . borderColor ) . toBe ( 'rgb(9, 9, 9)' ) ;
@@ -1401,6 +1417,14 @@ describe('Chart.controllers.bar', function() {
1401
1417
borderWidth : 1.5
1402
1418
} ;
1403
1419
1420
+ chart . update ( ) ;
1421
+ expect ( bar . _model . backgroundColor ) . toBe ( 'rgb(255, 0, 0)' ) ;
1422
+ expect ( bar . _model . borderColor ) . toBe ( 'rgb(0, 255, 0)' ) ;
1423
+ expect ( bar . _model . borderWidth ) . toBe ( 1.5 ) ;
1424
+ meta . controller . setHoverStyle ( bar ) ;
1425
+ expect ( bar . _model . backgroundColor ) . toBe ( helpers . getHoverColor ( 'rgb(255, 0, 0)' ) ) ;
1426
+ expect ( bar . _model . borderColor ) . toBe ( helpers . getHoverColor ( 'rgb(0, 255, 0)' ) ) ;
1427
+ expect ( bar . _model . borderWidth ) . toBe ( 1.5 ) ;
1404
1428
meta . controller . removeHoverStyle ( bar ) ;
1405
1429
expect ( bar . _model . backgroundColor ) . toBe ( 'rgb(255, 0, 0)' ) ;
1406
1430
expect ( bar . _model . borderColor ) . toBe ( 'rgb(0, 255, 0)' ) ;
0 commit comments