-
Notifications
You must be signed in to change notification settings - Fork 140
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
Adding time picker component #654
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @mikegiann01!
Great to see another PR from you. I had a couple of comments:
- Could you include some tests for the component? You can take a look at https://github.com/widgetti/solara/blob/master/tests/unit/input_date_test.py for some guidance
- I wonder if we should add an argument for using seconds in the picker? Do you think without it we already cover 99% of use cases, or that it would see some use? @maartenbreddels and @mariobuikhuizen feel free to weigh in as well.
- I think we should also expose some of the restrictions on allowed inputs from Vuetify. At least
allowed_minutes
I could see people using, when they only want to allow picking in 15/30 minute intervals.
Co-authored-by: Iisakki Rotko <[email protected]>
Co-authored-by: Iisakki Rotko <[email protected]>
should i create a new PR the tests? |
No need, preferably add the tests to this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only one comment on the tests. I also noticed that some of the previous comments I had were marked resolved but no changes were made to the code. Did you maybe forget to push some changes to the component itself?
def test_input_time_on_open_value(): | ||
on_open_value = MagicMock() | ||
on_value = MagicMock() | ||
el = InputTime(value=now, label="label", on_value=on_value, on_open_value=on_open_value) | ||
box, rc = solara.render(el, handle_error=False) | ||
menu = rc.find(vw.Menu) | ||
assert menu is not None | ||
|
||
# Simulate opening the time picker | ||
menu.widget.v_model = True | ||
assert on_open_value.call_count == 1 | ||
assert on_open_value.call_args[0][0] is True | ||
|
||
# Simulate closing the time picker | ||
menu.widget.v_model = False | ||
assert on_open_value.call_count == 2 | ||
assert on_open_value.call_args[0][0] is False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be tested by clicking on the input element, rather than by directly opening the menu?
86646f5
to
df2fd66
Compare
Hello!Created a time picker component, working also on input_timerange component