"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/lib/sort/sort.spec.ts" between
material2-7.3.3.tar.gz and material2-7.3.4.tar.gz

About: material2 offers Material Design components for Angular.

sort.spec.ts  (material2-7.3.3):sort.spec.ts  (material2-7.3.4)
skipping to change at line 33 skipping to change at line 33
} from './index'; } from './index';
import { import {
getSortDuplicateSortableIdError, getSortDuplicateSortableIdError,
getSortHeaderMissingIdError, getSortHeaderMissingIdError,
getSortHeaderNotContainedWithinSortError, getSortHeaderNotContainedWithinSortError,
getSortInvalidDirectionError, getSortInvalidDirectionError,
} from './sort-errors'; } from './sort-errors';
describe('MatSort', () => { describe('MatSort', () => {
let fixture: ComponentFixture<SimpleMatSortApp>; let fixture: ComponentFixture<SimpleMatSortApp>;
let component: SimpleMatSortApp; let component: SimpleMatSortApp;
beforeEach(async(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
imports: [MatSortModule, MatTableModule, CdkTableModule, NoopAnimationsMod ule], imports: [MatSortModule, MatTableModule, CdkTableModule, NoopAnimationsMod ule],
declarations: [ declarations: [
SimpleMatSortApp, SimpleMatSortApp,
CdkTableMatSortApp, CdkTableMatSortApp,
MatTableMatSortApp, MatTableMatSortApp,
MatSortHeaderMissingMatSortApp, MatSortHeaderMissingMatSortApp,
skipping to change at line 386 skipping to change at line 385
const header = fixture.debugElement.query(By.directive(MatSortHeader)).nat iveElement; const header = fixture.debugElement.query(By.directive(MatSortHeader)).nat iveElement;
const button = header.querySelector('.mat-sort-header-button'); const button = header.querySelector('.mat-sort-header-button');
intl.sortButtonLabel = () => 'Sort all of the things'; intl.sortButtonLabel = () => 'Sort all of the things';
intl.changes.next(); intl.changes.next();
fixture.detectChanges(); fixture.detectChanges();
expect(button.getAttribute('aria-label')).toBe('Sort all of the things'); expect(button.getAttribute('aria-label')).toBe('Sort all of the things');
}) })
); );
it('should not render the arrow if sorting is disabled for that column', fakeA
sync(() => {
const sortHeaderElement = fixture.nativeElement.querySelector('#defaultA');
// Switch sorting to a different column before asserting.
component.sort('defaultB');
fixture.componentInstance.disabledColumnSort = true;
fixture.detectChanges();
tick();
fixture.detectChanges();
expect(sortHeaderElement.querySelector('.mat-sort-header-arrow')).toBeFalsy(
);
}));
it('should render the arrow if a disabled column is being sorted by', fakeAsyn
c(() => {
const sortHeaderElement = fixture.nativeElement.querySelector('#defaultA');
component.sort('defaultA');
fixture.componentInstance.disabledColumnSort = true;
fixture.detectChanges();
tick();
fixture.detectChanges();
expect(sortHeaderElement.querySelector('.mat-sort-header-arrow')).toBeTruthy
();
}));
}); });
/** /**
* Performs a sequence of sorting on a single column to see if the sort directio ns are * Performs a sequence of sorting on a single column to see if the sort directio ns are
* consistent with expectations. Detects any changes in the fixture to reflect a ny changes in * consistent with expectations. Detects any changes in the fixture to reflect a ny changes in
* the inputs and resets the MatSort to remove any side effects from previous te sts. * the inputs and resets the MatSort to remove any side effects from previous te sts.
*/ */
function testSingleColumnSortDirectionSequence(fixture: ComponentFixture<SimpleM atSortApp>, function testSingleColumnSortDirectionSequence(fixture: ComponentFixture<SimpleM atSortApp>,
expectedSequence: SortDirection[] , expectedSequence: SortDirection[] ,
id: SimpleMatSortAppColumnIds = ' defaultA') { id: SimpleMatSortAppColumnIds = ' defaultA') {
 End of changes. 2 change blocks. 
1 lines changed or deleted 30 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)