Skip to content

Commit

Permalink
Ensure FloatPanel reflects closed status (#5466)
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr authored Sep 1, 2023
1 parent 92e3982 commit 4c716bb
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
4 changes: 4 additions & 0 deletions panel/layout/float.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ class FloatPanel(ListLike, ReactiveHTML):
contentSize: `${model.width} ${model.height}`,
onstatuschange: function() {
data.status = this.status
},
onbeforeclose: function() {
data.status = 'closed'
return true
}
}
if (data.contained) {
Expand Down
27 changes: 27 additions & 0 deletions panel/tests/ui/layout/test_floatpanel.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import time

import pytest

from panel import FloatPanel, Spacer
from panel.io.server import serve

pytestmark = pytest.mark.ui

def test_float_panel_closed_status(page, port):
float_panel = FloatPanel(
Spacer(styles=dict(background='red'), width=200, height=200),
Spacer(styles=dict(background='green'), width=200, height=200),
Spacer(styles=dict(background='blue'), width=200, height=200),
)

serve(float_panel, port=port, threaded=True, show=False)

time.sleep(0.2)

page.goto(f"http://localhost:{port}")

page.locator('.jsPanel-btn-close').click()

time.sleep(0.2)

assert float_panel.status == 'closed'

0 comments on commit 4c716bb

Please sign in to comment.