File tree Expand file tree Collapse file tree 1 file changed +14
-14
lines changed
Expand file tree Collapse file tree 1 file changed +14
-14
lines changed Original file line number Diff line number Diff line change 2626
2727 promise = Promise . new
2828
29- $window. on 'pop:state' do |e |
30- e . off
31-
29+ $window. one 'pop:state' do |e |
3230 expect ( $window. history . current ) . to eq ( '/' )
3331 promise . resolve
3432 end
4038
4139 describe '#state' do
4240 it 'gets the right state' do
43- $window. history . push ( '/wut' , 42 )
44- $window. history . state . should eq ( 42 )
45- $window. history . push ( '/omg' , 23 )
46- $window. history . state . should eq ( 23 )
47-
41+ # XX: The previous test creates a race condition with this one.
42+ # Adding a delay fixes it.
4843 promise = Promise . new
4944
50- $window. on 'pop:state' do |e |
51- e . off
45+ after 0.05 do
46+ $window. history . push ( '/wut' , 42 )
47+ $window. history . state . should eq ( 42 )
48+ $window. history . push ( '/omg' , 23 )
49+ $window. history . state . should eq ( 23 )
5250
53- expect ( true ) . to eq ( true )
54- promise . resolve
55- end
51+ $window. one 'pop:state' do |e |
52+ expect ( true ) . to eq ( true )
53+ promise . resolve
54+ end
5655
57- $window. history . back ( 2 )
56+ $window. history . back ( 2 )
57+ end
5858 promise
5959 end
6060 end if Browser . supports? 'History.state'
You can’t perform that action at this time.
0 commit comments