@@ -51,18 +51,18 @@ describe('Delay Example', () => {
51
51
assert ( getStyleValue ( tooltip , 'visibility' ) === 'visible' ) ;
52
52
53
53
// Wait more
54
- clock . tick ( 1200 ) ;
54
+ clock . tick ( 1000 ) ;
55
55
assert ( getStyleValue ( tooltip , 'visibility' ) === 'hidden' , 'tooltip should be hidden' ) ;
56
56
} ) ;
57
57
} ) ;
58
58
59
59
describe ( 'advanced usage' , ( ) => {
60
- it ( 'should be worked for 0.5 second' , ( ) => {
60
+ it ( 'should be worked for 0.5 second as an integer ' , ( ) => {
61
61
// Mouseover
62
- const origin = firstComponent ( tree , Origin . WrappedComponent , { delay : true } ) . refs . wrapper ;
62
+ const origin = firstComponent ( tree , Origin . WrappedComponent , { delay : 500 } ) . refs . wrapper ;
63
63
TestUtils . Simulate . mouseEnter ( origin ) ;
64
64
65
- const tooltip = firstComponent ( tree , Tooltip . WrappedComponent , { delay : 500 } ) . refs . tooltip ;
65
+ const tooltip = firstComponent ( tree , Tooltip . WrappedComponent ) . refs . tooltip ;
66
66
assert ( getStyleValue ( tooltip , 'visibility' ) === 'visible' ) ;
67
67
68
68
// Mouseout
@@ -74,12 +74,12 @@ describe('Delay Example', () => {
74
74
assert ( getStyleValue ( tooltip , 'visibility' ) === 'hidden' , 'tooltip should be hidden after 0.5 second' ) ;
75
75
} ) ;
76
76
77
- it ( 'should be worked for 1 second' , ( ) => {
77
+ it ( 'should be worked for 1 second as a string ' , ( ) => {
78
78
// Mouseover
79
- const origin = firstComponent ( tree , Origin . WrappedComponent , { delay : true } ) . refs . wrapper ;
79
+ const origin = firstComponent ( tree , Origin . WrappedComponent , { delay : '1000' } ) . refs . wrapper ;
80
80
TestUtils . Simulate . mouseEnter ( origin ) ;
81
81
82
- const tooltip = firstComponent ( tree , Tooltip . WrappedComponent , { delay : '1000' } ) . refs . tooltip ;
82
+ const tooltip = firstComponent ( tree , Tooltip . WrappedComponent ) . refs . tooltip ;
83
83
assert ( getStyleValue ( tooltip , 'visibility' ) === 'visible' ) ;
84
84
85
85
// Mouseout
@@ -91,21 +91,38 @@ describe('Delay Example', () => {
91
91
assert ( getStyleValue ( tooltip , 'visibility' ) === 'hidden' , 'tooltip should be hidden after 1 second' ) ;
92
92
} ) ;
93
93
94
- it ( 'should be worked for 5 seconds' , ( ) => {
94
+ it ( 'should be worked for 2 seconds as a float ' , ( ) => {
95
95
// Mouseover
96
- const origin = firstComponent ( tree , Origin . WrappedComponent , { delay : true } ) . refs . wrapper ;
96
+ const origin = firstComponent ( tree , Origin . WrappedComponent , { delay : 2000.0 } ) . refs . wrapper ;
97
97
TestUtils . Simulate . mouseEnter ( origin ) ;
98
98
99
- const tooltip = firstComponent ( tree , Tooltip . WrappedComponent , { delay : 5000.0 } ) . refs . tooltip ;
99
+ const tooltip = firstComponent ( tree , Tooltip . WrappedComponent ) . refs . tooltip ;
100
+ assert ( getStyleValue ( tooltip , 'visibility' ) === 'visible' ) ;
101
+
102
+ // Mouseout
103
+ TestUtils . Simulate . mouseLeave ( origin ) ;
104
+ assert ( getStyleValue ( tooltip , 'visibility' ) === 'visible' , 'tooltip should be kept' ) ;
105
+
106
+ // 2 seconds later
107
+ clock . tick ( 2000 ) ;
108
+ assert ( getStyleValue ( tooltip , 'visibility' ) === 'hidden' , 'tooltip should be hidden after 2 seconds' ) ;
109
+ } ) ;
110
+
111
+ it ( 'should be worked for 3 seconds as a string of float' , ( ) => {
112
+ // Mouseover
113
+ const origin = firstComponent ( tree , Origin . WrappedComponent , { delay : '3000.0' } ) . refs . wrapper ;
114
+ TestUtils . Simulate . mouseEnter ( origin ) ;
115
+
116
+ const tooltip = firstComponent ( tree , Tooltip . WrappedComponent ) . refs . tooltip ;
100
117
assert ( getStyleValue ( tooltip , 'visibility' ) === 'visible' ) ;
101
118
102
119
// Mouseout
103
120
TestUtils . Simulate . mouseLeave ( origin ) ;
104
121
assert ( getStyleValue ( tooltip , 'visibility' ) === 'visible' , 'tooltip should be kept' ) ;
105
122
106
- // 5 seconds later
107
- clock . tick ( 5000 ) ;
108
- assert ( getStyleValue ( tooltip , 'visibility' ) === 'hidden' , 'tooltip should be hidden after 5 seconds' ) ;
123
+ // 3 seconds later
124
+ clock . tick ( 3000 ) ;
125
+ assert ( getStyleValue ( tooltip , 'visibility' ) === 'hidden' , 'tooltip should be hidden after 3 seconds' ) ;
109
126
} ) ;
110
127
} ) ;
111
128
} ) ;
0 commit comments