mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[AAE-17909][AAE-17964] fix silent-refresh url is not set with the value - fix background image set to undefined (#9080)
* [AAE-17909] fix silent-refresh url is not set with the value from the app.config.json * [AAE-17964] fix backgroundImage is undefined, set a default value
This commit is contained in:
@@ -52,7 +52,7 @@ describe('AuthConfigService', () => {
|
||||
secret: '',
|
||||
implicitFlow: true,
|
||||
silentLogin: true,
|
||||
redirectSilentIframeUri: 'http://localhost:3000/assets/silent-refresh.html',
|
||||
redirectSilentIframeUri: 'http://localhost:3000/subfolder/assets/silent-refresh.html',
|
||||
redirectUri: '/subfolder',
|
||||
redirectUriLogout: '#/logout',
|
||||
publicUrls: [
|
||||
@@ -69,7 +69,7 @@ describe('AuthConfigService', () => {
|
||||
secret: '',
|
||||
implicitFlow: true,
|
||||
silentLogin: true,
|
||||
redirectSilentIframeUri: 'http://localhost:3000/assets/silent-refresh.html',
|
||||
redirectSilentIframeUri: 'http://localhost:3000/subfolder2/assets/silent-refresh.html',
|
||||
redirectUri: '/subfolder2',
|
||||
redirectUriLogout: '#/logout',
|
||||
publicUrls: [
|
||||
@@ -135,7 +135,7 @@ describe('AuthConfigService', () => {
|
||||
oidc: true,
|
||||
issuer: 'http://localhost:3000/auth/realms/alfresco',
|
||||
redirectUri: 'http://localhost:3000/#/view/authentication-confirmation/?',
|
||||
silentRefreshRedirectUri: 'http://localhost:3000/silent-refresh.html',
|
||||
silentRefreshRedirectUri: 'http://localhost:3000/assets/silent-refresh.html',
|
||||
postLogoutRedirectUri: 'http://localhost:3000/#/logout',
|
||||
clientId: 'fakeClientId',
|
||||
scope: 'openid profile email',
|
||||
@@ -151,7 +151,7 @@ describe('AuthConfigService', () => {
|
||||
oidc: true,
|
||||
issuer: 'http://localhost:3000/auth/realms/alfresco',
|
||||
redirectUri: 'http://localhost:3000/#/view/authentication-confirmation',
|
||||
silentRefreshRedirectUri: 'http://localhost:3000/silent-refresh.html',
|
||||
silentRefreshRedirectUri: 'http://localhost:3000/assets/silent-refresh.html',
|
||||
postLogoutRedirectUri: 'http://localhost:3000/#/logout',
|
||||
clientId: 'fakeClientId',
|
||||
scope: 'openid profile email',
|
||||
@@ -182,4 +182,18 @@ describe('AuthConfigService', () => {
|
||||
expect(service.getRedirectUri()).toBe(expectedUri);
|
||||
});
|
||||
});
|
||||
|
||||
describe('silentRefreshRedirectUri', () => {
|
||||
it('should return the silentRefreshRedirectUri with subfolder path', () => {
|
||||
const expectedUri = 'http://localhost:3000/subfolder/assets/silent-refresh.html';
|
||||
spyOnProperty(appConfigService, 'oauth2').and.returnValue(mockAuthConfigSubfolderRedirectUri);
|
||||
expect(service.loadAppConfig().silentRefreshRedirectUri).toBe(expectedUri);
|
||||
});
|
||||
|
||||
it('should return the silentRefreshRedirectUri with subfolder2 path', () => {
|
||||
const expectedUri = 'http://localhost:3000/subfolder2/assets/silent-refresh.html';
|
||||
spyOnProperty(appConfigService, 'oauth2').and.returnValue(mockAuthConfigSubfolder2RedirectUri);
|
||||
expect(service.loadAppConfig().silentRefreshRedirectUri).toBe(expectedUri);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@@ -58,7 +58,7 @@ export class AuthConfigService {
|
||||
oidc: oauth2.implicitFlow || oauth2.codeFlow || false,
|
||||
issuer: oauth2.host,
|
||||
redirectUri,
|
||||
silentRefreshRedirectUri: `${origin}/silent-refresh.html`,
|
||||
silentRefreshRedirectUri: oauth2.redirectSilentIframeUri,
|
||||
postLogoutRedirectUri: `${origin}/${oauth2.redirectUriLogout}`,
|
||||
clientId: oauth2.clientId,
|
||||
scope: oauth2.scope,
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<mat-toolbar
|
||||
[color]="color"
|
||||
[style.background-color]="color"
|
||||
[style.background-image]="'url(' + backgroundImage + ')'">
|
||||
[style.background-image]="backgroundImage ? 'url(' + backgroundImage + ')' : 'none'">
|
||||
<button
|
||||
*ngIf="showSidenavToggle && position === 'start'"
|
||||
id="adf-sidebar-toggle-start"
|
||||
|
@@ -81,6 +81,24 @@ describe('HeaderLayoutComponent', () => {
|
||||
expect(await toolbar.getCssValue('background-color')).toBe('rgb(66, 245, 126)');
|
||||
});
|
||||
|
||||
it('should background image be set to none if is not provided', async () => {
|
||||
fixture.detectChanges();
|
||||
|
||||
const toolbarHarness = await loader.getHarness(MatToolbarHarness);
|
||||
const toolbar = await toolbarHarness.host();
|
||||
expect(await toolbar.getCssValue('background-image')).toEqual('none');
|
||||
});
|
||||
|
||||
it('should background image be set to none if is provided as empty string', async () => {
|
||||
component.backgroundImage = '';
|
||||
|
||||
fixture.detectChanges();
|
||||
|
||||
const toolbarHarness = await loader.getHarness(MatToolbarHarness);
|
||||
const toolbar = await toolbarHarness.host();
|
||||
expect(await toolbar.getCssValue('background-image')).toEqual('none');
|
||||
});
|
||||
|
||||
it('should change background image when provided', async () => {
|
||||
component.backgroundImage = '/assets/someImage.png';
|
||||
fixture.detectChanges();
|
||||
|
@@ -49,7 +49,7 @@ export class HeaderLayoutComponent implements OnInit {
|
||||
@Input() color: ThemePalette | string;
|
||||
|
||||
/** Path to a background image for the header. */
|
||||
@Input() backgroundImage: string;
|
||||
@Input() backgroundImage = '';
|
||||
|
||||
/**
|
||||
* Toggles whether the sidenav button will be displayed in the header
|
||||
|
Reference in New Issue
Block a user