Skip to content

fix: ensure custom sort icons become applied#703

Closed
chintankavathia wants to merge 1 commit into
siemens:mainfrom
chintankavathia:fix/sort-icons/class
Closed

fix: ensure custom sort icons become applied#703
chintankavathia wants to merge 1 commit into
siemens:mainfrom
chintankavathia:fix/sort-icons/class

Conversation

@chintankavathia

@chintankavathia chintankavathia commented Jun 9, 2026

Copy link
Copy Markdown
Member

ensure consumers can provide multiple classes for a single sort direction

class binding support array but doesn't allow spaces for array items. In that case nothing become applied

What kind of change does this PR introduce? (check one with "x")

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior? (You can also link to an open issue here)

What is the new behavior?

Does this PR introduce a breaking change? (check one with "x")

  • Yes
  • No

If this PR contains a breaking change, please describe the impact and migration path for existing applications: ...

Other information:

ensure consumers can provide multiple classes for a single sort direction
@chintankavathia chintankavathia requested a review from a team as a code owner June 9, 2026 06:30
@chintankavathia

Copy link
Copy Markdown
Member Author

@spliffone

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the DataTableHeaderCellComponent to return sortClass as a space-separated string instead of an array, and adds a new test suite to verify custom sort icons using Vitest's browser context. A review comment correctly identifies a compilation issue where inputBinding and outputBinding are incorrectly imported from @angular/core instead of @angular/core/testing.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +2 to 12
import {
AfterViewInit,
Component,
inputBinding,
outputBinding,
signal,
TemplateRef,
viewChild,
WritableSignal
} from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

In Angular 18.2+, inputBinding and outputBinding are exported from @angular/core/testing, not @angular/core. Importing them from @angular/core will cause a compilation error. Please move these imports to @angular/core/testing.

import {
  AfterViewInit,
  Component,
  signal,
  TemplateRef,
  viewChild,
  WritableSignal
} from '@angular/core';
import { ComponentFixture, TestBed, inputBinding, outputBinding } from '@angular/core/testing';

@fh1ch fh1ch added the bug Something isn't working label Jun 9, 2026
@fh1ch fh1ch requested a review from Copilot June 9, 2026 08:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes sort icon class application in DataTableHeaderCellComponent so consumers can supply multiple CSS classes (space-separated) for custom sort icons without Angular treating them as a single invalid class token.

Changes:

  • Convert computed sortClass from string[] to a space-delimited string for correct [class] binding.
  • Add unit tests covering custom ascending/descending sort icon class application.
  • Update spec tsconfig types to include Vitest browser typings used by the new tests.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
projects/ngx-datatable/tsconfig.spec.json Adds vitest/browser typings to support browser-mode test utilities/types.
projects/ngx-datatable/src/lib/components/header/header-cell.component.ts Fixes [class] binding by joining sort class arrays into a single space-delimited string.
projects/ngx-datatable/src/lib/components/header/header-cell.component.spec.ts Adds regression tests ensuring multi-class custom sort icon strings are applied correctly.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +203 to +205
});
await fixture.whenStable();
});
protected readonly sortClass = computed<string[] | undefined>(() => {
return this.calcSortClass(this.sortDir());
protected readonly sortClass = computed<string | undefined>(() => {
return this.calcSortClass(this.sortDir())?.join(' ');

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please move the join inside calcSortClass and please either inline the function then or at least convert to an arrow function without {}

@chintankavathia

Copy link
Copy Markdown
Member Author

closing in favor of #704

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants