File tree Expand file tree Collapse file tree 4 files changed +27
-13
lines changed Expand file tree Collapse file tree 4 files changed +27
-13
lines changed Original file line number Diff line number Diff line change 1
1
{{data.message}}
2
2
3
- < button
4
- class =" mat-simple-snackbar-action "
5
- *ngIf =" hasAction "
6
- (click) =" action() " > {{data.action}} </ button >
3
+ < div class =" mat-simple-snackbar-action " >
4
+ < button mat-button *ngIf =" hasAction "
5
+ (click) =" action() " > {{data.action}} </ button >
6
+ </ div >
Original file line number Diff line number Diff line change 2
2
@import ' ../core/style/button-common' ;
3
3
@import ' ../core/style/list-common' ;
4
4
5
- $mat-snack-bar-button-margin : 48px !default ;
5
+ $mat-snack-bar-button-horizontal-margin : 8px !default ;
6
+ $mat-snack-bar-button-height : 36px !default ;
7
+ $mat-snack-bar-line-height : 20px !default ;
8
+ // Button vertical margin is used to ensure that a button height of 36px, when the containing
9
+ // space falls below 36px.
10
+ $mat-snack-bar-button-vertical-margin :
11
+ - (($mat-snack-bar-button-height - $mat-snack-bar-line-height ) / 2 );
6
12
7
13
.mat-simple-snackbar {
8
14
display : flex ;
9
15
justify-content : space-between ;
10
- line-height : 20 px ;
16
+ line-height : $mat-snack-bar-line-height ;
11
17
opacity : 1 ;
12
18
}
13
19
14
20
.mat-simple-snackbar-action {
15
- @include mat-button-reset ;
16
-
17
- background : none ;
21
+ display : flex ;
22
+ flex-direction : column ;
18
23
flex-shrink : 0 ;
19
- margin-left : $mat-snack-bar-button-margin ;
24
+ justify-content : space-around ;
25
+ margin : $mat-snack-bar-button-vertical-margin 0
26
+ $mat-snack-bar-button-vertical-margin $mat-snack-bar-button-horizontal-margin ;
27
+
28
+ button {
29
+ flex : 1 ;
30
+ max-height : $mat-snack-bar-button-height ;
31
+ }
20
32
21
33
[dir = ' rtl' ] & {
22
- margin-right : $mat-snack-bar-button-margin ;
23
34
margin-left : 0 ;
35
+ margin-right : $mat-snack-bar-button-horizontal-margin ;
24
36
}
25
37
}
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import {PortalModule} from '@angular/cdk/portal';
13
13
import { LIVE_ANNOUNCER_PROVIDER } from '@angular/cdk/a11y' ;
14
14
import { LayoutModule } from '@angular/cdk/layout' ;
15
15
import { MatCommonModule } from '@angular/material/core' ;
16
+ import { MatButtonModule } from '@angular/material/button' ;
16
17
import { MatSnackBar } from './snack-bar' ;
17
18
import { MatSnackBarContainer } from './snack-bar-container' ;
18
19
import { SimpleSnackBar } from './simple-snack-bar' ;
@@ -23,6 +24,7 @@ import {SimpleSnackBar} from './simple-snack-bar';
23
24
OverlayModule ,
24
25
PortalModule ,
25
26
CommonModule ,
27
+ MatButtonModule ,
26
28
MatCommonModule ,
27
29
LayoutModule ,
28
30
] ,
Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ describe('MatSnackBar', () => {
105
105
expect ( messageElement . textContent )
106
106
. toContain ( simpleMessage , `Expected the snack bar message to be '${ simpleMessage } '` ) ;
107
107
108
- let buttonElement = overlayContainerElement . querySelector ( 'button.mat-simple-snackbar-action ' ) ! ;
108
+ let buttonElement = overlayContainerElement . querySelector ( 'button.mat-button ' ) ! ;
109
109
expect ( buttonElement . tagName )
110
110
. toBe ( 'BUTTON' , 'Expected snack bar action label to be a <button>' ) ;
111
111
expect ( buttonElement . textContent )
@@ -127,7 +127,7 @@ describe('MatSnackBar', () => {
127
127
let messageElement = overlayContainerElement . querySelector ( 'snack-bar-container' ) ! ;
128
128
expect ( messageElement . textContent )
129
129
. toContain ( simpleMessage , `Expected the snack bar message to be '${ simpleMessage } '` ) ;
130
- expect ( overlayContainerElement . querySelector ( 'button.mat-simple-snackbar-action ' ) )
130
+ expect ( overlayContainerElement . querySelector ( 'button.mat-button ' ) )
131
131
. toBeNull ( 'Expected the query selection for action label to be null' ) ;
132
132
} ) ;
133
133
You can’t perform that action at this time.
0 commit comments