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

ToogleButtons : fix bug on empty list value #188

Merged
merged 3 commits into from Dec 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions panel/tests/test_widgets.py
Expand Up @@ -347,6 +347,9 @@ def test_toggle_buttons(document, comm):
select.value = [object, 'A']
assert widget.active == [2, 0]

widget.active = []
select._comm_change({'active': []})
assert select.value == []

def test_radio_buttons(document, comm):
select = RadioButtons(options=OrderedDict([('A', 'A'), ('1', 1), ('C', object)]),
Expand Down
4 changes: 2 additions & 2 deletions panel/widgets.py
Expand Up @@ -385,7 +385,7 @@ def _process_property_change(self, msg):
def _process_param_change(self, msg):
msg = super(Checkbox, self)._process_param_change(msg)
if 'value' in msg:
msg['active'] = [0] if msg.pop('value', None) else []
msg['active'] = [0] if msg.pop('value', None) else []
if 'title' in msg:
msg['labels'] = [msg.pop('title')]
return msg
Expand Down Expand Up @@ -443,7 +443,7 @@ def _process_param_change(self, msg):

def _process_property_change(self, msg):
msg = super(Select, self)._process_property_change(msg)
if msg.get('active', []):
if 'active' in msg:
msg['value'] = [list(self.options.values())[a] for a in msg.pop('active')]
return msg

Expand Down