mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-5009] close all the dialogs after false canActivate event (#5312)
* close all the dialogs after false canActivate event * Update auth-guard-bpm.service.spec.ts * sso fix * fix lint
This commit is contained in:
committed by
Denys Vuika
parent
d7e56b641e
commit
9c83c35e61
@@ -22,6 +22,7 @@ import { AuthenticationService } from './authentication.service';
|
||||
import { RouterStateSnapshot, Router } from '@angular/router';
|
||||
import { setupTestBed } from '../testing/setupTestBed';
|
||||
import { CoreTestingModule } from '../testing/core.testing.module';
|
||||
import { MatDialog } from '@angular/material';
|
||||
|
||||
describe('AuthGuardService ECM', () => {
|
||||
|
||||
@@ -156,4 +157,22 @@ describe('AuthGuardService ECM', () => {
|
||||
expect(router.navigateByUrl).toHaveBeenCalledWith('/fakeLoginRoute?redirectUrl=some-url');
|
||||
}));
|
||||
|
||||
it('should to close the material dialog if is redirect to the login', () => {
|
||||
const materialDialog = TestBed.get(MatDialog);
|
||||
|
||||
spyOn(materialDialog, 'closeAll');
|
||||
|
||||
spyOn(authService, 'setRedirect').and.callThrough();
|
||||
spyOn(router, 'navigateByUrl').and.stub();
|
||||
const route: RouterStateSnapshot = <RouterStateSnapshot> { url: 'some-url' };
|
||||
|
||||
authGuard.canActivate(null, route);
|
||||
|
||||
expect(authService.setRedirect).toHaveBeenCalledWith({
|
||||
provider: 'ECM', url: 'some-url'
|
||||
});
|
||||
|
||||
expect(materialDialog.closeAll).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
});
|
||||
|
Reference in New Issue
Block a user