Skip to content

Commit

Permalink
let FileInput widget set filename (#956)
Browse files Browse the repository at this point in the history
  • Loading branch information
ltalirz authored and philippjfr committed Jan 18, 2020
1 parent 9babb7c commit 2a53244
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion panel/tests/widgets/test_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,11 @@ def test_file_input(document, comm):

assert isinstance(widget, BkFileInput)

file_input._comm_change({'mime_type': 'text/plain', 'value': 'U29tZSB0ZXh0Cg=='})
file_input._comm_change({'mime_type': 'text/plain', 'value': 'U29tZSB0ZXh0Cg==', 'filename': 'testfile'})
assert file_input.value == b'Some text\n'
assert file_input.mime_type == 'text/plain'
assert file_input.accept == '.txt'
assert file_input.filename == 'testfile'


def test_literal_input(document, comm):
Expand Down
2 changes: 1 addition & 1 deletion panel/widgets/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def _process_param_change(self, msg):

def _filter_properties(self, properties):
properties = super(FileInput, self)._filter_properties(properties)
return properties + ['value', 'mime_type']
return properties + ['value', 'mime_type', 'filename']

def _process_property_change(self, msg):
msg = super(FileInput, self)._process_property_change(msg)
Expand Down

0 comments on commit 2a53244

Please sign in to comment.