Skip to content

Commit

Permalink
chore: fix some typing errors (#29630)
Browse files Browse the repository at this point in the history
### Parent Issue
#29635

### Proposed Changes
* Fix some type errors
* Fix typing error handling input event

<img width="1109" alt="Screenshot 2024-08-19 at 9 38 49 AM"
src="https://github.com/user-attachments/assets/7521e4eb-cc4b-4f93-a679-6f498fbdee73">


### Checklist
- [x] Tests
- [x] Translations
- [x] Security Implications Contemplated (add notes if applicable)
  • Loading branch information
nicobytes authored Aug 19, 2024
1 parent 325cd51 commit 600b4f3
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
<div class="category_listing">
<p-table
(onLazyLoad)="loadCategories($event)"
(onRowSelect)="handleRowCheck($event)"
(onRowUnselect)="handleRowCheck($event)"
(onHeaderCheckboxToggle)="handleRowCheck($event)"
(onRowSelect)="handleRowCheck()"
(onRowUnselect)="handleRowCheck()"
(onHeaderCheckboxToggle)="handleRowCheck()"
(onFilter)="handleFilter()"
[(selection)]="selectedCategories"
[value]="vm.categories"
Expand All @@ -35,7 +35,7 @@
type="button"
pButton
icon="pi pi-ellipsis-v"
attr.data-testId="actions"></button>
data-testId="actions"></button>
<p-menu
[popup]="true"
[model]="vm.categoriesBulkActions"
Expand All @@ -48,10 +48,10 @@
<i class="pi pi-search"></i>
</span>
<input
(input)="dataTable.filterGlobal($event.target.value, 'contains')"
[placeholder]="'message.category.search' | dm"
class="border-left-none"
#gf
(input)="dataTable.filterGlobal(gf.value, 'contains')"
type="text"
pInputText />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<dot-content-type-selector
(selected)="changeContentTypeSelector($event)"></dot-content-type-selector>
<input
(input)="handleQueryFilter($event.target.value)"
(keydown.arrowdown)="focusFirstRow()"
#gf
(input)="handleQueryFilter(gf.value)"
pInputText
placeholder="{{ 'Type-to-filter' | dm }}"
type="text"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ export class DotEditPageViewAsControllerSeoComponent implements OnInit {
private confirmationService = inject(ConfirmationService);

private readonly customEventsHandler;
dotPageStateService = inject(DotPageStateService);

constructor(
private dotAlertConfirmService: DotAlertConfirmService,
private dotMessageService: DotMessageService,
private dotLicenseService: DotLicenseService,
private dotPageStateService: DotPageStateService,
private dotPersonalizeService: DotPersonalizeService,
private router: Router
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
<div class="dot-pages-listing-header__inputs">
<div class="p-input-icon-right">
<input
(input)="filterData($event.target.value)"
[placeholder]="'Type-To-Search' | dm"
[value]="vm.keywordValue"
class="dot-pages-listing-header__filter-input"
#input
(input)="filterData(input.value)"
data-testid="dot-pages-listing-header__keyword-input"
type="text"
pInputText
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,9 @@ describe('DotPagesListingPanelComponent', () => {

it('should send event to filter keyword', () => {
const elem = de.query(By.css('.dot-pages-listing-header__inputs input'));
elem.triggerEventHandler('input', { target: { value: 'test' } });
elem.nativeElement.focus();
elem.nativeElement.value = 'test';
elem.triggerEventHandler('input');

expect(store.setKeyword).toHaveBeenCalledWith('test');
expect(store.getPages).toHaveBeenCalledWith({ offset: 0 });
Expand All @@ -239,7 +241,9 @@ describe('DotPagesListingPanelComponent', () => {

it('should send event to filter keyword when cleaning', () => {
const elem = de.query(By.css('.dot-pages-listing-header__inputs input'));
elem.triggerEventHandler('input', { target: { value: 'test' } });
elem.nativeElement.focus();
elem.nativeElement.value = 'test';
elem.triggerEventHandler('input');

const elemClean = de.query(
By.css('[data-testid="dot-pages-listing-header__keyword-input-clear"]')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
type="button"
pButton
icon="pi pi-ellipsis-v"
attr.data-testid="bulkActions"></button>
data-testid="bulkActions"></button>
</div>
<p-menu [popup]="true" [model]="templateBulkActions" #actionsMenu appendTo="body"></p-menu>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ export class DotTemplateListComponent implements OnInit, OnDestroy {
* @param {DotTemplate} { template }
* @memberof DotTemplateListComponent
*/
editTemplate(template: DotTemplate): void {
editTemplate(event: unknown): void {
const template = event as DotTemplate;
this.isTemplateAsFile(template)
? this.dotSiteBrowserService.setSelectedFolder(template.identifier).subscribe(() => {
this.dotRouterService.goToSiteBrowser();
Expand All @@ -139,7 +140,8 @@ export class DotTemplateListComponent implements OnInit, OnDestroy {
*
* @memberof DotTemplateListComponent
*/
updateSelectedTemplates(templates: DotTemplate[]): void {
updateSelectedTemplates(event: unknown): void {
const templates = event as DotTemplate[];
this.selectedTemplates = templates;
}

Expand Down Expand Up @@ -174,7 +176,8 @@ export class DotTemplateListComponent implements OnInit, OnDestroy {
* @param {DotTemplate} template
* @memberof DotTemplateListComponent
*/
setContextMenu(template: DotTemplate): void {
setContextMenu(event: unknown): void {
const template = event as DotTemplate;
this.listing.contextMenuItems = this.setTemplateActions(template).map(
({ menuItem }: DotActionMenuItem) => menuItem
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<dot-action-header [options]="actionHeaderOptions">
<ng-container [ngTemplateOutlet]="beforeSearchTemplate"></ng-container>
<input
(input)="dataTable.filterGlobal($event.target.value, 'contains')"
(keydown.arrowdown)="focusFirstRow()"
[(ngModel)]="filter"
#gf
(input)="dataTable.filterGlobal(gf.value, 'contains')"
pInputText
placeholder="{{ 'Type-to-filter' | dm }}"
type="text" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ const PrimaryTemplate = `
<input
pInputText
type="text"
(input)="dt.filterGlobal($event.target.value, 'contains')"
#inputElement
(input)="dt.filterGlobal(inputElement.value, 'contains')"
placeholder="Global Search"
/>
</span>
Expand Down

0 comments on commit 600b4f3

Please sign in to comment.