Skip to content

Commit f75c3d2

Browse files
committed
fix test in edge/safari
1 parent 33f1e07 commit f75c3d2

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

src/cdk/table/text-column.spec.ts

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,27 @@
11
import {Component} from '@angular/core';
22
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
3+
4+
import {getTableTextColumnMissingParentTableError} from './table-errors';
35
import {CdkTableModule} from './table-module';
46
import {expectTableToMatchContent} from './table.spec';
5-
import {TextColumnOptions, TEXT_COLUMN_OPTIONS} from './text-column';
6-
import {getTableTextColumnMissingParentTableError} from './table-errors';
7+
import {TEXT_COLUMN_OPTIONS, TextColumnOptions} from './text-column';
8+
79

810
describe('CdkTextColumn', () => {
911
let fixture: ComponentFixture<BasicTextColumnApp>;
1012
let component: BasicTextColumnApp;
1113
let tableElement: HTMLElement;
1214

1315
beforeEach(async(() => {
14-
TestBed.configureTestingModule({
15-
imports: [CdkTableModule],
16-
declarations: [
17-
BasicTextColumnApp,
18-
MissingTableApp,
19-
],
20-
}).compileComponents();
16+
TestBed
17+
.configureTestingModule({
18+
imports: [CdkTableModule],
19+
declarations: [
20+
BasicTextColumnApp,
21+
MissingTableApp,
22+
],
23+
})
24+
.compileComponents();
2125
}));
2226

2327
beforeEach(() => {
@@ -38,8 +42,7 @@ describe('CdkTextColumn', () => {
3842

3943
it('should throw an error if the text column is not in the content of a table', () => {
4044
expect(() => TestBed.createComponent(MissingTableApp).detectChanges())
41-
.toThrowError(getTableTextColumnMissingParentTableError().message);
42-
45+
.toThrowError(getTableTextColumnMissingParentTableError().message);
4346
});
4447

4548
it('should allow for alternate header text', () => {
@@ -93,15 +96,13 @@ describe('CdkTextColumn', () => {
9396
component.justifyC = 'end';
9497
fixture.detectChanges();
9598

96-
const headerB = tableElement.querySelector('th:nth-child(2')! as HTMLElement;
97-
const headerC = tableElement.querySelector('th:nth-child(3')! as HTMLElement;
98-
expect(headerB.style.textAlign).toBe('start');
99-
expect(headerC.style.textAlign).toBe('end');
99+
const headers = tableElement.querySelectorAll('th');
100+
expect(headers[1].style.textAlign).toBe('start');
101+
expect(headers[2].style.textAlign).toBe('end');
100102

101-
const cellB = tableElement.querySelector('td:nth-child(2')! as HTMLElement;
102-
const cellC = tableElement.querySelector('td:nth-child(3')! as HTMLElement;
103-
expect(cellB.style.textAlign).toBe('start');
104-
expect(cellC.style.textAlign).toBe('end');
103+
const cells = tableElement.querySelectorAll('td');
104+
expect(cells[1].style.textAlign).toBe('start');
105+
expect(cells[2].style.textAlign).toBe('end');
105106
});
106107

107108
describe('with options', () => {

0 commit comments

Comments
 (0)