Add quotes for strings in javascript.assemble
This commit is contained in:
parent
08b70f0f4c
commit
a8ef956726
@ -54,7 +54,7 @@ def _convert_js_arg(arg):
|
||||
if arg is None:
|
||||
return 'undefined'
|
||||
elif isinstance(arg, str):
|
||||
return string_escape(arg)
|
||||
return '"{}"'.format(string_escape(arg))
|
||||
elif isinstance(arg, int):
|
||||
return str(arg)
|
||||
else:
|
||||
|
@ -123,8 +123,8 @@ class TestStringEscape:
|
||||
|
||||
|
||||
@pytest.mark.parametrize('arg, expected', [
|
||||
('foobar', 'foobar'),
|
||||
('foo\\bar', r'foo\\bar'),
|
||||
('foobar', '"foobar"'),
|
||||
('foo\\bar', r'"foo\\bar"'),
|
||||
(42, '42'),
|
||||
(None, 'undefined'),
|
||||
(object(), TypeError),
|
||||
|
Loading…
Reference in New Issue
Block a user