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

Avoid passing false as day #305

Merged
merged 1 commit into from
Feb 7, 2017
Merged

Conversation

moonboots
Copy link
Collaborator

to: @majapw @ljharb

Small PropType fix for my previous CalendarDay PR. In CalendarMonth, day is false instead of a moment object for outside days, which fails PropType checks.

screen shot 2017-02-07 at 12 11 17 pm

@coveralls
Copy link

Coverage Status

Coverage remained the same at 86.501% when pulling 2012ea9 on moonboots:fix-boolean-days into 8a0c56d on airbnb:master.

@@ -100,7 +100,7 @@ export default class CalendarMonth extends React.Component {
<tr key={i}>
{week.map((day, dayOfWeek) => (
<CalendarDay
day={day}
day={day ? day : null}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Doesn't it make more sense to return null in getCalendarMonthWeeks?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Makes sense, moved to getCalendarMonthWeeks and added specs

@coveralls
Copy link

Coverage Status

Coverage remained the same at 86.501% when pulling 6119d48 on moonboots:fix-boolean-days into 8a0c56d on airbnb:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 86.501% when pulling f99af7d on moonboots:fix-boolean-days into 8a0c56d on airbnb:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 86.501% when pulling f99af7d on moonboots:fix-boolean-days into 8a0c56d on airbnb:master.

@majapw majapw merged commit 8d67526 into react-dates:master Feb 7, 2017
describe('padding when enableOutsideDays is false', () => {
let weeksWithPadding;

before(() => {
Copy link
Member

Choose a reason for hiding this comment

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

this should use beforeEach - before means "before all" so it only runs once.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

beforeEach would work too, but here I intended the before all behavior because I'm not mutating this variable. I wrapped in a before block instead of defining up top like the other variables as a minor perf improvement to avoid running if .only(...) was used elsewhere.

Copy link
Member

Choose a reason for hiding this comment

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

We shouldn't worry about perf in tests; before should always be avoided.

@moonboots moonboots deleted the fix-boolean-days branch February 8, 2017 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants