From 4439b5dc64e64156f050a8574c0e0150d9e0c157 Mon Sep 17 00:00:00 2001
From: Dinh Nguyen <127725498+ntqdinh-axonivy@users.noreply.github.com>
Date: Fri, 13 Dec 2024 15:33:28 +0700
Subject: [PATCH] MARP-1642 Application Freezing due to missing product detail
content (#258)
---
.../product-detail/product-detail.component.html | 2 +-
.../product-detail.component.spec.ts | 16 ++++++++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/marketplace-ui/src/app/modules/product/product-detail/product-detail.component.html b/marketplace-ui/src/app/modules/product/product-detail/product-detail.component.html
index 129825a0..a7a2515f 100644
--- a/marketplace-ui/src/app/modules/product/product-detail/product-detail.component.html
+++ b/marketplace-ui/src/app/modules/product/product-detail/product-detail.component.html
@@ -160,7 +160,7 @@
[id]="displayedTab.value"
role="tabpanel"
[attr.aria-labelledby]="displayedTab.value + '-tab'">
- @if (displayedTab.value === 'dependency') {
+ @if (displayedTab.value === 'dependency' && productDetail().productModuleContent) {
diff --git a/marketplace-ui/src/app/modules/product/product-detail/product-detail.component.spec.ts b/marketplace-ui/src/app/modules/product/product-detail/product-detail.component.spec.ts
index d379ea5d..b3e14d5a 100644
--- a/marketplace-ui/src/app/modules/product/product-detail/product-detail.component.spec.ts
+++ b/marketplace-ui/src/app/modules/product/product-detail/product-detail.component.spec.ts
@@ -808,4 +808,20 @@ describe('ProductDetailComponent', () => {
expect(rateConnector.childNodes[0].nativeNode.textContent).toContain("common.feedback.rateFeedbackForUtilityBtnLabel");
expect(rateConnectorEmptyText.childNodes[0].nativeNode.textContent).toContain("common.feedback.noFeedbackForUtilityLabel");
});
+
+ it('maven tab should not display when product module content is missing', () => {
+ const event = { value: 'dependency' };
+ component.onTabChange(event.value);
+ fixture.detectChanges();
+ let mavenTab = fixture.debugElement.query(
+ By.css('app-product-detail-maven-content')
+ );
+ expect(mavenTab).toBeTruthy();
+ component.productModuleContent.set({} as any as ProductModuleContent);
+ fixture.detectChanges();
+ mavenTab = fixture.debugElement.query(
+ By.css('app-product-detail-maven-content')
+ );
+ expect(mavenTab).toBeFalsy();
+ });
});