[Dem0 shell] increase default time to message in order to help the e2e

This commit is contained in:
Eugenio Romano
2018-08-14 11:43:12 +01:00
parent 3c7c3316bf
commit c839fd516b
2 changed files with 23 additions and 20 deletions

View File

@@ -43,7 +43,7 @@
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput type="number" class="form-control" formControlName="duration" placeholder="Duration" data-automation-id="notification-duration"> <input matInput type="number" class="form-control" formControlName="duration" [value]="defaultDuration" placeholder="Duration" data-automation-id="notification-duration">
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<mat-select class="form-control" formControlName="horizontalPosition" placeholder="Horizontal Position" data-automation-id="notification-horizontal-position"> <mat-select class="form-control" formControlName="horizontalPosition" placeholder="Horizontal Position" data-automation-id="notification-horizontal-position">

View File

@@ -36,25 +36,29 @@ export class NotificationsComponent implements OnInit {
snackBarConfig: MatSnackBarConfig = new MatSnackBarConfig(); snackBarConfig: MatSnackBarConfig = new MatSnackBarConfig();
directions = [ directions = [
{value: 'ltr', title: 'Left to right'}, { value: 'ltr', title: 'Left to right' },
{value: 'rtl', title: 'Right to left'} { value: 'rtl', title: 'Right to left' }
]; ];
horizontalPositions = [ horizontalPositions = [
{value: 'start', title: 'Start'}, { value: 'start', title: 'Start' },
{value: 'center', title: 'Center'}, { value: 'center', title: 'Center' },
{value: 'end', title: 'End'}, { value: 'end', title: 'End' },
{value: 'left', title: 'Left'}, { value: 'left', title: 'Left' },
{value: 'right', title: 'Right'} { value: 'right', title: 'Right' }
]; ];
verticalPositions = [ verticalPositions = [
{value: 'top', title: 'Top'}, { value: 'top', title: 'Top' },
{value: 'bottom', title: 'Bottom'} { value: 'bottom', title: 'Bottom' }
]; ];
defaultDuration = 20000;
constructor(private notificationService: NotificationService, constructor(private notificationService: NotificationService,
private formBuilder: FormBuilder) { } private formBuilder: FormBuilder) {
this.snackBarConfig.duration = this.defaultDuration;
}
ngOnInit() { ngOnInit() {
this.configForm = this.formBuilder.group({ this.configForm = this.formBuilder.group({
@@ -97,12 +101,11 @@ export class NotificationsComponent implements OnInit {
if (this.message) { if (this.message) {
if (this.withAction) { if (this.withAction) {
this.notificationService this.notificationService.openSnackMessageAction(this.message, 'Some action', this.snackBarConfig.duration)
.openSnackMessageAction(this.message, 'Some action')
.onAction() .onAction()
.subscribe(() => this.actionOutput = 'Action clicked'); .subscribe(() => this.actionOutput = 'Action clicked');
} else { } else {
this.notificationService.openSnackMessage(this.message); this.notificationService.openSnackMessage(this.message, this.snackBarConfig.duration);
} }
} }
} }
@@ -116,7 +119,7 @@ export class NotificationsComponent implements OnInit {
if (this.message) { if (this.message) {
if (this.withAction) { if (this.withAction) {
this.notificationService this.notificationService
.openSnackMessageAction(this.message, 'Some action', this.snackBarConfig ) .openSnackMessageAction(this.message, 'Some action', this.snackBarConfig)
.onAction() .onAction()
.subscribe(() => this.actionOutput = 'Action clicked'); .subscribe(() => this.actionOutput = 'Action clicked');
} else { } else {