Skip to content

Avoid passing false as day#305

Merged
majapw merged 1 commit intoreact-dates:masterfrom
moonboots:fix-boolean-days
Feb 7, 2017
Merged

Avoid passing false as day#305
majapw merged 1 commit intoreact-dates:masterfrom
moonboots:fix-boolean-days

Conversation

@moonboots
Copy link
Copy Markdown
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
Copy Markdown

Coverage Status

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

Comment thread src/components/CalendarMonth.jsx Outdated
{week.map((day, dayOfWeek) => (
<CalendarDay
day={day}
day={day ? day : null}
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown

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
Copy Markdown

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
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

4 participants