Skip to content

Commit f9e7557

Browse files
amysortommalerba
authored andcommitted
build: add checkbox example to mdc-migration integration test
1 parent 9ac4c03 commit f9e7557

File tree

14 files changed

+117
-0
lines changed

14 files changed

+117
-0
lines changed

integration/mdc-migration/golden/src/app/app.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<autocomplete-example></autocomplete-example>
22
<button-example></button-example>
33
<card-example></card-example>
4+
<checkbox-example></checkbox-example>
45
<chips-example></chips-example>
56
<form-field-example></form-field-example>
67
<input-example></input-example>

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {ReactiveFormsModule} from '@angular/forms';
77
import {MatAutocompleteModule} from '@angular/material-experimental/mdc-autocomplete';
88
import {MatButtonModule} from '@angular/material-experimental/mdc-button';
99
import {MatCardModule} from '@angular/material-experimental/mdc-card';
10+
import {MatCheckboxModule} from '@angular/material-experimental/mdc-checkbox';
1011
import {MatChipsModule} from '@angular/material-experimental/mdc-chips';
1112
import {MatFormFieldModule} from '@angular/material-experimental/mdc-form-field';
1213
import {MatIconModule} from '@angular/material/icon';
@@ -25,6 +26,7 @@ import {MatTableModule} from '@angular/material-experimental/mdc-table';
2526
import {AutocompleteComponent} from './components/autocomplete/autocomplete.component';
2627
import {ButtonComponent} from './components/button/button.component';
2728
import {CardComponent} from './components/card/card.component';
29+
import {CheckboxComponent} from './components/checkbox/checkbox.component';
2830
import {ChipsComponent} from './components/chips/chips.component';
2931
import {FormFieldComponent} from './components/form-field/form-field.component';
3032
import {InputComponent} from './components/input/input.component';
@@ -46,6 +48,7 @@ import {TableComponent} from './components/table/table.component';
4648
AppComponent,
4749
ButtonComponent,
4850
CardComponent,
51+
CheckboxComponent,
4952
ChipsComponent,
5053
FormFieldComponent,
5154
InputComponent,
@@ -67,6 +70,7 @@ import {TableComponent} from './components/table/table.component';
6770
MatAutocompleteModule,
6871
MatButtonModule,
6972
MatCardModule,
73+
MatCheckboxModule,
7074
MatChipsModule,
7175
MatFormFieldModule,
7276
MatIconModule,
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<h2>Checkbox example</h2>
2+
<mat-checkbox>Pepperoni</mat-checkbox>
3+
<mat-checkbox>Extra Cheese</mat-checkbox>
4+
<mat-checkbox [disabled]="true">Mushroom</mat-checkbox>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.mat-mdc-checkbox {
2+
padding-right: 16px;
3+
}
4+
5+
/* TODO: The following rule targets internal classes of checkbox that may no longer apply for the MDC version. */
6+
7+
::ng-deep .mat-checkbox-disabled .mat-checkbox-label {
8+
color: slategray;
9+
}
10+
/* TODO: The following rule targets internal classes of checkbox that may no longer apply for the MDC version. */
11+
12+
.mat-checkbox-label { font-size: 16px; }
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 {BrowserAnimationsModule} from '@angular/platform-browser/animations';
3+
import {MatCheckboxModule} from '@angular/material/checkbox';
4+
import {CheckboxComponent} from './checkbox.component';
5+
6+
describe('CheckboxComponent', () => {
7+
let component: CheckboxComponent;
8+
let fixture: ComponentFixture<CheckboxComponent>;
9+
10+
beforeEach(async () => {
11+
await TestBed.configureTestingModule({
12+
imports: [BrowserAnimationsModule, MatCheckboxModule],
13+
declarations: [CheckboxComponent],
14+
}).compileComponents();
15+
});
16+
17+
beforeEach(() => {
18+
fixture = TestBed.createComponent(CheckboxComponent);
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: 'checkbox-example',
5+
templateUrl: './checkbox.component.html',
6+
styleUrls: ['./checkbox.component.scss'],
7+
})
8+
export class CheckboxComponent implements OnInit {
9+
constructor() {}
10+
11+
ngOnInit(): void {}
12+
}

integration/mdc-migration/golden/src/styles.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ $sample-project-theme: mat.define-light-theme((
3838
@include mat.mdc-icon-button-typography($sample-project-theme);
3939
@include mat.mdc-card-theme($sample-project-theme);
4040
@include mat.mdc-card-typography($sample-project-theme);
41+
@include mat.mdc-checkbox-theme($sample-project-theme);
42+
@include mat.mdc-checkbox-typography($sample-project-theme);
4143
@include mat.mdc-chips-theme($sample-project-theme);
4244
@include mat.mdc-chips-typography($sample-project-theme);
4345
@include mat.mdc-form-field-theme($sample-project-theme);

integration/mdc-migration/sample-project/src/app/app.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<autocomplete-example></autocomplete-example>
22
<button-example></button-example>
33
<card-example></card-example>
4+
<checkbox-example></checkbox-example>
45
<chips-example></chips-example>
56
<form-field-example></form-field-example>
67
<input-example></input-example>

integration/mdc-migration/sample-project/src/app/app.module.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {ReactiveFormsModule} from '@angular/forms';
77
import {MatAutocompleteModule} from '@angular/material/autocomplete';
88
import {MatButtonModule} from '@angular/material/button';
99
import {MatCardModule} from '@angular/material/card';
10+
import {MatCheckboxModule} from '@angular/material/checkbox';
1011
import {MatChipsModule} from '@angular/material/chips';
1112
import {MatFormFieldModule} from '@angular/material/form-field';
1213
import {MatIconModule} from '@angular/material/icon';
@@ -25,6 +26,7 @@ import {MatTableModule} from '@angular/material/table';
2526
import {AutocompleteComponent} from './components/autocomplete/autocomplete.component';
2627
import {ButtonComponent} from './components/button/button.component';
2728
import {CardComponent} from './components/card/card.component';
29+
import {CheckboxComponent} from './components/checkbox/checkbox.component';
2830
import {ChipsComponent} from './components/chips/chips.component';
2931
import {FormFieldComponent} from './components/form-field/form-field.component';
3032
import {InputComponent} from './components/input/input.component';
@@ -46,6 +48,7 @@ import {TableComponent} from './components/table/table.component';
4648
AppComponent,
4749
ButtonComponent,
4850
CardComponent,
51+
CheckboxComponent,
4952
ChipsComponent,
5053
FormFieldComponent,
5154
InputComponent,
@@ -67,6 +70,7 @@ import {TableComponent} from './components/table/table.component';
6770
MatAutocompleteModule,
6871
MatButtonModule,
6972
MatCardModule,
73+
MatCheckboxModule,
7074
MatChipsModule,
7175
MatFormFieldModule,
7276
MatIconModule,
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<h2>Checkbox example</h2>
2+
<mat-checkbox>Pepperoni</mat-checkbox>
3+
<mat-checkbox>Extra Cheese</mat-checkbox>
4+
<mat-checkbox [disabled]="true">Mushroom</mat-checkbox>

0 commit comments

Comments
 (0)