mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
dca8c0cb6f
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@92557 467b73ca-7a2a-4603-9d3b-597d59a354a9
35 lines
946 B
JavaScript
35 lines
946 B
JavaScript
|
|
describe 'jQuery'
|
|
describe '.getJSON()'
|
|
it 'should work with mockRequest'
|
|
mockRequest().and_return('{ foo : "bar" }')
|
|
$.getJSON('foo', function(response, statusText){
|
|
response.foo.should.eql 'bar'
|
|
statusText.should.eql 'success'
|
|
})
|
|
end
|
|
|
|
it 'should work with a json fixture'
|
|
mockRequest().and_return(fixture('test.json'))
|
|
$.getJSON('foo', function(response){
|
|
response.users.tj.email.should.eql 'tj@vision-media.ca'
|
|
})
|
|
end
|
|
|
|
it 'should not invoke callback when response status is 4xx'
|
|
mockRequest().and_return('foo', 'text/plain', 404)
|
|
$.getJSON('foo', function(){
|
|
fail('callback was invoked')
|
|
})
|
|
end
|
|
end
|
|
|
|
describe '.post()'
|
|
it 'should work with mockRequest'
|
|
mockRequest().and_return('<p></p>', 'text/html')
|
|
$.post('foo', function(response){
|
|
response.should.eql '<p></p>'
|
|
})
|
|
end
|
|
end
|
|
end |