[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

@ -31,9 +31,9 @@
<div data-automation-id="notification-action-output" *ngIf="actionOutput">
{{ actionOutput }}
</div>
<h2>Custom Configuration</h2>
<form [formGroup]="configForm">
<mat-form-field>
<mat-select class="form-control" formControlName="direction" placeholder="Direction" data-automation-id="notification-direction">
@ -43,7 +43,7 @@
</mat-select>
</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-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();
directions = [
{value: 'ltr', title: 'Left to right'},
{value: 'rtl', title: 'Right to left'}
{ value: 'ltr', title: 'Left to right' },
{ value: 'rtl', title: 'Right to left' }
];
horizontalPositions = [
{value: 'start', title: 'Start'},
{value: 'center', title: 'Center'},
{value: 'end', title: 'End'},
{value: 'left', title: 'Left'},
{value: 'right', title: 'Right'}
{ value: 'start', title: 'Start' },
{ value: 'center', title: 'Center' },
{ value: 'end', title: 'End' },
{ value: 'left', title: 'Left' },
{ value: 'right', title: 'Right' }
];
verticalPositions = [
{value: 'top', title: 'Top'},
{value: 'bottom', title: 'Bottom'}
{ value: 'top', title: 'Top' },
{ value: 'bottom', title: 'Bottom' }
];
defaultDuration = 20000;
constructor(private notificationService: NotificationService,
private formBuilder: FormBuilder) { }
private formBuilder: FormBuilder) {
this.snackBarConfig.duration = this.defaultDuration;
}
ngOnInit() {
this.configForm = this.formBuilder.group({
@ -65,9 +69,9 @@ export class NotificationsComponent implements OnInit {
});
this.configForm.valueChanges
.subscribe(configFormValues =>
this.setSnackBarConfig(configFormValues)
);
.subscribe(configFormValues =>
this.setSnackBarConfig(configFormValues)
);
}
@ -97,12 +101,11 @@ export class NotificationsComponent implements OnInit {
if (this.message) {
if (this.withAction) {
this.notificationService
.openSnackMessageAction(this.message, 'Some action')
this.notificationService.openSnackMessageAction(this.message, 'Some action', this.snackBarConfig.duration)
.onAction()
.subscribe(() => this.actionOutput = 'Action clicked');
} 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.withAction) {
this.notificationService
.openSnackMessageAction(this.message, 'Some action', this.snackBarConfig )
.openSnackMessageAction(this.message, 'Some action', this.snackBarConfig)
.onAction()
.subscribe(() => this.actionOutput = 'Action clicked');
} else {