gnab/remark — pull request #108 by DanTup (2014-04-18 12:58:41+00:00)
Title: Add support for sourceUrl in options; to allow pulling slide content from a separate file

- Added tests for existing source behaviour (pass in options; falls back to value from the textarea)
- Added new behaviour to provide sourceUrl with tests

There was some weirdness with Windows newlines causing issues; so I had to strip them out when using sourceUrl - not entirely sure which this only occurs with remote files; but happy to tweak this if someone knows a better way.

Not completely happy with the injecting of the textarea into the DOM (it goes into document, which isn't a fake one); but couldn't see any way to easily mock document or document.getElementById. Again; happy to tweak this with pointers.

One thing I noticed that isn't ideal; is that the test "teardown" code (resetting the fake body/etc.) is done in-line with the tests; so if these tests fail, they can bring down other tests that run after them. (Mine do this because I copied other tests that did this); but it might be something to refactor out into beforeEach/afterEach?