Skip to content

Commit 868ec7e

Browse files
amysortommalerba
authored andcommitted
build: add tooltip example to mdc-migration integration test
1 parent 3800581 commit 868ec7e

File tree

14 files changed

+125
-0
lines changed

14 files changed

+125
-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
@@ -17,3 +17,4 @@
1717
<snack-bar-example></snack-bar-example>
1818
<table-example></table-example>
1919
<tabs-example></tabs-example>
20+
<tooltip-example></tooltip-example>

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {MatSliderModule} from '@angular/material-experimental/mdc-slider';
2424
import {MatSnackBarModule} from '@angular/material/snack-bar';
2525
import {MatTableModule} from '@angular/material-experimental/mdc-table';
2626
import {MatTabsModule} from '@angular/material-experimental/mdc-tabs';
27+
import {MatTooltipModule} from '@angular/material-experimental/mdc-tooltip';
2728
import {AutocompleteComponent} from './components/autocomplete/autocomplete.component';
2829
import {ButtonComponent} from './components/button/button.component';
2930
import {CardComponent} from './components/card/card.component';
@@ -43,6 +44,7 @@ import {SliderComponent} from './components/slider/slider.component';
4344
import {SnackBarComponent} from './components/snack-bar/snack-bar.component';
4445
import {TableComponent} from './components/table/table.component';
4546
import {TabsComponent} from './components/tabs/tabs.component';
47+
import {TooltipComponent} from './components/tooltip/tooltip.component';
4648

4749
@NgModule({
4850
declarations: [
@@ -66,6 +68,7 @@ import {TabsComponent} from './components/tabs/tabs.component';
6668
SnackBarComponent,
6769
TableComponent,
6870
TabsComponent,
71+
TooltipComponent,
6972
],
7073
imports: [
7174
BrowserModule,
@@ -90,6 +93,7 @@ import {TabsComponent} from './components/tabs/tabs.component';
9093
MatSnackBarModule,
9194
MatTableModule,
9295
MatTabsModule,
96+
MatTooltipModule,
9397
ReactiveFormsModule,
9498
],
9599
providers: [],
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<h2>Tooltip example</h2>
2+
<button mat-stroked-button matTooltip="Here are more details!">
3+
Learn more
4+
</button>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
::ng-deep {
2+
.mat-mdc-tooltip {
3+
font-size: 16px;
4+
}
5+
6+
.mat-mdc-tooltip-panel {
7+
margin: 4px;
8+
}
9+
}
10+
11+
/* TODO: The following rule targets internal classes of tooltip that may no longer apply for the MDC version. */
12+
13+
.mat-tooltip-handset {
14+
font-size: 12px;
15+
}
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 {MatTooltipModule} from '@angular/material/tooltip';
4+
import {TooltipComponent} from './tooltip.component';
5+
6+
describe('TooltipComponent', () => {
7+
let component: TooltipComponent;
8+
let fixture: ComponentFixture<TooltipComponent>;
9+
10+
beforeEach(async () => {
11+
await TestBed.configureTestingModule({
12+
imports: [BrowserAnimationsModule, MatTooltipModule],
13+
declarations: [TooltipComponent],
14+
}).compileComponents();
15+
});
16+
17+
beforeEach(() => {
18+
fixture = TestBed.createComponent(TooltipComponent);
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: 'tooltip-example',
5+
templateUrl: './tooltip.component.html',
6+
styleUrls: ['./tooltip.component.scss'],
7+
})
8+
export class TooltipComponent 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
@@ -72,6 +72,8 @@ $sample-project-theme: mat.define-light-theme((
7272
@include mat.mdc-table-typography($sample-project-theme);
7373
@include mat.mdc-tabs-theme($sample-project-theme);
7474
@include mat.mdc-tabs-typography($sample-project-theme);
75+
@include mat.mdc-tooltip-theme($sample-project-theme);
76+
@include mat.mdc-tooltip-typography($sample-project-theme);
7577

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

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@
1717
<snack-bar-example></snack-bar-example>
1818
<table-example></table-example>
1919
<tabs-example></tabs-example>
20+
<tooltip-example></tooltip-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
@@ -24,6 +24,7 @@ import {MatSliderModule} from '@angular/material/slider';
2424
import {MatSnackBarModule} from '@angular/material/snack-bar';
2525
import {MatTableModule} from '@angular/material/table';
2626
import {MatTabsModule} from '@angular/material/tabs';
27+
import {MatTooltipModule} from '@angular/material/tooltip';
2728
import {AutocompleteComponent} from './components/autocomplete/autocomplete.component';
2829
import {ButtonComponent} from './components/button/button.component';
2930
import {CardComponent} from './components/card/card.component';
@@ -43,6 +44,7 @@ import {SliderComponent} from './components/slider/slider.component';
4344
import {SnackBarComponent} from './components/snack-bar/snack-bar.component';
4445
import {TableComponent} from './components/table/table.component';
4546
import {TabsComponent} from './components/tabs/tabs.component';
47+
import {TooltipComponent} from './components/tooltip/tooltip.component';
4648

4749
@NgModule({
4850
declarations: [
@@ -66,6 +68,7 @@ import {TabsComponent} from './components/tabs/tabs.component';
6668
SnackBarComponent,
6769
TableComponent,
6870
TabsComponent,
71+
TooltipComponent,
6972
],
7073
imports: [
7174
BrowserModule,
@@ -90,6 +93,7 @@ import {TabsComponent} from './components/tabs/tabs.component';
9093
MatSnackBarModule,
9194
MatTableModule,
9295
MatTabsModule,
96+
MatTooltipModule,
9397
ReactiveFormsModule,
9498
],
9599
providers: [],
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<h2>Tooltip example</h2>
2+
<button mat-stroked-button matTooltip="Here are more details!">
3+
Learn more
4+
</button>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
::ng-deep {
2+
.mat-tooltip {
3+
font-size: 16px;
4+
}
5+
6+
.mat-tooltip-panel {
7+
margin: 4px;
8+
}
9+
}
10+
11+
.mat-tooltip-handset {
12+
font-size: 12px;
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 {BrowserAnimationsModule} from '@angular/platform-browser/animations';
3+
import {MatTooltipModule} from '@angular/material/tooltip';
4+
import {TooltipComponent} from './tooltip.component';
5+
6+
describe('TooltipComponent', () => {
7+
let component: TooltipComponent;
8+
let fixture: ComponentFixture<TooltipComponent>;
9+
10+
beforeEach(async () => {
11+
await TestBed.configureTestingModule({
12+
imports: [BrowserAnimationsModule, MatTooltipModule],
13+
declarations: [TooltipComponent],
14+
}).compileComponents();
15+
});
16+
17+
beforeEach(() => {
18+
fixture = TestBed.createComponent(TooltipComponent);
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: 'tooltip-example',
5+
templateUrl: './tooltip.component.html',
6+
styleUrls: ['./tooltip.component.scss'],
7+
})
8+
export class TooltipComponent implements OnInit {
9+
constructor() {}
10+
11+
ngOnInit(): void {}
12+
}

integration/mdc-migration/sample-project/src/styles.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ $sample-project-theme: mat.define-light-theme((
4747
@include mat.snack-bar-theme($sample-project-theme);
4848
@include mat.table-theme($sample-project-theme);
4949
@include mat.tabs-theme($sample-project-theme);
50+
@include mat.tooltip-theme($sample-project-theme);
5051

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

0 commit comments

Comments
 (0)