Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixing test.html

  • Loading branch information...
commit 5fd82e829b93e507254b0d259640ade85a4d87cb 1 parent 43ebec1
@jashkenas authored
View
2  extras/coffee-script.js
1 addition, 1 deletion not shown
View
3  lib/browser.js
@@ -23,8 +23,9 @@
xhr.overrideMimeType('text/plain');
}
xhr.onreadystatechange = function() {
+ var _ref;
if (xhr.readyState === 4) {
- if (xhr.status === 200) {
+ if ((_ref = xhr.status) === 0 || _ref === 200) {
CoffeeScript.run(xhr.responseText);
} else {
throw new Error("Could not load " + url);
View
4 src/browser.coffee
@@ -22,11 +22,11 @@ CoffeeScript.load = (url, callback) ->
xhr.overrideMimeType 'text/plain' if 'overrideMimeType' of xhr
xhr.onreadystatechange = ->
if xhr.readyState is 4
- if xhr.status is 200
+ if xhr.status in [0, 200]
CoffeeScript.run xhr.responseText
else
throw new Error "Could not load #{url}"
- callback() if callback
+ callback() if callback
xhr.send null
# Activate CoffeeScript in the browser by having it compile and evaluate
View
2  test/function_invocation.coffee
@@ -305,7 +305,7 @@ test "Prefix unary assignment operators are allowed in parenless calls.", ->
ok (func --val) is 5
test "#855: execution context for `func arr...` should be `null`", ->
- contextTest = -> eq @, global
+ contextTest = -> eq @, if window? then window else global
@michaelficarra Collaborator

I think this should be changed back to global and you should add global ?= this at the top.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
array = []
contextTest array
contextTest.apply null, array
View
32 test/test.html
@@ -27,10 +27,9 @@
start = new Date
success = total = done = failed = 0
- say = (msg, yay) ->
+ say = (msg) ->
div = document.createElement 'div'
div.appendChild document.createTextNode msg
- div.style.color = if yay then 'green' else 'red'
stdout.appendChild div
msg
@@ -72,16 +71,9 @@
return
ok no
-
- CoffeeScript.run = (code, cb) ->
- try Function(CoffeeScript.compile code, wrap: no)()
- catch e then cb(); throw e
- cb yes
-
run = (name) ->
- CoffeeScript.load "#{name}.coffee", (yay) ->
- say "#{ if yay then '\u2714' else '\u3000' } #{name}", yay
- ++failed unless yay
+ CoffeeScript.load "#{name}.coffee", ->
+ say '\u2714 ' + name
fin() if ++done is names.length
fin = ->
@@ -92,12 +84,10 @@
say msg, yay
run name for name in names = [
- 'array_literals'
+ 'arrays'
'assignment'
- 'boolean_literals'
- 'cake'
+ 'booleans'
'classes'
- 'command'
'comments'
'compilation'
'comprehensions'
@@ -105,22 +95,22 @@
'exception_handling'
'formatting'
'function_invocation'
- 'function_literals'
+ 'functions'
'helpers'
'importing'
'interpolation'
'javascript_literals'
- 'number_literals'
- 'object_literals'
+ 'numbers'
+ 'objects'
'operators'
'option_parser'
- 'range_literals'
- 'regular_expression_literals'
+ 'ranges'
+ 'regexps'
'repl'
'scope'
'slicing_and_splicing'
'soaks'
- 'string_literals'
+ 'strings'
]
</script>
Please sign in to comment.
Something went wrong with that request. Please try again.