-
Notifications
You must be signed in to change notification settings - Fork 11
Conversation
Codecov Report
@@ Coverage Diff @@
## master #29 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 17 17
Lines 748 788 +40
Branches 132 143 +11
=====================================
+ Hits 748 788 +40
Continue to review full report at Codecov.
|
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.
Great work. Mostly, I have some questions around changing the public properties.
@@ -419,6 +421,22 @@ describe('datepicker calendar', () => { | |||
|
|||
}); | |||
|
|||
it('should handle setting selected date asynchronously', fakeAsync(function () { |
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.
I might be missing something obvious, but how is this asynchronous? Also, you do very similar things in previous tests - I'm not sure what's different about this test...
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.
It's a badly named unit test. I'll update the name so it makes more sense.
src/app/public/modules/datepicker/datepicker-input.directive.ts
Outdated
Show resolved
Hide resolved
src/app/public/modules/datepicker/datepicker-input.directive.ts
Outdated
Show resolved
Hide resolved
this._startingDay = value; | ||
} | ||
@ViewChild(SkyDatepickerCalendarComponent) | ||
private calendar: SkyDatepickerCalendarComponent; |
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 changed from public
to private
- was that intentional?
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.
Yep! This is only useful to the internal workings of the datepicker component (and not being referenced anywhere else).
|
||
@ViewChild(SkyDropdownComponent) | ||
public dropdown: SkyDropdownComponent; |
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.
Just checking - was removing this public
property deliberate?
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.
It was. It's not being accessed anywhere within the datetime
library.
|
||
public dateSelected(newDate: Date) { |
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.
Removing a public property. Is this deliberate?
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 was renamed to onSelectedDateChange
to match our style guidelines (it was only being called from the datepicker's template).
|
||
public setSelectedDate(newDate: Date) { |
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.
Removing a public property. Is this deliberate?
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.
I switched the public method to a setter field (public set selectedDate
). It was only being used by the datepicker-input
directive.
|
||
public setMinDate(_minDate: Date) { |
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.
Re: setMinDate
/ setMaxDate
. I see you removed these references from the directive's OnChanges
, but these are still public properties. Was removing these deliberate?
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.
It was; we're not documenting these methods, and I would argue that if someone is using these directly, it's not the intent of the API.
Also, do we have an issue to update the docs/demo with the API changes? |
I created blackbaud/skyux2-docs#399 to make sure we update the docs. ... Do we need another issue in the |
@blackbaud-johnly thanks! Yes, I'd think so. We're deprecating a major part of how this API is used, so the demo should probably reflect that. |
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.
Initial thoughts
public ngOnChanges(changes: SimpleChanges): void { | ||
if (changes.minDate) { | ||
this.onValidatorChange(); | ||
this.datepickerComponent.minDate = this.minDate; |
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.
Is there a reason that we aren't just doing these things in the setters for the property? Seems like we could if we are going to the getters/setters for all of these properties.
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.
Good call.
import { Subject } from 'rxjs/Subject'; | ||
|
||
import { SkyDatepickerCalendarComponent } from './datepicker-calendar.component'; | ||
|
||
import { |
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.
Shouldn't our libraries be below rxjs
in the import ordering.
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.
@skyux
is on the same "level" as rxjs
. I'm going with alphabetical order based on that.
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.
Ok. I have always went with Angular -> Third party libraries -> Blackbaud libraries -> internal things. But I also see your logic :) Not a huge deal.
} from '@angular/forms'; | ||
|
||
@Component({ | ||
selector: 'datepicker-visual', | ||
templateUrl: './datepicker-visual.component.html' | ||
}) | ||
export class DatepickerVisualComponent implements OnInit { | ||
public selectedDate: Date = new Date('4/4/2017'); | ||
public disabled = false; |
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.
Should we have a blank line before these public variables?
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.
I could go either way. We can come up with a style guide if you like.
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.
I personally like the line break and feel like it is more consistent with our other styles; however, I wouldn't consider it a blocker.
I created blackbaud/skyux2#2335 to update the demo. |
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.
LGTM
onChange
calls when datepicker value is changed.selectedDate
assignments.AbstractControl
to set appropriate values fordirty
,touched
, andinvalid
.