Skip to content

Commit

Permalink
fix: fix oci routing
Browse files Browse the repository at this point in the history
  • Loading branch information
suschneider committed Jul 15, 2024
1 parent 8cb50c6 commit dfc873b
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
>
{{ 'account.update.button.label' | translate }}
</button>
<a [routerLink]="['/account/punchout', { format: 'oci' }]" class="btn btn-secondary">{{
<a [routerLink]="['/account/punchout']" [queryParams]="{ format: 'oci' }" class="btn btn-secondary">{{
'account.cancel.link' | translate
}}</a>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ <h1>
<div *ngIf="punchoutTypes?.length > 1">
<ul ngbNav class="nav-tabs section" [(activeId)]="selectedType">
<li *ngFor="let type of punchoutTypes" [ngbNavItem]="type" role="presentation">
<a ngbNavLink [routerLink]="['../punchout']" [queryParams]="{ format: type }">{{
<a ngbNavLink [routerLink]="['../punchout']" [queryParams]="{ format: type }" class="mb-0">{{
'account.punchout.type.text' | translate : { '0': type }
}}</a>
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
<button type="submit" class="btn btn-primary" [disabled]="formDisabled" data-testing-id="punchout-user-submit">
{{ (punchoutUser ? 'account.update.button.label' : 'account.user.new.button.create.label') | translate }}
</button>
<a routerLink="../" class="btn btn-secondary">{{ 'account.cancel.link' | translate }}</a>
<a [routerLink]="['../']" [queryParams]="{ format: punchoutType }" class="btn btn-secondary">{{
'account.cancel.link' | translate
}}</a>
</div>
</div>
</form>
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ReactiveFormsModule } from '@angular/forms';
import { RouterTestingModule } from '@angular/router/testing';
import { FormlyForm } from '@ngx-formly/core';
import { TranslateModule } from '@ngx-translate/core';
import { MockComponent } from 'ng-mocks';
Expand All @@ -13,7 +14,7 @@ describe('Punchout User Form Component', () => {

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [ReactiveFormsModule, TranslateModule.forRoot()],
imports: [ReactiveFormsModule, RouterTestingModule, TranslateModule.forRoot()],
declarations: [MockComponent(FormlyForm), PunchoutUserFormComponent],
}).compileComponents();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ describe('Punchout Users Effects', () => {
message: "account.punchout.user.created.message"
messageParams: {"0":"[email protected]"}
`);
expect(location.path()).toMatchInlineSnapshot(`"/account/punchout;format=oci"`);
expect(location.path()).toMatchInlineSnapshot(`"/account/punchout?format=oci"`);
},
error: fail,
complete: done,
Expand Down Expand Up @@ -191,7 +191,7 @@ describe('Punchout Users Effects', () => {
message: "account.punchout.user.updated.message"
messageParams: {"0":"[email protected]"}
`);
expect(location.path()).toMatchInlineSnapshot(`"/account/punchout;format=oci"`);
expect(location.path()).toMatchInlineSnapshot(`"/account/punchout?format=oci"`);
},
error: fail,
complete: done,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class PunchoutUsersEffects {
concatMap(newUser =>
this.punchoutService.createUser(newUser).pipe(
concatMap(user =>
from(this.router.navigate([`/account/punchout`, { format: user.punchoutType }])).pipe(
from(this.router.navigate([`/account/punchout`], { queryParams: { format: user.punchoutType } })).pipe(
mergeMap(() => [
addPunchoutUserSuccess({ user }),
displaySuccessMessage({
Expand All @@ -103,7 +103,7 @@ export class PunchoutUsersEffects {
concatMap(changedUser =>
this.punchoutService.updateUser(changedUser).pipe(
concatMap(user =>
from(this.router.navigate([`/account/punchout`, { format: user.punchoutType }])).pipe(
from(this.router.navigate([`/account/punchout`], { queryParams: { format: user.punchoutType } })).pipe(
mergeMap(() => [
updatePunchoutUserSuccess({ user }),
displaySuccessMessage({
Expand Down

0 comments on commit dfc873b

Please sign in to comment.