@@ -52,21 +52,29 @@ QUnit.test('Calling resetProgressBar should reset the components displaying time
52
52
53
53
// Do reset
54
54
player . resetProgressBar_ ( ) ;
55
- player . duration ( 0 ) ;
55
+ // Allows to have a duration state similar to player.reset() by combining the durationchange
56
+ player . duration ( NaN ) ;
57
+ player . trigger ( 'durationchange' ) ;
56
58
clock . tick ( 30 ) ;
57
59
60
+ const calculateDistance = sinon . spy ( seekBar , 'calculateDistance' ) ;
61
+
62
+ // Simulate a mouse move
63
+ seekBar . handleMouseMove ( { offsetX : 1 } ) ;
64
+
58
65
assert . equal ( player . currentTime ( ) , 0 , 'player current time is 0' ) ;
59
66
60
67
// Current time display
61
68
assert . equal ( currentTimeDisplay . textNode_ . textContent , '0:00' , 'current time display is 0:00' ) ;
62
69
// Duration display
63
- assert . equal ( durationDisplay . textNode_ . textContent , '0:00 ' , 'duration display is 0:00 ' ) ;
70
+ assert . equal ( durationDisplay . textNode_ . textContent , '-:- ' , 'duration display is -:- ' ) ;
64
71
// Remaining time display
65
- assert . equal ( remainingTimeDisplay . textNode_ . textContent , '0:00 ' , 'remaining time display is 0:00 ' ) ;
72
+ assert . equal ( remainingTimeDisplay . textNode_ . textContent , '-:- ' , 'remaining time display is -:- ' ) ;
66
73
// Seek bar
67
74
assert . equal ( seekBar . getProgress ( ) , '0' , 'seek bar progress is 0' ) ;
68
- assert . equal ( seekBar . getAttribute ( 'aria-valuetext' ) , '0:00 of 0:00 ' , 'seek bar progress holder aria value text is 0:00 of 0:00 ' ) ;
75
+ assert . equal ( seekBar . getAttribute ( 'aria-valuetext' ) , '0:00 of -:- ' , 'seek bar progress holder aria value text is 0:00 of -:- ' ) ;
69
76
assert . equal ( seekBar . getAttribute ( 'aria-valuenow' ) , '0.00' , 'seek bar progress holder aria value now is 0.00' ) ;
77
+ assert . ok ( ! calculateDistance . called , 'calculateDistance was not called' ) ;
70
78
// Load progress
71
79
assert . equal ( seekBar . loadProgressBar . el ( ) . textContent , 'Loaded: 0.00%' , 'load progress bar textContent is Loaded: 0.00%' ) ;
72
80
assert . equal ( seekBar . loadProgressBar . el ( ) . style . width , '0%' , 'load progress bar width is 0%' ) ;
@@ -76,6 +84,7 @@ QUnit.test('Calling resetProgressBar should reset the components displaying time
76
84
assert . equal ( seekBar . playProgressBar . timeTooltip . el ( ) . textContent , '0:00' , 'player progress bar time tooltip is 0:00' ) ;
77
85
78
86
clock . restore ( ) ;
87
+ calculateDistance . restore ( ) ;
79
88
player . dispose ( ) ;
80
89
} ) ;
81
90
0 commit comments