Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Issue434 - Clear date in DatePickerSingle and DatePickerRange #435

Merged
merged 7 commits into from
Jan 23, 2019

Conversation

Marc-Andre-Rivet
Copy link
Contributor

@Marc-Andre-Rivet Marc-Andre-Rivet commented Jan 11, 2019

Fixes #434

Currently, DatePickerSingle and DatePickerRange do not process null dates correctly.

Handle the null case by assigning the value as-is to the underlying react-dates component instead of wrapping it with moment.

@@ -2789,6 +2789,9 @@
},
{
"name": "string"
},
{
"name": "bool"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In some previous commit the metadata was not updated correctly.

@@ -22,6 +22,8 @@ import Tab from './components/Tab.react';
import Store from './components/Store.react';
import LogoutButton from './components/LogoutButton.react';

import './components/css/[email protected]';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving this style dependency to the top level -- jest is not able to handle css files correctly atm

case 'Undefined':
return;
case 'Null':
dest[key] = null;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Common logic between Single and Range + the new Null case

expect(dps.props().start_date).toEqual(props.start_date);
expect(dps.state().start_date).not.toEqual(null);
});
});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basic tests for range: passing null sets null in the state, otherwise it sets a value (do not care about the exact value atm, just differentiating the 2 cases)

expect(dps.props()).toBeDefined();
expect(dps.props().date).toEqual(props.date);
expect(dps.state().date).not.toEqual(null);
});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basic tests for single: passing null sets null in the state, otherwise it sets a value (do not care about the exact value atm, just differentiating the 2 cases)

Copy link
Collaborator

@alexcjohnson alexcjohnson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, nice fix, nice tests, nice 🌴

💃

Marc-André Rivet added 2 commits January 23, 2019 10:16
…-clear-date

# Conflicts:
#	CHANGELOG.md
#	dash_core_components/dash_core_components.dev.js
#	dash_core_components/dash_core_components.dev.js.map
#	dash_core_components/dash_core_components.min.js
#	dash_core_components/dash_core_components.min.js.map
@Marc-Andre-Rivet Marc-Andre-Rivet merged commit 674fd07 into master Jan 23, 2019
@alexcjohnson alexcjohnson deleted the issue434-datepicker-clear-date branch January 23, 2019 16:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants