Clean unit test in login component and site (#4908)

* sanatize login style

* remove unusefull test in site api
This commit is contained in:
Eugenio Romano
2019-07-08 16:54:34 +01:00
committed by GitHub
parent abc376ff33
commit d9a251a0c8
3 changed files with 8 additions and 36 deletions

View File

@@ -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-ie11FixerChild">

View File

@@ -35,6 +35,7 @@ import {
AppConfigValues
} from '../../app-config/app-config.service';
import { OauthConfigModel } from '../../models/oauth-config.model';
import { DomSanitizer } from '@angular/platform-browser';
enum LoginSteps {
Landing = 0,
@@ -142,7 +143,8 @@ export class LoginComponent implements OnInit {
private appConfig: AppConfigService,
private userPreferences: UserPreferencesService,
private location: Location,
private route: ActivatedRoute
private route: ActivatedRoute,
private sanitizer: DomSanitizer
) {
this.initFormError();
this.initFormFieldsMessages();
@@ -349,6 +351,10 @@ export class LoginComponent implements OnInit {
event.target.value = event.target.value.trim();
}
getBackgroundUrlImageUrl() {
return this.sanitizer.bypassSecurityTrustStyle(`url(${this.backgroundImageUrl})`);
}
/**
* Default formError values
*/

View File

@@ -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
});
});
});