Skip to content
Permalink
Browse files
refactor: remove ViewerModule dependency (DSP-1890) (#525)
* refactor: removes ViewerModule dependency from tests and switch-properties comp

* refactor: removes ViewerModule import from App module
  • Loading branch information
mdelez committed Sep 7, 2021
1 parent bd60f00 commit a99546ed52ecb5cdbbf2ebfae735a10738c04df4
@@ -7,7 +7,6 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { KnoraApiConnection } from '@dasch-swiss/dsp-js';
import { DspViewerModule } from '@dasch-swiss/dsp-ui';
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { AngularSplitModule } from 'angular-split';
@@ -319,7 +318,6 @@ export function httpLoaderFactory(httpClient: HttpClient) {
ClipboardModule,
ColorPickerModule,
CommonModule,
DspViewerModule,
FormsModule,
HttpClientModule,
MaterialModule,
@@ -1,19 +1,19 @@
<span [ngSwitch]="property.objectType">
<dsp-text-value-as-string #createVal *ngSwitchCase="'ReadTextValueAsString'" [mode]="mode" [valueRequiredValidator]="isRequiredProp" [parentForm]="parentForm" [formName]="formName" ></dsp-text-value-as-string>
<dsp-text-value-as-xml #createVal *ngSwitchCase="'ReadTextValueAsXml'" [mode]="mode" [valueRequiredValidator]="isRequiredProp" [parentForm]="parentForm" [formName]="formName"></dsp-text-value-as-xml>
<dsp-int-value #createVal *ngSwitchCase="constants.IntValue" [mode]="mode" [valueRequiredValidator]="isRequiredProp" [parentForm]="parentForm" [formName]="formName"></dsp-int-value>
<dsp-boolean-value #createVal *ngSwitchCase="constants.BooleanValue" [mode]="mode" [valueRequiredValidator]="isRequiredProp" [parentForm]="parentForm" [formName]="formName"></dsp-boolean-value>
<dsp-uri-value #createVal *ngSwitchCase="constants.UriValue" [mode]="mode" [valueRequiredValidator]="isRequiredProp" [parentForm]="parentForm" [formName]="formName"></dsp-uri-value>
<dsp-decimal-value #createVal *ngSwitchCase="constants.DecimalValue" [mode]="mode" [valueRequiredValidator]="isRequiredProp" [parentForm]="parentForm" [formName]="formName"></dsp-decimal-value>
<dsp-color-value #createVal *ngSwitchCase="constants.ColorValue" [mode]="mode" [valueRequiredValidator]="isRequiredProp" [parentForm]="parentForm" [formName]="formName"></dsp-color-value>
<dsp-interval-value #createVal *ngSwitchCase="constants.IntervalValue" [mode]="mode" [valueRequiredValidator]="isRequiredProp" [parentForm]="parentForm" [formName]="formName"></dsp-interval-value>
<dsp-time-value #createVal *ngSwitchCase="constants.TimeValue" [mode]="mode" [valueRequiredValidator]="isRequiredProp" [parentForm]="parentForm" [formName]="formName"></dsp-time-value>
<dsp-geoname-value #createVal *ngSwitchCase="constants.GeonameValue" [mode]="mode" [valueRequiredValidator]="isRequiredProp" [parentForm]="parentForm" [formName]="formName"></dsp-geoname-value>
<dsp-link-value #createVal *ngSwitchCase="constants.LinkValue" [mode]="mode" [valueRequiredValidator]="isRequiredProp" [parentForm]="parentForm" [formName]="formName"
[parentResource]="parentResource" [propIri]="property.id"></dsp-link-value>
<dsp-date-value #createVal *ngSwitchCase="constants.DateValue" [mode]="mode" [valueRequiredValidator]="isRequiredProp" [parentForm]="parentForm" [formName]="formName"></dsp-date-value>
<dsp-list-value #createVal *ngSwitchCase="constants.ListValue" [mode]="mode" [valueRequiredValidator]="isRequiredProp" [parentForm]="parentForm" [formName]="formName"
[propertyDef]="property"></dsp-list-value>
<app-text-value-as-string #createVal *ngSwitchCase="'ReadTextValueAsString'" [mode]="mode" [valueRequiredValidator]="isRequiredProp" [parentForm]="parentForm" [formName]="formName" ></app-text-value-as-string>
<app-text-value-as-xml #createVal *ngSwitchCase="'ReadTextValueAsXml'" [mode]="mode" [valueRequiredValidator]="isRequiredProp" [parentForm]="parentForm" [formName]="formName"></app-text-value-as-xml>
<app-int-value #createVal *ngSwitchCase="constants.IntValue" [mode]="mode" [valueRequiredValidator]="isRequiredProp" [parentForm]="parentForm" [formName]="formName"></app-int-value>
<app-boolean-value #createVal *ngSwitchCase="constants.BooleanValue" [mode]="mode" [valueRequiredValidator]="isRequiredProp" [parentForm]="parentForm" [formName]="formName"></app-boolean-value>
<app-uri-value #createVal *ngSwitchCase="constants.UriValue" [mode]="mode" [valueRequiredValidator]="isRequiredProp" [parentForm]="parentForm" [formName]="formName"></app-uri-value>
<app-decimal-value #createVal *ngSwitchCase="constants.DecimalValue" [mode]="mode" [valueRequiredValidator]="isRequiredProp" [parentForm]="parentForm" [formName]="formName"></app-decimal-value>
<app-color-value #createVal *ngSwitchCase="constants.ColorValue" [mode]="mode" [valueRequiredValidator]="isRequiredProp" [parentForm]="parentForm" [formName]="formName"></app-color-value>
<app-interval-value #createVal *ngSwitchCase="constants.IntervalValue" [mode]="mode" [valueRequiredValidator]="isRequiredProp" [parentForm]="parentForm" [formName]="formName"></app-interval-value>
<app-time-value #createVal *ngSwitchCase="constants.TimeValue" [mode]="mode" [valueRequiredValidator]="isRequiredProp" [parentForm]="parentForm" [formName]="formName"></app-time-value>
<app-geoname-value #createVal *ngSwitchCase="constants.GeonameValue" [mode]="mode" [valueRequiredValidator]="isRequiredProp" [parentForm]="parentForm" [formName]="formName"></app-geoname-value>
<app-link-value #createVal *ngSwitchCase="constants.LinkValue" [mode]="mode" [valueRequiredValidator]="isRequiredProp" [parentForm]="parentForm" [formName]="formName"
[parentResource]="parentResource" [propIri]="property.id"></app-link-value>
<app-date-value #createVal *ngSwitchCase="constants.DateValue" [mode]="mode" [valueRequiredValidator]="isRequiredProp" [parentForm]="parentForm" [formName]="formName"></app-date-value>
<app-list-value #createVal *ngSwitchCase="constants.ListValue" [mode]="mode" [valueRequiredValidator]="isRequiredProp" [parentForm]="parentForm" [formName]="formName"
[propertyDef]="property"></app-list-value>
<span *ngSwitchDefault>
<p>Cannot match any value component for <strong>{{property.objectType}}</strong></p>
</span>
@@ -3,7 +3,7 @@ import { Component, Inject, Input, OnInit, ViewChild } from '@angular/core';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
import { CreateIntValue, CreateValue, MockOntology, ReadResource, ResourcePropertyDefinition } from '@dasch-swiss/dsp-js';
import { IntValueComponent } from '@dasch-swiss/dsp-ui';
import { IntValueComponent } from '../../../values/int-value/int-value.component';
import { SwitchPropertiesComponent } from './switch-properties.component';


@@ -46,7 +46,7 @@ class TestSwitchPropertiesParentComponent implements OnInit {
* mock value component to use in tests.
*/
@Component({
selector: 'dsp-int-value'
selector: 'app-int-value'
})
class MockCreateIntValueComponent implements OnInit {

@@ -1,8 +1,10 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { MatDialogModule } from '@angular/material/dialog';
import { MatIconModule } from '@angular/material/icon';
import { MatSnackBarModule } from '@angular/material/snack-bar';
import { RouterTestingModule } from '@angular/router/testing';
import { KnoraApiConnection } from '@dasch-swiss/dsp-js';
import { AppInitService, DspViewerModule } from '@dasch-swiss/dsp-ui';
import { AppInitService } from '@dasch-swiss/dsp-ui';
import { DspApiConfigToken, DspApiConnectionToken } from 'src/app/main/declarations/dsp-api-tokens';
import { TestConfig } from 'test.config';
import { ResourceComponent } from './resource.component';
@@ -15,8 +17,9 @@ describe('ResourceComponent', () => {
TestBed.configureTestingModule({
declarations: [ResourceComponent],
imports: [
DspViewerModule,
MatDialogModule,
MatIconModule,
MatSnackBarModule,
RouterTestingModule
],
providers: [
@@ -1,7 +1,7 @@
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { KnoraApiConnection } from '@dasch-swiss/dsp-js';
import { AppInitService, DspViewerModule } from '@dasch-swiss/dsp-ui';
import { AppInitService } from '@dasch-swiss/dsp-ui';
import { AngularSplitModule } from 'angular-split';
import { DspApiConfigToken, DspApiConnectionToken } from 'src/app/main/declarations/dsp-api-tokens';
import { TestConfig } from 'test.config';
@@ -20,7 +20,6 @@ describe('ResultsComponent', () => {
],
imports: [
AngularSplitModule,
DspViewerModule,
RouterTestingModule
],
providers: [

0 comments on commit a99546e

Please sign in to comment.