Skip to content

Commit

Permalink
Merge pull request #1803 from France-ioi/fix-tab-switch-issue
Browse files Browse the repository at this point in the history
revert PR #1787 as it prevents switching between task tabs
  • Loading branch information
smadbe authored Oct 4, 2024
2 parents ac8eab2 + 8dd1bcd commit 6a5bc54
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
8 changes: 4 additions & 4 deletions e2e/common/lost-changes-confirmation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { test, expect } from './fixture';
import { initAsUsualUser } from 'e2e/helpers/e2e_auth';
import { apiUrl } from 'e2e/helpers/e2e_http';

test('checks navigation to another tab for item', async ({ page, lostChangesConfirmationModal }) => {
test.skip('checks navigation to another tab for item', async ({ page, lostChangesConfirmationModal }) => {
await initAsUsualUser(page);
await test.step('checks cancel modal', async () => {
await page.goto('a/39530140456452546;p=4702,4102,1980584647557587953;a=0/parameters');
Expand Down Expand Up @@ -32,7 +32,7 @@ test('checks navigation to another tab for item', async ({ page, lostChangesConf
});
});

test('checks navigation to another module for item', async ({ page, lostChangesConfirmationModal }) => {
test.skip('checks navigation to another module for item', async ({ page, lostChangesConfirmationModal }) => {
await initAsUsualUser(page);
await test.step('checks cancel modal', async () => {
await page.goto('a/39530140456452546;p=4702,4102,1980584647557587953;a=0/parameters');
Expand Down Expand Up @@ -68,7 +68,7 @@ test('checks navigation to another module for item', async ({ page, lostChangesC
});
});

test('checks navigation to another tab for group', async ({ page, lostChangesConfirmationModal }) => {
test.skip('checks navigation to another tab for group', async ({ page, lostChangesConfirmationModal }) => {
await initAsUsualUser(page);
await test.step('checks cancel modal', async () => {
await page.goto('groups/by-id/4035378957038759250;p=/settings');
Expand Down Expand Up @@ -96,7 +96,7 @@ test('checks navigation to another tab for group', async ({ page, lostChangesCon
});
});

test('checks navigation to another module for group', async ({ page, lostChangesConfirmationModal }) => {
test.skip('checks navigation to another module for group', async ({ page, lostChangesConfirmationModal }) => {
await initAsUsualUser(page);
await test.step('checks cancel modal', async () => {
await page.goto('groups/by-id/4035378957038759250;p=/settings');
Expand Down
11 changes: 3 additions & 8 deletions src/app/services/tab.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Injectable, OnDestroy } from '@angular/core';
import { NavigationCancel, NavigationEnd, Router } from '@angular/router';
import { BehaviorSubject, combineLatest, filter, map, startWith, take, withLatestFrom } from 'rxjs';
import { NavigationEnd, Router } from '@angular/router';
import { BehaviorSubject, combineLatest, filter, map, startWith, withLatestFrom } from 'rxjs';
import { UrlCommand } from '../utils/url';

interface Tab {
Expand Down Expand Up @@ -58,12 +58,7 @@ export class TabService implements OnDestroy {
}

setActiveTab(tag: string|undefined): void {
this.router.events.pipe(
filter(event => event instanceof NavigationEnd || event instanceof NavigationCancel),
take(1),
).subscribe(event => {
if (event instanceof NavigationEnd) this.activeTab.next(tag);
});
this.activeTab.next(tag);
}

private isTabLinkActive(tab: Tab): boolean {
Expand Down

0 comments on commit 6a5bc54

Please sign in to comment.