-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Conversation
src/components/CalendarMonth.jsx
Outdated
@@ -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} |
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.
Doesn't it make more sense to return null in getCalendarMonthWeeks
?
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.
Makes sense, moved to getCalendarMonthWeeks
and added specs
2012ea9
to
6119d48
Compare
6119d48
to
04ee39c
Compare
04ee39c
to
f99af7d
Compare
describe('padding when enableOutsideDays is false', () => { | ||
let weeksWithPadding; | ||
|
||
before(() => { |
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.
this should use beforeEach
- before
means "before all" so it only runs once.
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.
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.
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.
We shouldn't worry about perf in tests; before
should always be avoided.
to: @majapw @ljharb
Small PropType fix for my previous CalendarDay PR. In
CalendarMonth
,day
isfalse
instead of a moment object for outside days, which fails PropType checks.