Fixed tests to release can go through

This commit is contained in:
Erik Tiekstra
2021-05-18 10:08:57 +02:00
parent e1634dc221
commit fe80cceb84
15 changed files with 50 additions and 28 deletions

View File

@@ -1,4 +1,5 @@
import { HttpClientTestingModule } from '@angular/common/http/testing'; import { HttpClientTestingModule } from '@angular/common/http/testing';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { TestBed } from '@angular/core/testing'; import { TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing'; import { RouterTestingModule } from '@angular/router/testing';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
@@ -9,6 +10,7 @@ import { SkipToContentModule } from './components/skip-to-content/skip-to-conten
describe('AppComponent', () => { describe('AppComponent', () => {
beforeEach(async () => { beforeEach(async () => {
await TestBed.configureTestingModule({ await TestBed.configureTestingModule({
schemas: [CUSTOM_ELEMENTS_SCHEMA],
declarations: [AppComponent], declarations: [AppComponent],
imports: [RouterTestingModule, HttpClientTestingModule, SkipToContentModule, NavigationModule, SidebarModule], imports: [RouterTestingModule, HttpClientTestingModule, SkipToContentModule, NavigationModule, SidebarModule],
}).compileComponents(); }).compileComponents();

View File

@@ -1,21 +1,26 @@
/* tslint:disable:no-unused-variable */ /* tslint:disable:no-unused-variable */
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { CustomError } from '@dafa-models/error/custom-error';
import { ToastComponent } from './toast.component'; import { ToastComponent } from './toast.component';
describe('ToastComponent', () => { describe('ToastComponent', () => {
let component: ToastComponent; let component: ToastComponent;
let fixture: ComponentFixture<ToastComponent>; let fixture: ComponentFixture<ToastComponent>;
beforeEach(waitForAsync(() => { beforeEach(
TestBed.configureTestingModule({ waitForAsync(() => {
declarations: [ToastComponent], TestBed.configureTestingModule({
}).compileComponents(); schemas: [CUSTOM_ELEMENTS_SCHEMA],
})); declarations: [ToastComponent],
}).compileComponents();
})
);
beforeEach(() => { beforeEach(() => {
fixture = TestBed.createComponent(ToastComponent); fixture = TestBed.createComponent(ToastComponent);
component = fixture.componentInstance; component = fixture.componentInstance;
component.error = new CustomError({ error: { name: 'Test', message: 'TestError' } });
fixture.detectChanges(); fixture.detectChanges();
}); });

View File

@@ -12,13 +12,13 @@ export class CustomError implements Error {
error: Error; error: Error;
removeAfter: number; removeAfter: number;
constructor(args: { error: Error; type: ErrorType; message?: string; severity?: ErrorSeverity; stack?: string }) { constructor(args: { error: Error; type?: ErrorType; message?: string; severity?: ErrorSeverity; stack?: string }) {
this.timestamp = new Date(); this.timestamp = new Date();
this.id = this.timestamp.getTime().toString(); this.id = this.timestamp.getTime().toString();
this.type = this.name = args.type; this.type = this.name = args.type || ErrorType.UNKNOWN;
this.message = args.message ? args.message : args.error.message; this.message = args.message || args.error.message;
this.severity = args.severity ? args.severity : ErrorSeverity.HIGH; this.severity = args.severity || ErrorSeverity.HIGH;
this.stack = args.stack ? args.stack : CustomError.getStack(args.error); this.stack = args.stack || CustomError.getStack(args.error);
this.error = args.error; this.error = args.error;
this.removeAfter = this.removeAfter =
this.severity === ErrorSeverity.LOW ? 5000 : this.severity === ErrorSeverity.MEDIUM ? 10000 : 20000; this.severity === ErrorSeverity.LOW ? 5000 : this.severity === ErrorSeverity.MEDIUM ? 10000 : 20000;

View File

@@ -55,7 +55,7 @@
<div class="create-account__permission-checkbox"> <div class="create-account__permission-checkbox">
<digi-ng-form-checkbox formControlName="permissions" afLabel="Välj administrera behörigheter"> <digi-ng-form-checkbox formControlName="permissions" afLabel="Välj administrera behörigheter">
</digi-ng-form-checkbox> </digi-ng-form-checkbox>
<digi-ng-popover afDirection="block-start"> <digi-ng-popover class="create-account__popover">
<p>Jag har tillräckligt med utrymme för att öppnas till höger (inline-start).</p> <p>Jag har tillräckligt med utrymme för att öppnas till höger (inline-start).</p>
<a href="#">Tab to me</a> <a href="#">Tab to me</a>
</digi-ng-popover> </digi-ng-popover>
@@ -63,7 +63,7 @@
<div class="create-account__permission-checkbox"> <div class="create-account__permission-checkbox">
<digi-ng-form-checkbox formControlName="participant" afLabel="Välj ta emot deltagare"></digi-ng-form-checkbox> <digi-ng-form-checkbox formControlName="participant" afLabel="Välj ta emot deltagare"></digi-ng-form-checkbox>
<digi-ng-popover afDirection="block-start"> <digi-ng-popover class="create-account__popover">
<p>Jag har tillräckligt med utrymme för att öppnas till höger (inline-start).</p> <p>Jag har tillräckligt med utrymme för att öppnas till höger (inline-start).</p>
<a href="#">Tab to me</a> <a href="#">Tab to me</a>
</digi-ng-popover> </digi-ng-popover>
@@ -75,7 +75,7 @@
afLabel="Välj rapportering, planering och infomration om deltagare" afLabel="Välj rapportering, planering och infomration om deltagare"
> >
</digi-ng-form-checkbox> </digi-ng-form-checkbox>
<digi-ng-popover afDirection="block-start"> <digi-ng-popover class="create-account__popover">
<p>Jag har tillräckligt med utrymme för att öppnas till höger (inline-start).</p> <p>Jag har tillräckligt med utrymme för att öppnas till höger (inline-start).</p>
<a href="#">Tab to me</a> <a href="#">Tab to me</a>
</digi-ng-popover> </digi-ng-popover>
@@ -84,7 +84,7 @@
<div class="create-account__permission-checkbox"> <div class="create-account__permission-checkbox">
<digi-ng-form-checkbox formControlName="orderBills" afLabel="Välj administrera ordrar och fakturor"> <digi-ng-form-checkbox formControlName="orderBills" afLabel="Välj administrera ordrar och fakturor">
</digi-ng-form-checkbox> </digi-ng-form-checkbox>
<digi-ng-popover afDirection="block-start"> <digi-ng-popover class="create-account__popover">
<p>Jag har tillräckligt med utrymme för att öppnas till höger (inline-start).</p> <p>Jag har tillräckligt med utrymme för att öppnas till höger (inline-start).</p>
<a href="#">Tab to me</a> <a href="#">Tab to me</a>
</digi-ng-popover> </digi-ng-popover>

View File

@@ -59,12 +59,12 @@
display: flex; display: flex;
gap: var(--digi--layout--gutter); gap: var(--digi--layout--gutter);
} }
}
.search-address { &__popover {
width: 30%; margin-left: var(--digi--layout--gutter);
}
digi-ng-popover { ::ng-deep .digi-ng-popover__container {
margin-left: var(--digi--layout--gutter); z-index: 1;
}
}
} }

View File

@@ -5,6 +5,7 @@ import { DigiNgFormRadiobuttonGroupModule } from '@af/digi-ng/_form/form-radiobu
import { DigiNgFormSelectModule } from '@af/digi-ng/_form/form-select'; import { DigiNgFormSelectModule } from '@af/digi-ng/_form/form-select';
import { DigiNgPopoverModule } from '@af/digi-ng/_popover/popover'; import { DigiNgPopoverModule } from '@af/digi-ng/_popover/popover';
import { HttpClientTestingModule } from '@angular/common/http/testing'; import { HttpClientTestingModule } from '@angular/common/http/testing';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ReactiveFormsModule } from '@angular/forms'; import { ReactiveFormsModule } from '@angular/forms';
import { RouterTestingModule } from '@angular/router/testing'; import { RouterTestingModule } from '@angular/router/testing';
@@ -17,6 +18,7 @@ describe('CreateAccountComponent', () => {
beforeEach( beforeEach(
waitForAsync(() => { waitForAsync(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
schemas: [CUSTOM_ELEMENTS_SCHEMA],
declarations: [CreateAccountComponent], declarations: [CreateAccountComponent],
imports: [ imports: [
RouterTestingModule, RouterTestingModule,

View File

@@ -1,4 +1,5 @@
import { HttpClientTestingModule } from '@angular/common/http/testing'; import { HttpClientTestingModule } from '@angular/common/http/testing';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing'; import { RouterTestingModule } from '@angular/router/testing';
import { EmployeeCardComponent } from './employee-card.component'; import { EmployeeCardComponent } from './employee-card.component';
@@ -10,6 +11,7 @@ describe('EmployeeCardComponent', () => {
beforeEach( beforeEach(
waitForAsync(() => { waitForAsync(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
schemas: [CUSTOM_ELEMENTS_SCHEMA],
declarations: [EmployeeCardComponent], declarations: [EmployeeCardComponent],
imports: [RouterTestingModule, HttpClientTestingModule], imports: [RouterTestingModule, HttpClientTestingModule],
}).compileComponents(); }).compileComponents();

View File

@@ -1,4 +1,5 @@
import { DigiNgTableModule } from '@af/digi-ng/_table/table'; import { DigiNgTableModule } from '@af/digi-ng/_table/table';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing'; import { RouterTestingModule } from '@angular/router/testing';
import { EmployeesListComponent } from './employees-list.component'; import { EmployeesListComponent } from './employees-list.component';
@@ -9,6 +10,7 @@ describe('EmployeesListComponent', () => {
beforeEach(async () => { beforeEach(async () => {
await TestBed.configureTestingModule({ await TestBed.configureTestingModule({
schemas: [CUSTOM_ELEMENTS_SCHEMA],
declarations: [EmployeesListComponent], declarations: [EmployeesListComponent],
imports: [RouterTestingModule, DigiNgTableModule], imports: [RouterTestingModule, DigiNgTableModule],
}).compileComponents(); }).compileComponents();

View File

@@ -1,4 +1,5 @@
import { HttpClientTestingModule } from '@angular/common/http/testing'; import { HttpClientTestingModule } from '@angular/common/http/testing';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing'; import { RouterTestingModule } from '@angular/router/testing';
import { EmployeesComponent } from './employees.component'; import { EmployeesComponent } from './employees.component';
@@ -10,6 +11,7 @@ describe('EmployeesComponent', () => {
beforeEach( beforeEach(
waitForAsync(() => { waitForAsync(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
schemas: [CUSTOM_ELEMENTS_SCHEMA],
declarations: [EmployeesComponent], declarations: [EmployeesComponent],
imports: [RouterTestingModule, HttpClientTestingModule], imports: [RouterTestingModule, HttpClientTestingModule],
}).compileComponents(); }).compileComponents();

View File

@@ -1,3 +1,4 @@
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing'; import { RouterTestingModule } from '@angular/router/testing';
import { PageNotFoundComponent } from './page-not-found.component'; import { PageNotFoundComponent } from './page-not-found.component';
@@ -9,6 +10,7 @@ describe('PageNotFoundComponent', () => {
beforeEach( beforeEach(
waitForAsync(() => { waitForAsync(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
schemas: [CUSTOM_ELEMENTS_SCHEMA],
declarations: [PageNotFoundComponent], declarations: [PageNotFoundComponent],
imports: [RouterTestingModule], imports: [RouterTestingModule],
}).compileComponents(); }).compileComponents();

View File

@@ -1,4 +1,5 @@
import { DigiNgTableModule } from '@af/digi-ng/_table/table'; import { DigiNgTableModule } from '@af/digi-ng/_table/table';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing'; import { RouterTestingModule } from '@angular/router/testing';
import { ParticipantsListComponent } from './participants-list.component'; import { ParticipantsListComponent } from './participants-list.component';
@@ -9,6 +10,7 @@ describe('ParticipantsListComponent', () => {
beforeEach(async () => { beforeEach(async () => {
await TestBed.configureTestingModule({ await TestBed.configureTestingModule({
schemas: [CUSTOM_ELEMENTS_SCHEMA],
declarations: [ParticipantsListComponent], declarations: [ParticipantsListComponent],
imports: [RouterTestingModule, DigiNgTableModule], imports: [RouterTestingModule, DigiNgTableModule],
}).compileComponents(); }).compileComponents();

View File

@@ -1,5 +1,6 @@
import { DigiNgSkeletonBaseModule } from '@af/digi-ng/_skeleton/skeleton-base'; import { DigiNgSkeletonBaseModule } from '@af/digi-ng/_skeleton/skeleton-base';
import { HttpClientTestingModule } from '@angular/common/http/testing'; import { HttpClientTestingModule } from '@angular/common/http/testing';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing'; import { RouterTestingModule } from '@angular/router/testing';
import { ParticipantsListModule } from './components/participants-list/participants-list.module'; import { ParticipantsListModule } from './components/participants-list/participants-list.module';
@@ -12,6 +13,7 @@ describe('ParticipantsComponent', () => {
beforeEach( beforeEach(
waitForAsync(() => { waitForAsync(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
schemas: [CUSTOM_ELEMENTS_SCHEMA],
declarations: [ParticipantsComponent], declarations: [ParticipantsComponent],
imports: [RouterTestingModule, HttpClientTestingModule, DigiNgSkeletonBaseModule, ParticipantsListModule], imports: [RouterTestingModule, HttpClientTestingModule, DigiNgSkeletonBaseModule, ParticipantsListModule],
}).compileComponents(); }).compileComponents();

View File

@@ -1,3 +1,4 @@
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing'; import { RouterTestingModule } from '@angular/router/testing';
import { StartComponent } from './start.component'; import { StartComponent } from './start.component';
@@ -9,6 +10,7 @@ describe('StartComponent', () => {
beforeEach( beforeEach(
waitForAsync(() => { waitForAsync(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
schemas: [CUSTOM_ELEMENTS_SCHEMA],
declarations: [StartComponent], declarations: [StartComponent],
imports: [RouterTestingModule], imports: [RouterTestingModule],
}).compileComponents(); }).compileComponents();

View File

@@ -1,8 +1,6 @@
/* tslint:disable:no-unused-variable */ /* tslint:disable:no-unused-variable */
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { DebugElement } from '@angular/core';
import { IconComponent } from './icon.component'; import { IconComponent } from './icon.component';
describe('IconComponent', () => { describe('IconComponent', () => {
@@ -11,9 +9,9 @@ describe('IconComponent', () => {
beforeEach(async(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [ IconComponent ] schemas: [CUSTOM_ELEMENTS_SCHEMA],
}) declarations: [IconComponent],
.compileComponents(); }).compileComponents();
})); }));
beforeEach(() => { beforeEach(() => {

View File

@@ -1,8 +1,9 @@
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core'; import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { IconComponent } from './icon.component'; import { IconComponent } from './icon.component';
@NgModule({ @NgModule({
schemas: [CUSTOM_ELEMENTS_SCHEMA],
declarations: [IconComponent], declarations: [IconComponent],
imports: [CommonModule], imports: [CommonModule],
exports: [IconComponent], exports: [IconComponent],