X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=webapp-frontend%2Fsrc%2Fapp%2Fpolicy%2Fric-selector%2Fric-selector.component.spec.ts;h=378279a462adf7f1c7be4bdff3ad8a9e9c26a2c8;hb=66372cb88b6b3e94dada9197c5efeaa7b2c93e17;hp=0306ec4de187ee5558316f0aae4c36538d369a48;hpb=f8f8ed0d00fb9c8ba0ca88f180cad5f13381db2a;p=portal%2Fnonrtric-controlpanel.git diff --git a/webapp-frontend/src/app/policy/ric-selector/ric-selector.component.spec.ts b/webapp-frontend/src/app/policy/ric-selector/ric-selector.component.spec.ts index 0306ec4..378279a 100644 --- a/webapp-frontend/src/app/policy/ric-selector/ric-selector.component.spec.ts +++ b/webapp-frontend/src/app/policy/ric-selector/ric-selector.component.spec.ts @@ -1,6 +1,26 @@ +// - +// ========================LICENSE_START================================= +// O-RAN-SC +// %% +// Copyright (C) 2021: Nordix Foundation +// %% +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ========================LICENSE_END=================================== +// + import { HarnessLoader } from '@angular/cdk/testing'; import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; -import { Component, ViewChild } from '@angular/core'; +import { Component, ViewChild, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { FormBuilder, FormGroup } from '@angular/forms'; import { MatSelectModule } from '@angular/material/select'; @@ -12,9 +32,9 @@ import { PolicyService } from 'src/app/services/policy/policy.service'; import { RicSelectorComponent } from './ric-selector.component'; -let formGroup: FormGroup = new FormGroup({}); describe('RicSelectorComponent', () => { + let formGroup: FormGroup = new FormGroup({}); let component: TestRicSelectorHostComponent; let fixture: ComponentFixture; let loader: HarnessLoader; @@ -38,6 +58,9 @@ describe('RicSelectorComponent', () => { BrowserAnimationsModule, MatSelectModule, ], + schemas: [ + CUSTOM_ELEMENTS_SCHEMA + ], declarations: [ RicSelectorComponent, TestRicSelectorHostComponent @@ -47,7 +70,7 @@ describe('RicSelectorComponent', () => { FormBuilder ] }) - .compileComponents(); + .compileComponents(); fixture = TestBed.createComponent(TestRicSelectorHostComponent); component = fixture.componentInstance; @@ -59,13 +82,6 @@ describe('RicSelectorComponent', () => { expect(component).toBeTruthy(); }); - it('should be added to form group with required validator', async () => { - let ricSelector: MatSelectHarness = await loader.getHarness(MatSelectHarness.with({ selector: '#ricSelector' })); - - expect(formGroup.get('ricSelector')).toBeTruthy(); - expect(await ricSelector.isRequired()).toBeTruthy(); - }); - it('no ric selected', async () => { let ricSelector: MatSelectHarness = await loader.getHarness(MatSelectHarness.with({ selector: '#ricSelector' })); @@ -80,15 +96,15 @@ describe('RicSelectorComponent', () => { const count = (await ricSelector.getOptions()).length; expect(count).toEqual(2); }); -}); -@Component({ - selector: `ric-selector-host-component`, - template: `` -}) -export class TestRicSelectorHostComponent { - @ViewChild(RicSelectorComponent) - private ricSelectorComponent: RicSelectorComponent; - instanceForm: FormGroup = formGroup; - policyTypeName: string = 'policyTypeName'; -} + @Component({ + selector: `ric-selector-host-component`, + template: `` + }) + class TestRicSelectorHostComponent { + @ViewChild(RicSelectorComponent) + private ricSelectorComponent: RicSelectorComponent; + instanceForm: FormGroup = formGroup; + policyTypeName: string = 'policyTypeName'; + } +});