Skip to content

Commit

Permalink
fix: app detail tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Badura committed Aug 7, 2024
1 parent c16482b commit 2b1c817
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 30 deletions.
29 changes: 0 additions & 29 deletions src/app/product-store/app-detail/app-detail.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
MicrofrontendType
} from 'src/app/shared/generated'
import { AppAbstract } from '../app-search/app-search.component'
import { TabView } from 'primeng/tabview'

const form = new FormGroup<MfeForm>({
appId: new FormControl('id', Validators.minLength(2)),
Expand Down Expand Up @@ -598,38 +597,10 @@ describe('AppDetailComponent', () => {

it('should update tabIndex onTabPanelChange', () => {
const mockEvent = { index: 3 }
spyOn(component as any, 'preparePanelHeight')

component.onTabPanelChange(mockEvent)

expect(component.tabIndex).toBe(mockEvent.index)
expect((component as any).preparePanelHeight).toHaveBeenCalled()
})

it('should return when no panelDetail preparePanelHeight', () => {
component.panelDetail = undefined

component.onTabPanelChange({ index: 3 })

expect((component as any).panelHeight).toBe(0)
})

it('should preparePanelHeight', () => {
const nativeElement = document.createElement('div')
nativeElement.style.height = '100px' // cannot reach the correct value offsetHeight, this test is quite useless
const mockTabView: Partial<TabView> = {
el: {
nativeElement: nativeElement
},
style: {},
styleClass: ''
}
component.panelDetail = mockTabView as any
spyOn((component as any).renderer, 'setStyle').and.callThrough()

component.onTabPanelChange({ index: 3 })

expect((component as any).panelHeight).toBe(0)
})

it('should call this.user.lang$ from the constructor and set this.dateFormat to the default format if user.lang$ is not de', () => {
Expand Down
1 change: 0 additions & 1 deletion src/app/product-store/app-detail/app-detail.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ export class AppDetailComponent implements OnInit, OnChanges {
public formGroupMfe: FormGroup
public formGroupMs: FormGroup
public tabIndex = 0
private panelHeight = 0
public dialogTitleKey = ''
public loading = false
public operator = false
Expand Down

0 comments on commit 2b1c817

Please sign in to comment.