Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Material Design for Angular
# Material Design for Angular test
[![npm version](https://badge.fury.io/js/%40angular%2Fmaterial.svg)](https://www.npmjs.com/package/%40angular%2Fmaterial)
[![Build status](https://circleci.com/gh/angular/material2.svg?style=svg)](https://circleci.com/gh/angular/material2)
[![Gitter](https://badges.gitter.im/angular/material2.svg)](https://gitter.im/angular/material2?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
Expand Down
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
8 changes: 5 additions & 3 deletions src/lib/sort/sort.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ export class MatSort extends _MatSortMixinBase
/** Used to notify any child components listening to state changes. */
readonly _stateChanges = new Subject<void>();

/** The id of the most recently sorted MatSortable. */
@Input('matSortActive') active: string;
/** The id of the sorted MatSortable. */
@Input('matSortActive') active: string = '';

/**
* The direction to set when an MatSortable is initially sorted.
Expand Down 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