Skip to content

Commit ff3a61d

Browse files
amysortommalerba
authored andcommitted
build: add menu example to mdc-migration integration test
1 parent 1e5dc8a commit ff3a61d

File tree

14 files changed

+133
-1056
lines changed

14 files changed

+133
-1056
lines changed

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

Lines changed: 1 addition & 500 deletions
Large diffs are not rendered by default.

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@ import {BrowserModule} from '@angular/platform-browser';
33

44
import {AppComponent} from './app.component';
55
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
6+
import {MatIconModule} from '@angular/material/icon';
7+
import {MatMenuModule} from '@angular/material/menu';
8+
import {MenuComponent} from './components/menu/menu.component';
69

710
@NgModule({
8-
declarations: [AppComponent],
9-
imports: [BrowserModule, BrowserAnimationsModule],
11+
declarations: [AppComponent, MenuComponent],
12+
imports: [BrowserModule, BrowserAnimationsModule, MatIconModule, MatMenuModule],
1013
providers: [],
1114
bootstrap: [AppComponent],
1215
})
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<h2>Menu example</h2>
2+
<button [matMenuTriggerFor]="menu">Open Settings</button>
3+
<mat-menu #menu>
4+
<button mat-menu-item [matMenuTriggerFor]="submenu">
5+
<mat-icon>person</mat-icon>
6+
<span>My Account</span>
7+
</button>
8+
<button mat-menu-item> Data Preferences </button>
9+
</mat-menu>
10+
<mat-menu #submenu>
11+
<button mat-menu-item> View profile </button>
12+
<button mat-menu-item> Logout </button>
13+
</mat-menu>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.mat-mdc-menu-item {
2+
color: darkblue;
3+
}
4+
5+
.mat-mdc-menu-panel {
6+
padding: 12px;
7+
}
8+
9+
10+
/* TODO: The following rule targets internal classes of menu that may no longer apply for the MDC version. */
11+
12+
.mat-mdc-menu-item .mat-menu-submenu-icon { padding: 12px; }
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import {ComponentFixture, TestBed} from '@angular/core/testing';
2+
3+
import {MenuComponent} from './menu.component';
4+
5+
describe('MenuComponent', () => {
6+
let component: MenuComponent;
7+
let fixture: ComponentFixture<MenuComponent>;
8+
9+
beforeEach(async () => {
10+
await TestBed.configureTestingModule({
11+
declarations: [MenuComponent],
12+
}).compileComponents();
13+
});
14+
15+
beforeEach(() => {
16+
fixture = TestBed.createComponent(MenuComponent);
17+
component = fixture.componentInstance;
18+
fixture.detectChanges();
19+
});
20+
21+
it('should create', () => {
22+
expect(component).toBeTruthy();
23+
});
24+
});
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: 'menu',
5+
templateUrl: './menu.component.html',
6+
styleUrls: ['./menu.component.scss'],
7+
})
8+
export class MenuComponent implements OnInit {
9+
constructor() {}
10+
11+
ngOnInit(): void {}
12+
}

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

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -28,56 +28,8 @@ $sample-project-theme: mat.define-light-theme((
2828
)
2929
));
3030

31-
// Include theme styles for core and each component used in your app.
32-
// Alternatively, you can import and @include the theme mixins for each component
33-
// that you are using.
34-
@include mat.all-component-themes($sample-project-theme);
35-
@include mat.mdc-tooltip-theme($sample-project-theme);
36-
@include mat.mdc-tooltip-typography($sample-project-theme);
37-
@include mat.mdc-tabs-theme($sample-project-theme);
38-
@include mat.mdc-tabs-typography($sample-project-theme);
39-
@include mat.mdc-table-theme($sample-project-theme);
40-
@include mat.mdc-table-typography($sample-project-theme);
41-
@include mat.mdc-slider-theme($sample-project-theme);
42-
@include mat.mdc-slider-typography($sample-project-theme);
43-
@include mat.mdc-slide-toggle-theme($sample-project-theme);
44-
@include mat.mdc-slide-toggle-typography($sample-project-theme);
45-
@include mat.mdc-select-theme($sample-project-theme);
46-
@include mat.mdc-select-typography($sample-project-theme);
47-
@include mat.mdc-core-theme($sample-project-theme);
48-
@include mat.mdc-core-typography($sample-project-theme);
49-
@include mat.mdc-radio-theme($sample-project-theme);
50-
@include mat.mdc-radio-typography($sample-project-theme);
51-
@include mat.mdc-progress-spinner-theme($sample-project-theme);
52-
@include mat.mdc-progress-spinner-typography($sample-project-theme);
53-
@include mat.mdc-progress-bar-theme($sample-project-theme);
54-
@include mat.mdc-progress-bar-typography($sample-project-theme);
55-
@include mat.mdc-paginator-theme($sample-project-theme);
56-
@include mat.mdc-paginator-typography($sample-project-theme);
5731
@include mat.mdc-menu-theme($sample-project-theme);
5832
@include mat.mdc-menu-typography($sample-project-theme);
59-
@include mat.mdc-list-theme($sample-project-theme);
60-
@include mat.mdc-list-typography($sample-project-theme);
61-
@include mat.mdc-input-theme($sample-project-theme);
62-
@include mat.mdc-input-typography($sample-project-theme);
63-
@include mat.mdc-form-field-theme($sample-project-theme);
64-
@include mat.mdc-form-field-typography($sample-project-theme);
65-
@include mat.mdc-dialog-theme($sample-project-theme);
66-
@include mat.mdc-dialog-typography($sample-project-theme);
67-
@include mat.mdc-chips-theme($sample-project-theme);
68-
@include mat.mdc-chips-typography($sample-project-theme);
69-
@include mat.mdc-checkbox-theme($sample-project-theme);
70-
@include mat.mdc-checkbox-typography($sample-project-theme);
71-
@include mat.mdc-card-theme($sample-project-theme);
72-
@include mat.mdc-card-typography($sample-project-theme);
73-
@include mat.mdc-button-theme($sample-project-theme);
74-
@include mat.mdc-button-typography($sample-project-theme);
75-
@include mat.mdc-fab-theme($sample-project-theme);
76-
@include mat.mdc-fab-typography($sample-project-theme);
77-
@include mat.mdc-icon-button-theme($sample-project-theme);
78-
@include mat.mdc-icon-button-typography($sample-project-theme);
79-
@include mat.mdc-autocomplete-theme($sample-project-theme);
80-
@include mat.mdc-autocomplete-typography($sample-project-theme);
8133

8234
/* You can add global styles to this file, and also import other style files */
8335

0 commit comments

Comments
 (0)