Skip to content

Commit eafea52

Browse files
authored
fix(material/table): cleanup legacy usage (angular#25525)
1 parent 226696d commit eafea52

File tree

8 files changed

+29
-27
lines changed

8 files changed

+29
-27
lines changed

src/dev-app/table-scroll-container/BUILD.bazel

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ ng_module(
1313
"//src/cdk-experimental/table-scroll-container",
1414
"//src/material/button",
1515
"//src/material/button-toggle",
16-
"//src/material/legacy-table",
1716
"//src/material/table",
1817
"@npm//@angular/common",
1918
"@npm//@angular/core",

src/dev-app/table-scroll-container/table-scroll-container-demo.scss

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
overflow: auto;
44
}
55

6-
.mat-table-sticky {
6+
.mat-mdc-table-sticky, .mat-mdc-table-sticky.mat-mdc-header-cell {
77
background: #59abfd;
88
opacity: 1;
99
}
@@ -18,7 +18,7 @@
1818
text-align: center;
1919
}
2020

21-
.mat-header-cell, .mat-footer-cell, .mat-cell {
21+
.mat-mdc-header-cell, .mat-mdc-footer-cell, .mat-mdc-cell {
2222
min-width: 80px;
2323
box-sizing: border-box;
2424
}

src/dev-app/table-scroll-container/table-scroll-container-demo.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {CommonModule} from '@angular/common';
1111
import {CdkTableScrollContainerModule} from '@angular/cdk-experimental/table-scroll-container';
1212
import {MatButtonModule} from '@angular/material/button';
1313
import {MatButtonToggleGroup, MatButtonToggleModule} from '@angular/material/button-toggle';
14-
import {MatLegacyTableModule} from '@angular/material/legacy-table';
14+
import {MatTableModule} from '@angular/material/table';
1515

1616
/**
1717
* @title Tables with toggle-able sticky headers, footers, and columns
@@ -26,7 +26,7 @@ import {MatLegacyTableModule} from '@angular/material/legacy-table';
2626
CommonModule,
2727
MatButtonModule,
2828
MatButtonToggleModule,
29-
MatLegacyTableModule,
29+
MatTableModule,
3030
],
3131
})
3232
export class TableScrollContainerDemo {

src/material/legacy-table/testing/BUILD.bazel

+1-12
Original file line numberDiff line numberDiff line change
@@ -19,27 +19,16 @@ filegroup(
1919
srcs = glob(["**/*.ts"]),
2020
)
2121

22-
ng_test_library(
23-
name = "harness_tests_lib",
24-
srcs = ["shared.spec.ts"],
25-
deps = [
26-
":testing",
27-
"//src/cdk/testing",
28-
"//src/cdk/testing/testbed",
29-
"//src/material/legacy-table",
30-
],
31-
)
32-
3322
ng_test_library(
3423
name = "unit_tests_lib",
3524
srcs = glob(
3625
["**/*.spec.ts"],
3726
exclude = ["shared.spec.ts"],
3827
),
3928
deps = [
40-
":harness_tests_lib",
4129
":testing",
4230
"//src/material/legacy-table",
31+
"//src/material/table/testing:harness_tests_lib",
4332
],
4433
)
4534

Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {MatLegacyTableModule} from '@angular/material/legacy-table';
2-
import {runHarnessTests} from '@angular/material/legacy-table/testing/shared.spec';
2+
import {runHarnessTests} from '@angular/material/table/testing/shared.spec';
33
import {MatLegacyTableHarness} from './table-harness';
44

55
describe('Non-MDC-based MatTableHarness', () => {
6-
runHarnessTests(MatLegacyTableModule, MatLegacyTableHarness);
6+
runHarnessTests(MatLegacyTableModule, MatLegacyTableHarness as any);
77
});

src/material/table/testing/BUILD.bazel

+16-2
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,26 @@ filegroup(
1818
srcs = glob(["**/*.ts"]),
1919
)
2020

21+
ng_test_library(
22+
name = "harness_tests_lib",
23+
srcs = ["shared.spec.ts"],
24+
deps = [
25+
":testing",
26+
"//src/cdk/testing",
27+
"//src/cdk/testing/testbed",
28+
"//src/material/table",
29+
],
30+
)
31+
2132
ng_test_library(
2233
name = "unit_tests_lib",
23-
srcs = glob(["**/*.spec.ts"]),
34+
srcs = glob(
35+
["**/*.spec.ts"],
36+
exclude = ["shared.spec.ts"],
37+
),
2438
deps = [
39+
":harness_tests_lib",
2540
":testing",
26-
"//src/material/legacy-table/testing:harness_tests_lib",
2741
"//src/material/table",
2842
],
2943
)

src/material/legacy-table/testing/shared.spec.ts renamed to src/material/table/testing/shared.spec.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ import {HarnessLoader, parallel} from '@angular/cdk/testing';
22
import {TestbedHarnessEnvironment} from '@angular/cdk/testing/testbed';
33
import {Component} from '@angular/core';
44
import {ComponentFixture, TestBed} from '@angular/core/testing';
5-
import {MatLegacyTableModule} from '@angular/material/legacy-table';
6-
import {MatLegacyTableHarness} from './table-harness';
5+
import {MatTableModule} from '../module';
6+
import {MatTableHarness} from './table-harness';
77

88
/** Shared tests to run on both the original and MDC-based table. */
99
export function runHarnessTests(
10-
tableModule: typeof MatLegacyTableModule,
11-
tableHarness: typeof MatLegacyTableHarness,
10+
tableModule: typeof MatTableModule,
11+
tableHarness: typeof MatTableHarness,
1212
) {
1313
let fixture: ComponentFixture<TableHarnessTest>;
1414
let loader: HarnessLoader;
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {MatTableModule} from '@angular/material/table';
2-
import {runHarnessTests} from '@angular/material/legacy-table/testing/shared.spec';
2+
import {runHarnessTests} from './shared.spec';
33
import {MatTableHarness} from './table-harness';
44

55
describe('MDC-based MatTableHarness', () => {
6-
runHarnessTests(MatTableModule, MatTableHarness as any);
6+
runHarnessTests(MatTableModule, MatTableHarness);
77
});

0 commit comments

Comments
 (0)