paypal/JavaScriptButtons — pull request #7 by substack (2012-12-13 04:34:28+00:00)
Title: properly split up to run on testling-ci

There were some problems with how the tests were structured that can't run cleanly in real browsers on testling-ci. The first is that jsdom doesn't run in the browser because the browser already has a DOM. There are now 2 separate entry points in test/: one for node tests as before with jsdom (server.js) and one for browser tests through testling-ci (browser.js). Each of these files requires the common test suite in test/test.js. Because testling-ci can't load html files directly, I used [exportify](https://github.com/substack/exportify) to convert the index.html file into index.html.js that can be `require()`d.

One thing to note is that the `should` module doesn't run in IE versions less than 9. If you want to support IE < 9, I recommend swapping out should for the assert module. Browserify shims that out so you can just `var assert = require('assert')` in your browser tests.

The tests now run in testling-ci but do not pass:
http://ci.testling.com/substack/JavaScriptButtons

The biggest reason for not passing is that jsdom is very different from the DOM in real browsers, particularly the timing involved with loading elements. Click on the different browser versions to see the output for each browser. The reason that the IE versions < 9 say "syntax error" is that should.js has trailing commas that do not parse correctly in old IE engines. Swapping these out for assert as mentioned above should fix the syntax issue.