Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Sep 5, 2021
1 parent 2abb454 commit cb55234
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion panel/reactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
16 changes: 16 additions & 0 deletions panel/tests/test_reactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "<div id='test'></div>"

_scripts = {'render': f'test.onclick = () => {{ data.clicks{sep}{operator}= 1 }}'}

assert TestScripts()._linked_properties() == ['clicks']

0 comments on commit cb55234

Please sign in to comment.