mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-22 03:35:31 -05:00
Ensure that angle brackets in pyscript tag are escaped before parsing (#684)
* Ensure that angle brackets in pyscript tag are escaped before parsing * Improve tests * Update pyscriptjs/tests/test_01_basic.py Co-authored-by: James A. Bednar <jbednar@users.noreply.github.com> Co-authored-by: James A. Bednar <jbednar@users.noreply.github.com>
This commit is contained in:
@@ -36,3 +36,18 @@ class TestBasic(PyScriptTest):
|
||||
"""
|
||||
)
|
||||
assert self.console.info.lines == ["one", "two", "three", "four"]
|
||||
|
||||
def test_escaping_of_angle_brackets(self):
|
||||
"""
|
||||
Check that py-script tags escape angle brackets
|
||||
"""
|
||||
# NOTE: this test relies on the fact that pyscript does not write
|
||||
# anything to console.info. If we start writing to info in the future,
|
||||
# we will probably need to tweak this test.
|
||||
self.pyscript_run(
|
||||
"""
|
||||
<py-script>import js; js.console.info(1<2, 1>2)</py-script>
|
||||
<py-script>js.console.info("<div></div>")</py-script>
|
||||
"""
|
||||
)
|
||||
assert self.console.info.lines == ["true false", "<div></div>"]
|
||||
|
||||
Reference in New Issue
Block a user