-
Notifications
You must be signed in to change notification settings - Fork 268
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
[ACS-5556] [ACS-5557] [ACS-5558] [ACS-5559] [ACS-5602] [ACS-5603] mat-datepicker component added and removed old mat-datetimepicker component from UI #8749
Conversation
@@ -194,6 +193,7 @@ describe('CardViewDateItemComponent', () => { | |||
const itemUpdatedSpy = spyOn(cardViewUpdateService.itemUpdated$, 'next'); | |||
component.editable = true; | |||
component.property.editable = true; | |||
component.property.value = moment('Jul 10 2017', 'MMM DD YYYY').endOf('day').toDate(); |
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.
can this be date-fns ?
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.
yess converted to date-fns
@@ -355,23 +355,4 @@ describe('CardViewDateItemComponent', () => { | |||
expect(valueChips[1].nativeElement.innerText.trim()).toBe('Jul 11, 2017'); | |||
expect(valueChips[2].nativeElement.innerText.trim()).toBe('Jul 12, 2017'); | |||
}); | |||
|
|||
it('should render chips for multivalue datetimes when chips are enabled', async () => { |
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.
why this test is removed? do you plan adding a replacement?
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.
hi @DenysVuika I added this test case back again, earlier it was removed as I changed the datetime format to 'MMM d, y' so two test cases might went duplicate that was the reason of removing this.
@@ -22,7 +22,7 @@ import { CardViewDateItemProperties } from '../interfaces/card-view.interfaces'; | |||
|
|||
export class CardViewDatetimeItemModel extends CardViewDateItemModel implements CardViewItem, DynamicComponentModel { | |||
type: string = 'datetime'; | |||
format: string = 'MMM d, y, H:mm'; | |||
format: string = 'MMM d, y'; |
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.
the model file is called "datetime" model, and the "type" is called "datetime", so you can't drop the time from here
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 have again implemented tim here
ae00544
to
53a4d32
Compare
@@ -314,25 +333,9 @@ describe('CardViewDateItemComponent', () => { | |||
}); | |||
}); | |||
|
|||
it('should be possible update a date-time', async () => { |
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.
Why did you delete 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.
hi @nikita-web-ua i have not deleted this test, just modified it's name and added it's functionality in updateDateTIme() function to avoid duplication of code.
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.
Because we have 2 cases here now one with properties.cm:from
and other without properties.cm:from
82d3488
to
0df3e02
Compare
return expectedDate; | ||
}; | ||
|
||
//we will enable this test when will change from moment to date-fns throughout the application |
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'm wondering if we should raise jira for that or maybe correct it for now based on actual functionality instead of disabling that so then when functionality will be corrected then test can be corrected too. @MichalKinas what do you think?
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 can keep this test case with xit as of now. We will create a new Jira ticket to address this test case. Once we replace moment.js in whole application with date-fns we will adress the jira ticket. What do you think?
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 think it would be best not to create a partial PR for such a change. I believe the best approach would be to go through the whole ADF and replace it everywhere and then adjust all affected tests at once instead of disabling some of them. This approach makes it easier to miss something during testing phase, during unit test and e2e fixes and most importantly such a change shouldn't be merged partially as it may be released without being complete. cc @AleksanderSklorz @MateuszHY
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 agree with you @MichalKinas
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.
Agreed with @MichalKinas
@jatin2008 @rbahirsheth what do you think ?
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.
Hi, @MichalKinas I do agree with you. We found some occurrences in the codebase but we could not find out the UI. We will analyze it. But, This PR is also part of the calendar replacement.
super(); | ||
this.dateFormat = this.appConfig.get('dateValues.defaultDateFormat'); | ||
// need to change this to app.config when will change from moment to date-fns throughout the application |
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.
Do we have jira for this comment? We can forget about that without jira
@jatin2008 @rbahirsheth did you check accessibility after changes introduced here? |
@@ -154,4 +152,8 @@ export class CardViewDateItemComponent extends BaseCardView<CardViewDateItemMode | |||
update() { | |||
this.cardViewUpdateService.update({ ...this.property } as CardViewDateItemModel, this.property.value); | |||
} | |||
|
|||
getDateValue(newDateValue): 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.
missing type for newDateValue
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 are calling our method from onDateChanged() & this method is triggering on the date change from UI. This method accepts the $event object & does not use type in this method too. We can use MatDatepickerInputEvent<any, any> type here. Is it fine?
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.
If function takes $event as parameter then type of parameter should be type of $event. You can check $event type very easily. For example:
here you have dateChange event so you can check what it emits:
You see that it emits MatDatepickerInputEvent<D, S> so please use that type in every function.
Also please check if we really need to use <any, any> or maybe we can use better types in <>
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.
hi @AleksanderSklorz added type here as MatDatepickerInputEvent<any, any> for $event, also checked and found any as the best supported type here.
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.
@jatin2008 based on what information you think that any
is the best supported type? That's not true, please go through the documentation https://material.angular.io/components/datepicker/overview especially the section with change event
to check what type should be used here
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.
Btw any
is against strongly typed TypeScript code, it's basically antipattern that we should avoid as much as we can, so please update your knowledge about best practices for TS
hi @MateuszHY we have checked and not found any accessibility issue in the new datepicker component added and also added a new test case for the changes we made. |
…cedComponent. Added config for using the new components
… search query on submit. Added optional property to disable update on submit button click for widget-composite.
…chFilterTabbedComponent
…ponent and SearchFilterTabbedComponent to SearchDateRangeAdvancedTabbedComponent. Updated test cases accordingly
… 'Between' options use the start date to end date query format
…ng some numbers in the 'In the last' input field would clear out the field
…s for e2e test cases
…epicker calendar now.
…ified test cases for the component.
75429b2
to
ef0b2ae
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
private clipboardService: ClipboardService, | ||
private translateService: TranslationService) { | ||
private translateService: TranslationService, | ||
@Inject(MAT_DATE_FORMATS) private dateFormatConfig: MatDateFormats) { |
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.
never ever do this, this is a singleton access to all the date time formats, changing it will change all components
closing as abandoned and of poor quality |
Please check if the PR fulfills these requirements
What kind of change does this PR introduce? (check one with "x")
What is the current behaviour? (You can also link to an open issue here)
old mat-datetimePicker component is being used in the UI
What is the new behaviour?
Added new date-timepicker component and removed old mat-datetimePicker component
Does this PR introduce a breaking change? (check one with "x")
If this PR contains a breaking change, please describe the impact and migration path for existing applications: ...
Other information:
Jira id - https://alfresco.atlassian.net/browse/ACS-5557
Images for new datetime-picker