forked from DSpace/dspace-angular
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Customer UK update 15.11.-6.12. (#409)
* by default only deploy to INSTANCE=5 * give more time for postgres init * Update action.yml (#405) Run import from main branch * ufal/fe-update-json-messages Added missing tranlates and updated messages after running the script * ufal/fe-initiated-login-not-redirecting-from-collection Redirect to login with `redirectUrl` param because it is lost after click on `local` login button. (#404) * [devOps] add dspace commands after import * ufal/fe-add-default-static-pages (#406) * Added static pages from the lindat git * Fixed redirection and created safeHtml pipe. * Could redirect out of namespace url, small refactoring. * Updated tests. * Added images into the static pages. * ufal/fe-shibboleth-validate-emails * Encoded query params (#407) --------- Co-authored-by: MajoBerger <[email protected]> Co-authored-by: Jozef Misutka <[email protected]> Co-authored-by: jm <jm@maz>
- Loading branch information
1 parent
c4b7c2e
commit 7d340e3
Showing
42 changed files
with
8,001 additions
and
5,572 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97 changes: 97 additions & 0 deletions
97
src/app/login-page/auth-failed-page/auth-failed-page.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { of as observableOf} from 'rxjs'; | ||
import { ActivatedRoute } from '@angular/router'; | ||
import { ConfigurationDataService } from '../../core/data/configuration-data.service'; | ||
import {createSuccessfulRemoteDataObject$} from '../../shared/remote-data.utils'; | ||
import { ConfigurationProperty } from '../../core/shared/configuration-property.model'; | ||
import { HELP_DESK_PROPERTY } from '../../item-page/tombstone/tombstone.component'; | ||
import { TranslateModule } from '@ngx-translate/core'; | ||
import { AuthFailedPageComponent } from './auth-failed-page.component'; | ||
import { RequestService } from '../../core/data/request.service'; | ||
import { HALEndpointService } from '../../core/shared/hal-endpoint.service'; | ||
import { getMockRemoteDataBuildService } from '../../shared/mocks/remote-data-build.service.mock'; | ||
import { RemoteDataBuildService } from '../../core/cache/builders/remote-data-build.service'; | ||
import { NotificationsServiceStub } from '../../shared/testing/notifications-service.stub'; | ||
import { NotificationsService } from '../../shared/notifications/notifications.service'; | ||
|
||
describe('DuplicateUserErrorComponent', () => { | ||
let component: AuthFailedPageComponent; | ||
let fixture: ComponentFixture<AuthFailedPageComponent>; | ||
let mockConfigurationDataService: ConfigurationDataService; | ||
let requestService: RequestService; | ||
let activatedRoute: any; | ||
let halService: HALEndpointService; | ||
let rdbService: RemoteDataBuildService; | ||
let notificationService: NotificationsServiceStub; | ||
|
||
const rootUrl = 'root url'; | ||
const queryParams = 'netid[idp]'; | ||
const encodedQueryParams = 'netid%5Bidp%5D&email='; | ||
|
||
activatedRoute = { | ||
params: observableOf({}), | ||
snapshot: { | ||
queryParams: { | ||
netid: queryParams | ||
} | ||
} | ||
}; | ||
|
||
mockConfigurationDataService = jasmine.createSpyObj('configurationDataService', { | ||
findByPropertyName: createSuccessfulRemoteDataObject$(Object.assign(new ConfigurationProperty(), { | ||
name: HELP_DESK_PROPERTY, | ||
values: [ | ||
'email' | ||
] | ||
})) | ||
}); | ||
|
||
requestService = jasmine.createSpyObj('requestService', { | ||
send: observableOf('response'), | ||
generateRequestId: observableOf('123456'), | ||
}); | ||
|
||
halService = jasmine.createSpyObj('authService', { | ||
getRootHref: rootUrl, | ||
}); | ||
|
||
rdbService = getMockRemoteDataBuildService(); | ||
notificationService = new NotificationsServiceStub(); | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [ | ||
TranslateModule.forRoot() | ||
], | ||
declarations: [ AuthFailedPageComponent ], | ||
providers: [ | ||
{ provide: ActivatedRoute, useValue: activatedRoute }, | ||
{ provide: ConfigurationDataService, useValue: mockConfigurationDataService }, | ||
{ provide: RequestService, useValue: requestService }, | ||
{ provide: HALEndpointService, useValue: halService }, | ||
{ provide: RemoteDataBuildService, useValue: rdbService }, | ||
{ provide: NotificationsService, useValue: notificationService }, | ||
] | ||
}) | ||
.compileComponents(); | ||
}); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(AuthFailedPageComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
|
||
it('should send request with encoded netId and email param', () => { | ||
component.ngOnInit(); | ||
component.sendEmail(); | ||
expect(requestService.send).toHaveBeenCalledWith(jasmine.objectContaining({ | ||
href: rootUrl + '/autoregistration?netid=' + encodedQueryParams, | ||
})); | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Pipe, PipeTransform } from '@angular/core'; | ||
import { DomSanitizer, SafeHtml } from '@angular/platform-browser'; | ||
|
||
/** | ||
* Pipe to keep html tags e.g., `id` in the `innerHTML` attribute. | ||
*/ | ||
@Pipe({ | ||
name: 'dsSafeHtml' | ||
}) | ||
export class ClarinSafeHtmlPipe implements PipeTransform { | ||
constructor(private sanitized: DomSanitizer) {} | ||
transform(htmlString: string): SafeHtml { | ||
return this.sanitized.bypassSecurityTrustHtml(htmlString); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<div class="container" > | ||
<div [innerHTML]="(htmlContent | async)"></div> | ||
<div [innerHTML]="(htmlContent | async) | dsSafeHtml" (click)="processLinks($event)"></div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.