1. Ralph Bean
  2. tw2.core

Commits

Ralph Bean  committed 335221a

Added test for #12. Passes.

  • Participants
  • Parent commits cc6d286
  • Branches default

Comments (0)

Files changed (1)

File tests/test_js.py

View file
  • Ignore whitespace
         f = twc.js_callback("""function() { return "c"; }""")
         json = self.encode({'onLoad': f})
         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)