@@ -1380,26 +1380,75 @@ describe("MinimapElement", () => {
13801380 // ###### ####### ## ## ## #### ######
13811381
13821382 describe ( "when the atom styles are changed" , ( ) => {
1383+ let styleElement ;
13831384 beforeEach ( ( ) => {
1385+ styleElement = document . createElement ( "style" ) ;
1386+ atom . styles . addStyleElement ( styleElement ) ;
1387+
13841388 waitsFor ( "a new animation frame request" , ( ) => {
13851389 return nextAnimationFrame !== noAnimationFrame
13861390 } )
1391+
13871392 runs ( ( ) => {
13881393 nextAnimationFrame ( )
13891394 spyOn ( minimapElement , "requestForcedUpdate" ) . andCallThrough ( )
13901395 spyOn ( minimapElement . DOMStylesReader , "invalidateDOMStylesCache" ) . andCallThrough ( )
1396+ } )
1397+ } )
1398+
1399+ it ( "forces a refresh with theme change" , ( ) => {
1400+
1401+ atom . themes . emitter . emit ( "did-change-active-themes" )
1402+
1403+ waitsFor ( "minimap frame requested" , ( ) => {
1404+ return minimapElement . frameRequested
1405+ } )
13911406
1392- atom . themes . emitter . emit ( "did-change-active-themes" )
1407+ runs ( ( ) => {
1408+ expect ( minimapElement . requestForcedUpdate ) . toHaveBeenCalled ( )
1409+ expect ( minimapElement . DOMStylesReader . invalidateDOMStylesCache ) . toHaveBeenCalled ( )
13931410 } )
1411+ } )
1412+
1413+ it ( "forces a refresh with style update" , ( ) => {
1414+ atom . styles . emitter . emit ( "did-update-style-element" , styleElement )
13941415
13951416 waitsFor ( "minimap frame requested" , ( ) => {
13961417 return minimapElement . frameRequested
13971418 } )
1419+
1420+ runs ( ( ) => {
1421+ expect ( minimapElement . requestForcedUpdate ) . toHaveBeenCalled ( )
1422+ expect ( minimapElement . DOMStylesReader . invalidateDOMStylesCache ) . toHaveBeenCalled ( )
1423+ } )
13981424 } )
13991425
1400- it ( "forces a refresh with cache invalidation" , ( ) => {
1401- expect ( minimapElement . requestForcedUpdate ) . toHaveBeenCalled ( )
1402- expect ( minimapElement . DOMStylesReader . invalidateDOMStylesCache ) . toHaveBeenCalled ( )
1426+ it ( "forces a refresh with style add" , ( ) => {
1427+
1428+ atom . styles . emitter . emit ( "did-add-style-element" , styleElement )
1429+
1430+ waitsFor ( "minimap frame requested" , ( ) => {
1431+ return minimapElement . frameRequested
1432+ } )
1433+
1434+ runs ( ( ) => {
1435+ expect ( minimapElement . requestForcedUpdate ) . toHaveBeenCalled ( )
1436+ expect ( minimapElement . DOMStylesReader . invalidateDOMStylesCache ) . toHaveBeenCalled ( )
1437+ } )
1438+ } )
1439+
1440+ it ( "forces a refresh with style remove" , ( ) => {
1441+
1442+ atom . styles . emitter . emit ( "did-remove-style-element" , styleElement )
1443+
1444+ waitsFor ( "minimap frame requested" , ( ) => {
1445+ return minimapElement . frameRequested
1446+ } )
1447+
1448+ runs ( ( ) => {
1449+ expect ( minimapElement . requestForcedUpdate ) . toHaveBeenCalled ( )
1450+ expect ( minimapElement . DOMStylesReader . invalidateDOMStylesCache ) . toHaveBeenCalled ( )
1451+ } )
14031452 } )
14041453 } )
14051454
0 commit comments