Skip to content

Commit

Permalink
refactor: remove ViewerModule dependency (DSP-1890) (#525)
Browse files Browse the repository at this point in the history
* 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 a99546e
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 23 deletions.
2 changes: 0 additions & 2 deletions src/app/app.module.ts
Expand Up @@ -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';
Expand Down Expand Up @@ -319,7 +318,6 @@ export function httpLoaderFactory(httpClient: HttpClient) {
ClipboardModule,
ColorPickerModule,
CommonModule,
DspViewerModule,
FormsModule,
HttpClientModule,
MaterialModule,
Expand Down
@@ -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>
Expand Down
Expand Up @@ -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';


Expand Down Expand Up @@ -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 {

Expand Down
7 changes: 5 additions & 2 deletions src/app/workspace/resource/resource.component.spec.ts
@@ -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';
Expand All @@ -15,8 +17,9 @@ describe('ResourceComponent', () => {
TestBed.configureTestingModule({
declarations: [ResourceComponent],
imports: [
DspViewerModule,
MatDialogModule,
MatIconModule,
MatSnackBarModule,
RouterTestingModule
],
providers: [
Expand Down
3 changes: 1 addition & 2 deletions src/app/workspace/results/results.component.spec.ts
@@ -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';
Expand All @@ -20,7 +20,6 @@ describe('ResultsComponent', () => {
],
imports: [
AngularSplitModule,
DspViewerModule,
RouterTestingModule
],
providers: [
Expand Down

0 comments on commit a99546e

Please sign in to comment.