@@ -206,6 +206,44 @@ describe('DsDatePickerComponent test suite', () => {
206206 } ) ;
207207 } ) ;
208208
209+ describe ( 'when init model value is a Date object' , ( ) => {
210+ beforeEach ( ( ) => {
211+ dateFixture = TestBed . createComponent ( DsDatePickerComponent ) ;
212+ dateComp = dateFixture . componentInstance ;
213+ dateComp . group = DATE_TEST_GROUP ;
214+ dateComp . model = new DynamicDsDatePickerModel ( DATE_TEST_MODEL_CONFIG ) ;
215+ dateComp . model . value = new Date ( Date . UTC ( 1983 , 10 , 18 ) ) ;
216+ dateFixture . detectChanges ( ) ;
217+ } ) ;
218+
219+ it ( 'should init component properly from a Date object' , ( ) => {
220+ expect ( dateComp . year ) . toBe ( 1983 ) ;
221+ expect ( dateComp . month ) . toBe ( 11 ) ;
222+ expect ( dateComp . day ) . toBe ( 18 ) ;
223+ expect ( dateComp . disabledMonth ) . toBeFalsy ( ) ;
224+ expect ( dateComp . disabledDay ) . toBeFalsy ( ) ;
225+ } ) ;
226+ } ) ;
227+
228+ describe ( 'when init model value is a NgbDateStruct-like object' , ( ) => {
229+ beforeEach ( ( ) => {
230+ dateFixture = TestBed . createComponent ( DsDatePickerComponent ) ;
231+ dateComp = dateFixture . componentInstance ;
232+ dateComp . group = DATE_TEST_GROUP ;
233+ dateComp . model = new DynamicDsDatePickerModel ( DATE_TEST_MODEL_CONFIG ) ;
234+ dateComp . model . value = { year : 1983 , month : 11 , day : 18 } ;
235+ dateFixture . detectChanges ( ) ;
236+ } ) ;
237+
238+ it ( 'should init component properly from a NgbDateStruct-like object' , ( ) => {
239+ expect ( dateComp . year ) . toBe ( 1983 ) ;
240+ expect ( dateComp . month ) . toBe ( 11 ) ;
241+ expect ( dateComp . day ) . toBe ( 18 ) ;
242+ expect ( dateComp . disabledMonth ) . toBeFalsy ( ) ;
243+ expect ( dateComp . disabledDay ) . toBeFalsy ( ) ;
244+ } ) ;
245+ } ) ;
246+
209247 describe ( 'when init model value is not empty' , ( ) => {
210248 beforeEach ( ( ) => {
211249
0 commit comments