From cb55234594ee54c59d702ae5858e4aea5e254ea9 Mon Sep 17 00:00:00 2001 From: Philipp Rudiger Date: Sun, 5 Sep 2021 12:25:41 +0200 Subject: [PATCH] Add test --- panel/reactive.py | 2 +- panel/tests/test_reactive.py | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/panel/reactive.py b/panel/reactive.py index ae96062ce4..ede067cac2 100644 --- a/panel/reactive.py +++ b/panel/reactive.py @@ -1196,7 +1196,7 @@ class ReactiveHTML(Reactive, metaclass=ReactiveHTMLMetaclass): _scripts = {} - _script_assignment = r'data.([^[^\d\W]\w*)[ ]*[\+,\-,\*,\\,%,\*\*,<<,>>,&,^,|,&&,||,??]*=' + _script_assignment = r'data.([^[^\d\W]\w*)[ ]*[\+,\-,\*,\\,%,\*\*,<<,>>,>>>,&,^,|,&&,||,??]*=' __abstract = True diff --git a/panel/tests/test_reactive.py b/panel/tests/test_reactive.py index 5755dd3077..964dd88fb2 100644 --- a/panel/tests/test_reactive.py +++ b/panel/tests/test_reactive.py @@ -403,3 +403,19 @@ class TestTemplatedChildren(ReactiveHTML): """ model = test.get_root() assert model.looped == ['option'] + + +@pytest.mark.parametrize('operator', ['', '+', '-', '*', '\\', '%', '**', '>>', '<<', '>>>', '&', '^', '&&', '||', '??']) + +@pytest.mark.parametrize('sep', [' ', '']) +def test_reactive_html_scripts_linked_properties_assignment_operator(operator, sep): + + class TestScripts(ReactiveHTML): + + clicks = param.Integer() + + _template = "
" + + _scripts = {'render': f'test.onclick = () => {{ data.clicks{sep}{operator}= 1 }}'} + + assert TestScripts()._linked_properties() == ['clicks']