This repository has been archived by the owner on Jun 3, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 145
Use start date, if one is supplied, for initial_visible_month. #687
Merged
Merged
Changes from 5 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
f5afd37
Use start_date or min_date_allowed for initial_visible_month if initi…
3c05f58
Add test for initial month.
1411016
Add datePickerRange tests.
bbd3b76
Use max date allowed
416089a
Merge branch 'dev' into 679-initial-visible-month
cbc6747
Merge branch 'dev' into 679-initial-visible-month
cc1b61a
Make function call simpler.
c1bbde2
Run linter.
0a95607
Fix typo.
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
from datetime import datetime | ||
|
||
import dash | ||
import dash_html_components as html | ||
import dash_core_components as dcc | ||
|
||
|
||
def test_dtpr001_initial_month_provided(dash_dcc): | ||
app = dash.Dash(__name__) | ||
app.layout = html.Div([ | ||
dcc.DatePickerRange( | ||
id="dps-initial-month", | ||
min_date_allowed=datetime(2010, 1, 1), | ||
max_date_allowed=datetime(2099, 12, 31), | ||
initial_visible_month=datetime(2019, 10, 28) | ||
) | ||
]) | ||
|
||
dash_dcc.start_server(app) | ||
|
||
date_picker_start = dash_dcc.find_element( | ||
'#dps-initial-month .DateInput_input.DateInput_input_1[placeholder="Start Date"]' | ||
) | ||
date_picker_start.click() | ||
|
||
dash_dcc.wait_for_text_to_equal( | ||
'#dps-initial-month .CalendarMonth.CalendarMonth_1[data-visible=true] strong', | ||
'October 2019', | ||
1 | ||
) | ||
|
||
|
||
def test_dtpr002_no_initial_month_min_date(dash_dcc): | ||
app = dash.Dash(__name__) | ||
app.layout = html.Div([ | ||
dcc.DatePickerRange( | ||
id="dps-initial-month", | ||
min_date_allowed=datetime(2010, 1, 1), | ||
max_date_allowed=datetime(2099, 12, 31) | ||
) | ||
]) | ||
|
||
dash_dcc.start_server(app) | ||
|
||
date_picker_start = dash_dcc.find_element( | ||
'#dps-initial-month .DateInput_input.DateInput_input_1[placeholder="Start Date"]' | ||
) | ||
date_picker_start.click() | ||
|
||
dash_dcc.wait_for_text_to_equal( | ||
'#dps-initial-month .CalendarMonth.CalendarMonth_1[data-visible=true] strong', | ||
'January 2010' | ||
) | ||
|
||
|
||
def test_dtpr003_no_initial_month_no_min_date_start_date(dash_dcc): | ||
app = dash.Dash(__name__) | ||
app.layout = html.Div([ | ||
dcc.DatePickerRange( | ||
id="dps-initial-month", | ||
start_date=datetime(2019, 8, 13), | ||
max_date_allowed=datetime(2099, 12, 31) | ||
) | ||
]) | ||
|
||
dash_dcc.start_server(app) | ||
|
||
date_picker_start = dash_dcc.find_element( | ||
'#dps-initial-month .DateInput_input.DateInput_input_1[placeholder="Start Date"]' | ||
) | ||
date_picker_start.click() | ||
|
||
dash_dcc.wait_for_text_to_equal( | ||
'#dps-initial-month .CalendarMonth.CalendarMonth_1[data-visible=true] strong', | ||
'August 2019' | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Since
moment()
andmoment(undefined)
are equivalent (but notmoment(null)
🙄), this can be simplified to: