Skip to content

Commit ba77c4b

Browse files
amysortommalerba
authored andcommitted
build: add paginator example to mdc-migration integration test
1 parent 33c7922 commit ba77c4b

18 files changed

+146
-20
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
<chips-example></chips-example>
22
<menu-example></menu-example>
3+
<paginator-example></paginator-example>
Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import {TestBed} from '@angular/core/testing';
2+
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
23
import {AppComponent} from './app.component';
34

45
describe('AppComponent', () => {
56
beforeEach(async () => {
67
await TestBed.configureTestingModule({
8+
imports: [BrowserAnimationsModule],
79
declarations: [AppComponent],
810
}).compileComponents();
911
});
@@ -19,13 +21,4 @@ describe('AppComponent', () => {
1921
const app = fixture.componentInstance;
2022
expect(app.title).toEqual('sample-project');
2123
});
22-
23-
it('should render title', () => {
24-
const fixture = TestBed.createComponent(AppComponent);
25-
fixture.detectChanges();
26-
const compiled = fixture.nativeElement as HTMLElement;
27-
expect(compiled.querySelector('.content span')?.textContent).toContain(
28-
'sample-project app is running!',
29-
);
30-
});
3124
});

integration/mdc-migration/golden/src/app/app.module.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,21 @@ import {MatChipsModule} from '@angular/material-experimental/mdc-chips';
77
import {MatFormFieldModule} from '@angular/material-experimental/mdc-form-field';
88
import {MatIconModule} from '@angular/material/icon';
99
import {MatMenuModule} from '@angular/material-experimental/mdc-menu';
10+
import {MatPaginatorModule} from '@angular/material-experimental/mdc-paginator';
1011
import {ChipsComponent} from './components/chips/chips.component';
1112
import {MenuComponent} from './components/menu/menu.component';
13+
import {PaginatorComponent} from './components/paginator/paginator.component';
1214

1315
@NgModule({
14-
declarations: [AppComponent, ChipsComponent, MenuComponent],
16+
declarations: [AppComponent, ChipsComponent, MenuComponent, PaginatorComponent],
1517
imports: [
1618
BrowserModule,
1719
BrowserAnimationsModule,
1820
MatChipsModule,
1921
MatFormFieldModule,
2022
MatIconModule,
2123
MatMenuModule,
24+
MatPaginatorModule,
2225
],
2326
providers: [],
2427
bootstrap: [AppComponent],

integration/mdc-migration/golden/src/app/components/chips/chips.component.spec.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
import {ComponentFixture, TestBed} from '@angular/core/testing';
2+
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
3+
import {MatChipsModule} from '@angular/material/chips';
4+
import {MatFormFieldModule} from '@angular/material/form-field';
5+
import {MatIconModule} from '@angular/material/icon';
26

37
import {ChipsComponent} from './chips.component';
48

@@ -8,6 +12,7 @@ describe('ChipsComponent', () => {
812

913
beforeEach(async () => {
1014
await TestBed.configureTestingModule({
15+
imports: [BrowserAnimationsModule, MatChipsModule, MatFormFieldModule, MatIconModule],
1116
declarations: [ChipsComponent],
1217
}).compileComponents();
1318
});

integration/mdc-migration/golden/src/app/components/menu/menu.component.spec.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
import {ComponentFixture, TestBed} from '@angular/core/testing';
2+
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
3+
import {MatIconModule} from '@angular/material/icon';
4+
import {MatMenuModule} from '@angular/material/menu';
25

36
import {MenuComponent} from './menu.component';
47

@@ -8,6 +11,7 @@ describe('MenuComponent', () => {
811

912
beforeEach(async () => {
1013
await TestBed.configureTestingModule({
14+
imports: [BrowserAnimationsModule, MatIconModule, MatMenuModule],
1115
declarations: [MenuComponent],
1216
}).compileComponents();
1317
});
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<h2>Paginator example</h2>
2+
<mat-paginator
3+
[length]="100"
4+
[pageSize]="10"
5+
[pageSizeOptions]="[5, 10, 25, 100]"
6+
aria-label="Select page">
7+
</mat-paginator>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.mat-mdc-paginator {
2+
background: lavender;
3+
}
4+
5+
::ng-deep.mat-mdc-paginator .mat-mdc-paginator-container{
6+
justify-content: flex-start;
7+
}
8+
9+
/* TODO: The following rule targets internal classes of paginator that may no longer apply for the MDC version. */
10+
11+
.mat-paginator-increment {
12+
padding: 4px;
13+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import {ComponentFixture, TestBed} from '@angular/core/testing';
2+
import {MatPaginatorModule} from '@angular/material/paginator';
3+
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
4+
import {PaginatorComponent} from './paginator.component';
5+
6+
describe('PaginatorComponent', () => {
7+
let component: PaginatorComponent;
8+
let fixture: ComponentFixture<PaginatorComponent>;
9+
10+
beforeEach(async () => {
11+
await TestBed.configureTestingModule({
12+
imports: [BrowserAnimationsModule, MatPaginatorModule],
13+
declarations: [PaginatorComponent],
14+
}).compileComponents();
15+
});
16+
17+
beforeEach(() => {
18+
fixture = TestBed.createComponent(PaginatorComponent);
19+
component = fixture.componentInstance;
20+
fixture.detectChanges();
21+
});
22+
23+
it('should create', () => {
24+
expect(component).toBeTruthy();
25+
});
26+
});
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import {Component, OnInit} from '@angular/core';
2+
3+
@Component({
4+
selector: 'paginator-example',
5+
templateUrl: './paginator.component.html',
6+
styleUrls: ['./paginator.component.scss'],
7+
})
8+
export class PaginatorComponent implements OnInit {
9+
constructor() {}
10+
11+
ngOnInit(): void {}
12+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
<chips-example></chips-example>
22
<menu-example></menu-example>
3+
<paginator-example></paginator-example>

0 commit comments

Comments
 (0)