Skip to content

Commit

Permalink
Fix Ajax test that was failing in IE10 due to caching
Browse files Browse the repository at this point in the history
  • Loading branch information
mislav committed Nov 29, 2013
1 parent 3edfc74 commit 89de9a7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/ajax.html
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ <h1>Zepto Ajax unit tests</h1>

testAjaxGetWithParamsAndType: function(t){
t.pause()
$.get('echo', { sample: 'data' }, t.reg.resumeHandler('success', function(response){
t.assertLine('GET ?{"sample":"data"}', response)
$.get('echo', { sample: 'plain' }, t.reg.resumeHandler('success', function(response){
t.assertLine('GET ?{"sample":"plain"}', response)
t.assertLine("accept: text/plain", response)
}), 'text')
},
Expand All @@ -199,12 +199,12 @@ <h1>Zepto Ajax unit tests</h1>
t.pause()
$(document).on('ajaxSuccess', function(e, xhr, settings, response){
deferredResume(t, function(){
t.assertLine('GET ?{"sample":"data"}', response)
t.assertLine('GET ?{"sample":"plain"}', response)
t.assertLine("accept: text/plain", response)
t.assertEqualList('ajaxBeforeSend ajaxSend ajaxSuccess ajaxComplete', t.reg.events())
})
})
$.get('echo', { sample: 'data' }, 'text')
$.get('echo', { sample: 'plain' }, 'text')
},

testAjaxPost: function(t){
Expand Down
2 changes: 2 additions & 0 deletions test/server.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ dump = (obj) ->
obj

app.all '/test/echo', (req, res) ->
res.set 'Cache-Control', 'no-cache'
res.send """
#{req.method} ?#{dump(req.query)}
content-type: #{mime(req)}
Expand All @@ -39,6 +40,7 @@ app.get '/test/jsonpBlah', (req, res) ->
res.send 'blah()'

app.get '/test/json', (req, res) ->
res.set 'Cache-Control', 'no-cache'
if /json/.test req.headers['accept']
if req.query.invalid
res.set 'Content-Type', 'application/json'
Expand Down

0 comments on commit 89de9a7

Please sign in to comment.