Skip to content

Commit

Permalink
Added test for #12. Passes.
Browse files Browse the repository at this point in the history
  • Loading branch information
ralphbean committed May 9, 2012
1 parent 1379196 commit b6bbf92
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/test_js.py
Expand Up @@ -68,3 +68,15 @@ def test_quotes_tripled(self):
f = twc.js_callback("""function() { return "c"; }""") f = twc.js_callback("""function() { return "c"; }""")
json = self.encode({'onLoad': f}) json = self.encode({'onLoad': f})
eq_(json, '{"onLoad": function() { return "c"; }}') eq_(json, '{"onLoad": function() { return "c"; }}')

def test_multiline_js(self):
""" https://github.com/toscawidgets/tw2.core/issues/12 """
raw = """
$(document).ready(function() {
console.log("This is multiline javascript");
});
"""
expected = '{"onLoad": %s}' % raw
f = js_symbol(raw)
json = self.encode({'onLoad': f})
eq_(json, expected)

0 comments on commit b6bbf92

Please sign in to comment.