Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

WIP rewriting tests

  • Loading branch information...
commit 349f8428dac8ae186fd12d469a9d7f0ed1a9d9e8 1 parent 9b1262c
@mislav mislav authored
View
5 script/test
@@ -1,4 +1,6 @@
#!/usr/bin/env bash
+set -e
+
port=3999
pidfile=test/server.pid
PATH="$(npm bin):$PATH"
@@ -11,5 +13,4 @@ terminate_test_server() {
}
trap terminate_test_server EXIT
-phantomjs test/runner.coffee "http://localhost:${port}/" "$@"
-exit $?
+mocha-phantomjs -R dot "http://localhost:${port}"
View
39 test/ajax.html
@@ -136,45 +136,6 @@
$(document).off()
},
- testAjaxBase: function(t){
- t.pause()
- var xhr = $.ajax({
- url: 'fixtures/ajax_load_simple.html',
- success: t.reg.handler('success'),
- error: t.reg.handler('error'),
- complete: t.reg.resumeHandler('complete', function(){
- t.assertEqualList('ajaxBeforeSend ajaxSend success ajaxSuccess complete ajaxComplete', t.reg.events())
- })
- })
- t.assert($.isFunction(xhr.getResponseHeader))
- },
-
- testAjaxGet: function(t){
- t.pause()
- var xhr = $.get('echo', t.reg.resumeHandler('success', function(response){
- t.assertIdentical(window, this)
- t.assertLine("GET ?{}", response)
- t.assertEqualList('ajaxBeforeSend ajaxSend success ajaxSuccess ajaxComplete', t.reg.events())
- }))
- t.assertIn('abort', xhr)
- },
-
- testAjaxGetWithParams: function(t){
- t.pause()
- $.get('echo', { sample: 'data' }, t.reg.resumeHandler('success', function(response){
- t.assertLine('GET ?{"sample":"data"}', response)
- t.assertLine("accept: */*", response)
- }))
- },
-
- testAjaxGetWithParamsAndType: function(t){
- t.pause()
- $.get('echo', { sample: 'data' }, t.reg.resumeHandler('success', function(response){
- t.assertLine('GET ?{"sample":"data"}', response)
- t.assertLine("accept: text/plain", response)
- }), 'text')
- },
-
testAjaxGetWithParamsAndTypeNoCallback: function(t){
t.pause()
$(document).on('ajaxSuccess', function(e, xhr, settings, response){
View
7 test/core/ajax.coffee
@@ -1,5 +1,12 @@
describe "Ajax", ->
+ before ->
+ $(document).on 'ajaxError', (e, xhr) ->
+ throw "server returned #{xhr.status}"
+
+ after ->
+ $(document).off()
+
describe "$.get", ->
it "fetches", (done) ->
View
10 test/core/event.coffee
@@ -0,0 +1,10 @@
+describe "Event", ->
+ describe "$.proxy", ->
+ it "binds to an object", ->
+ obj = {}
+ fn = -> [this, arguments]
+
+ [ self, args ] = $.proxy(fn, obj)('one', 'two')
+ expect(self).to.equal(obj)
+ expect(args[0]).to.equal('one')
+ expect(args[1]).to.equal('two')
Please sign in to comment.
Something went wrong with that request. Please try again.