mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
Clean unit test in login component and site (#4908)
* sanatize login style * remove unusefull test in site api
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
<div class="adf-login-content" [style.background-image]="'url(' + backgroundImageUrl + ')'">
|
<div class="adf-login-content" [style.background-image]="getBackgroundUrlImageUrl()">
|
||||||
<div class="adf-ie11FixerParent">
|
<div class="adf-ie11FixerParent">
|
||||||
<div class="adf-ie11FixerChild">
|
<div class="adf-ie11FixerChild">
|
||||||
|
|
||||||
|
@@ -35,6 +35,7 @@ import {
|
|||||||
AppConfigValues
|
AppConfigValues
|
||||||
} from '../../app-config/app-config.service';
|
} from '../../app-config/app-config.service';
|
||||||
import { OauthConfigModel } from '../../models/oauth-config.model';
|
import { OauthConfigModel } from '../../models/oauth-config.model';
|
||||||
|
import { DomSanitizer } from '@angular/platform-browser';
|
||||||
|
|
||||||
enum LoginSteps {
|
enum LoginSteps {
|
||||||
Landing = 0,
|
Landing = 0,
|
||||||
@@ -142,7 +143,8 @@ export class LoginComponent implements OnInit {
|
|||||||
private appConfig: AppConfigService,
|
private appConfig: AppConfigService,
|
||||||
private userPreferences: UserPreferencesService,
|
private userPreferences: UserPreferencesService,
|
||||||
private location: Location,
|
private location: Location,
|
||||||
private route: ActivatedRoute
|
private route: ActivatedRoute,
|
||||||
|
private sanitizer: DomSanitizer
|
||||||
) {
|
) {
|
||||||
this.initFormError();
|
this.initFormError();
|
||||||
this.initFormFieldsMessages();
|
this.initFormFieldsMessages();
|
||||||
@@ -349,6 +351,10 @@ export class LoginComponent implements OnInit {
|
|||||||
event.target.value = event.target.value.trim();
|
event.target.value = event.target.value.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getBackgroundUrlImageUrl() {
|
||||||
|
return this.sanitizer.bypassSecurityTrustStyle(`url(${this.backgroundImageUrl})`);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default formError values
|
* Default formError values
|
||||||
*/
|
*/
|
||||||
|
@@ -106,38 +106,4 @@ describe('Sites service', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('deleteSite should perform a call against the server', (done) => {
|
|
||||||
service.deleteSite('fake-site-id').subscribe(() => {
|
|
||||||
expect(jasmine.Ajax.requests.mostRecent().method).toBe('DELETE');
|
|
||||||
expect(jasmine.Ajax.requests.mostRecent().url)
|
|
||||||
.toContain('alfresco/api/-default-/public/alfresco/versions/1/sites/fake-site-id');
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
|
|
||||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
|
||||||
status: 204
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('getSites catch errors call', (done) => {
|
|
||||||
service.getSites().subscribe(() => {
|
|
||||||
}, () => {
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
|
|
||||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
|
||||||
status: 403
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('getSite catch errors call', (done) => {
|
|
||||||
service.getSite('error-id').subscribe(() => {
|
|
||||||
}, () => {
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
|
|
||||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
|
||||||
status: 403
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user