Skip to content

Commit

Permalink
Change technology field to dropdown, increase test coverage img conta…
Browse files Browse the repository at this point in the history
…iner (#97)

* feat: change technology field to dropdown

* feat: increase test coverage in image container

---------

Co-authored-by: Christian Badura <[email protected]>
  • Loading branch information
cbadura and Christian Badura authored Apr 8, 2024
1 parent b3e9d0e commit 263868d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/app/product-store/app-detail/app-detail.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,16 @@
</div>
<div class="col-12 md:col-6" style="min-width: 15rem" [title]="'APP.TOOLTIPS.TECHNOLOGY' | translate">
<span class="p-float-label" controlErrorAnchor>
<input
pInputText
type="text"
<p-dropdown
id="app_detail_form_mfe_technology"
class="w-full pt-3 pb-2"
formControlName="exposedModule"
styleClass="w-full min-w-min input-field-correction"
formControlName="technology"
[pTooltip]="'APP.TOOLTIPS.TECHNOLOGY' | translate"
tooltipPosition="top"
tooltipEvent="focus"
/>
[options]="technologies"
>
</p-dropdown>
<label class="ocx-required-label" for="app_detail_form_mfe_technology">
{{ 'APP.TECHNOLOGY' | translate }}
</label>
Expand Down
4 changes: 4 additions & 0 deletions src/app/product-store/app-detail/app-detail.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ export class AppDetailComponent implements OnChanges {
public loading = false
public hasCreatePermission = false
public hasEditPermission = false
public technologies: SelectItem[] = [
{ label: 'Angular', value: 'ANGULAR' },
{ label: 'WebComponent', value: 'WEBCOMPONENT' }
]
public iconItems: SelectItem[] = [{ label: '', value: null }] // default value is empty
public convertToUniqueStringArray = convertToUniqueStringArray

Expand Down
16 changes: 15 additions & 1 deletion src/app/shared/image-container/image-container.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,26 @@ import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'
import { ImageContainerComponent } from './image-container.component'
import { prepareUrl } from 'src/app/shared/utils'

import { AppStateService } from '@onecx/portal-integration-angular'
import { of } from 'rxjs'

class MockAppStateService {
currentMfe$ = of({
remoteBaseUrl: '/base/'
})
}

describe('ImageContainerComponent', () => {
let component: ImageContainerComponent
let fixture: ComponentFixture<ImageContainerComponent>
let mockAppStateService: MockAppStateService

beforeEach(waitForAsync(() => {
mockAppStateService = new MockAppStateService()

TestBed.configureTestingModule({
declarations: [ImageContainerComponent]
declarations: [ImageContainerComponent],
providers: [{ provide: AppStateService, useValue: mockAppStateService }]
}).compileComponents()
}))

Expand All @@ -20,6 +33,7 @@ describe('ImageContainerComponent', () => {

it('should create', () => {
expect(component).toBeTruthy()
expect(component.defaultImageUrl).toEqual('/base/./assets/images/product.jpg')
})

describe('ngOnChanges', () => {
Expand Down

0 comments on commit 263868d

Please sign in to comment.