Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure ReactiveHTML inline callbacks on looped nodes return correct node #3840

Merged
merged 1 commit into from
Sep 15, 2022

Conversation

philippjfr
Copy link
Member

Ensures that in example like below the onclick event returns a DOMEvent with the node set to the runtime value (list-item-0) rather than the template value: list-item-{{ loop.index0 }}:

class Test(pn.reactive.ReactiveHTML):
    
    a = param.List()
    
    _template = """
    <div id="list">
    {% for item in a %}
      <div id="list-item-{{ loop.index0 }}" onclick=${_call}>${item}</div>
    {% endfor %}
    </div>"""
    
    def _call(self, event):
        print(event.node)

@codecov
Copy link

codecov bot commented Sep 15, 2022

Codecov Report

Merging #3840 (0775d15) into master (affb9dd) will decrease coverage by 0.07%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           master    #3840      +/-   ##
==========================================
- Coverage   82.86%   82.79%   -0.08%     
==========================================
  Files         222      222              
  Lines       32413    32415       +2     
==========================================
- Hits        26860    26837      -23     
- Misses       5553     5578      +25     
Flag Coverage Δ
ui-tests 33.88% <0.00%> (-0.33%) ⬇️
unitexamples-tests 75.23% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
panel/reactive.py 78.14% <0.00%> (-0.18%) ⬇️
panel/tests/ui/io/test_jupyter_server_extension.py 40.74% <0.00%> (-59.26%) ⬇️
panel/tests/util.py 85.14% <0.00%> (-1.99%) ⬇️
panel/tests/conftest.py 86.78% <0.00%> (-1.33%) ⬇️
panel/util.py 86.41% <0.00%> (-0.76%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@philippjfr philippjfr merged commit d7abb94 into master Sep 15, 2022
@philippjfr philippjfr deleted the reactive_html_loop_callbacks branch September 15, 2022 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant