From 1e6f1366f6c37c8710946f826b1813e74a9ca346 Mon Sep 17 00:00:00 2001 From: Thuy Nguyen <145430420+nntthuy-axonivy@users.noreply.github.com> Date: Mon, 16 Sep 2024 18:34:33 +0700 Subject: [PATCH] MARP-950: rest client navigate incorrectly in ai designer (#155) --- .../modules/product/product.component.spec.ts | 16 ++++++---------- .../src/app/modules/product/product.component.ts | 2 +- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/marketplace-ui/src/app/modules/product/product.component.spec.ts b/marketplace-ui/src/app/modules/product/product.component.spec.ts index a0bbbacd5..f8fa64d33 100644 --- a/marketplace-ui/src/app/modules/product/product.component.spec.ts +++ b/marketplace-ui/src/app/modules/product/product.component.spec.ts @@ -72,7 +72,9 @@ describe('ProductComponent', () => { { provide: ActivatedRoute, useValue: { - queryParams: of( {[DESIGNER_COOKIE_VARIABLE.restClientParamName]:true} ) + queryParams: of({ + [DESIGNER_COOKIE_VARIABLE.restClientParamName]: true + }) } }, { @@ -91,7 +93,9 @@ describe('ProductComponent', () => { } }) .compileComponents(); - routingQueryParamService = TestBed.inject(RoutingQueryParamService) as jasmine.SpyObj; + routingQueryParamService = TestBed.inject( + RoutingQueryParamService + ) as jasmine.SpyObj; fixture = TestBed.createComponent(ProductComponent); component = fixture.componentInstance; @@ -191,14 +195,6 @@ describe('ProductComponent', () => { expect(component.loadProductItems).not.toHaveBeenCalled(); }); - it('viewProductDetail should navigate', () => { - const productId = 'jira-connector'; - - component.viewProductDetail(productId, ''); - - expect(router.navigate).toHaveBeenCalledWith(['', productId]); - }); - it('should set isRESTClient true based on query params and designer environment', () => { routingQueryParamService.isDesignerEnv.and.returnValue(true); const fixtureTest = TestBed.createComponent(ProductComponent); diff --git a/marketplace-ui/src/app/modules/product/product.component.ts b/marketplace-ui/src/app/modules/product/product.component.ts index 9c3f8e961..37a55a885 100644 --- a/marketplace-ui/src/app/modules/product/product.component.ts +++ b/marketplace-ui/src/app/modules/product/product.component.ts @@ -115,7 +115,7 @@ export class ProductComponent implements AfterViewInit, OnDestroy { } viewProductDetail(productId: string, _productTag: string) { - this.router.navigate(['', productId]); + window.location.href = `/${productId}`; } onFilterChange(selectedType: ItemDropdown) {