Skip to content
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/lib/sort/sort.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,12 +403,20 @@ function testSingleColumnSortDirectionSequence(fixture: ComponentFixture<SimpleM
component.matSort.direction = '';

// Run through the sequence to confirm the order
let actualSequence = expectedSequence.map(() => {
let actualSequence = expectedSequence.map((currentSequence) => {
component.sort(id);


// Check that the sort event's active sort is consistent with the MatSort
expect(component.matSort.active).toBe(id);
expect(component.latestSortEvent.active).toBe(id);
if (currentSequence) {
expect(component.matSort.active).toBe(id);
expect(component.latestSortEvent.active).toBe(id);
} else {
// For empty sequence the mat sort active should be empty
expect(component.matSort.active).toBe('');
expect(component.latestSortEvent.active).toBe('');
}


// Check that the sort event's direction is consistent with the MatSort
expect(component.matSort.direction).toBe(component.latestSortEvent.direction);
Expand Down
4 changes: 3 additions & 1 deletion src/lib/sort/sort.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ export class MatSort extends _MatSortMixinBase
} else {
this.direction = this.getNextSortDirection(sortable);
}

if (!this.direction) {
this.active = '';
}
this.sortChange.emit({active: this.active, direction: this.direction});
}

Expand Down