1- describe ( "hoverIntent" , function ( ) {
1+ import HoverIntent from './hoverIntent.js' ;
22
3+ describe ( "hoverIntent" , function ( ) {
34 function mouse ( eventType , x , y , options ) {
45 let eventOptions = Object . assign ( {
56 bubbles : true ,
@@ -16,14 +17,15 @@ describe("hoverIntent", function() {
1617
1718 let isOver ;
1819 let hoverIntent ;
20+ let clock ;
1921
2022
21- before ( function ( ) {
22- this . clock = sinon . useFakeTimers ( ) ;
23+ beforeAll ( function ( ) {
24+ clock = jasmine . clock ( ) . install ( ) ;
2325 } ) ;
2426
25- after ( function ( ) {
26- this . clock . restore ( ) ;
27+ afterAll ( function ( ) {
28+ clock . uninstall ( ) ;
2729 } ) ;
2830
2931
@@ -49,13 +51,13 @@ describe("hoverIntent", function() {
4951
5052 it ( "mouseover -> when the pointer just arrived, no tooltip" , function ( ) {
5153 mouse ( 'mouseover' , 10 , 10 ) ;
52- assert . isFalse ( isOver ) ;
54+ expect ( isOver ) . toBeFalse ( ) ;
5355 } ) ;
5456
5557 it ( "mouseover -> after a delay, the tooltip shows up" , function ( ) {
5658 mouse ( 'mouseover' , 10 , 10 ) ;
57- this . clock . tick ( 100 ) ;
58- assert . isTrue ( isOver ) ;
59+ clock . tick ( 100 ) ;
60+ expect ( isOver ) . toBeTrue ( ) ;
5961 } ) ;
6062
6163 it ( "mouseover -> followed by fast mouseout leads doesn't show tooltip" , function ( ) {
@@ -64,8 +66,8 @@ describe("hoverIntent", function() {
6466 ( ) => mouse ( 'mouseout' , 300 , 300 , { relatedTarget : document . body } ) ,
6567 30
6668 ) ;
67- this . clock . tick ( 100 ) ;
68- assert . isFalse ( isOver ) ;
69+ clock . tick ( 100 ) ;
70+ expect ( isOver ) . toBeFalse ( ) ;
6971 } ) ;
7072
7173
@@ -77,8 +79,8 @@ describe("hoverIntent", function() {
7779 i
7880 ) ;
7981 }
80- this . clock . tick ( 200 ) ;
81- assert . isTrue ( isOver ) ;
82+ clock . tick ( 200 ) ;
83+ expect ( isOver ) . toBeTrue ( ) ;
8284 } ) ;
8385
8486 it ( "mouseover -> fast move -> no tooltip" , function ( ) {
@@ -89,8 +91,8 @@ describe("hoverIntent", function() {
8991 i
9092 ) ;
9193 }
92- this . clock . tick ( 200 ) ;
93- assert . isFalse ( isOver ) ;
94+ clock . tick ( 200 ) ;
95+ expect ( isOver ) . toBeTrue ( ) ;
9496 } ) ;
9597
9698} ) ;
0 commit comments