mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
invert show default properties (#1858)
* invert show default properties * fix test
This commit is contained in:
parent
fc728676c0
commit
b5ebe5bc47
@ -166,8 +166,8 @@ platformBrowserDynamic().bootstrapModule(AppModule);
|
|||||||
| `logoImageUrl` | string | Alfresco logo image | To change the logo image with a customised image |
|
| `logoImageUrl` | string | Alfresco logo image | To change the logo image with a customised image |
|
||||||
| `backgroundImageUrl` | string | Alfresco background image | To change the background image with a customised image |
|
| `backgroundImageUrl` | string | Alfresco background image | To change the background image with a customised image |
|
||||||
| `fieldsValidation` | { [key: string]: any; }, extra?: { [key: string]: any; } | | Use it to customise the validation rules of the login form |
|
| `fieldsValidation` | { [key: string]: any; }, extra?: { [key: string]: any; } | | Use it to customise the validation rules of the login form |
|
||||||
| `showRememberMe` | boolean | false | Toggle `Remember me` checkbox visibility |
|
| `showRememberMe` | boolean | true | Toggle `Remember me` checkbox visibility |
|
||||||
| `showLoginActions` | boolean | false | Toggle extra actions visibility (`Need Help`, `Register`, etc.) |
|
| `showLoginActions` | boolean | true | Toggle extra actions visibility (`Need Help`, `Register`, etc.) |
|
||||||
|
|
||||||
#### Events
|
#### Events
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
"tslint": "../node_modules/tslint/bin/tslint -c ../config/assets/tslint.json 'src/{,**/}**.ts' 'index.ts' -e '{,**/}**.d.ts'",
|
"tslint": "../node_modules/tslint/bin/tslint -c ../config/assets/tslint.json 'src/{,**/}**.ts' 'index.ts' -e '{,**/}**.d.ts'",
|
||||||
"tsc": "../node_modules/typescript/bin/tsc",
|
"tsc": "../node_modules/typescript/bin/tsc",
|
||||||
"test": "../node_modules/karma/bin/karma start ../config/karma.conf.js --reporters mocha,coverage --single-run --component ng2-alfresco-login",
|
"test": "../node_modules/karma/bin/karma start ../config/karma.conf.js --reporters mocha,coverage --single-run --component ng2-alfresco-login",
|
||||||
"test-browser": "concurrently \"../node_modules/karma/bin/karma start ../config/karma.conf.js --reporters kjhtml --component ng2-alfresco-login\"",
|
"test-browser": "../node_modules/karma/bin/karma start ../config/karma.conf.js --reporters kjhtml --component ng2-alfresco-login",
|
||||||
"coverage": "npm run test && ../node_modules/wsrv/bin/wsrv -o -p 9875 ./coverage/report",
|
"coverage": "npm run test && ../node_modules/wsrv/bin/wsrv -o -p 9875 ./coverage/report",
|
||||||
"publish:prod": "npm run test && npm publish"
|
"publish:prod": "npm run test && npm publish"
|
||||||
},
|
},
|
||||||
|
@ -63,18 +63,18 @@
|
|||||||
<button type="submit" id="login-button" tabindex="3"
|
<button type="submit" id="login-button" tabindex="3"
|
||||||
class="center mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--colored"
|
class="center mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--colored"
|
||||||
data-automation-id="login-button" [disabled]="!form.valid">{{'LOGIN.BUTTON.LOGIN' | translate }}</button>
|
data-automation-id="login-button" [disabled]="!form.valid">{{'LOGIN.BUTTON.LOGIN' | translate }}</button>
|
||||||
<div *ngIf="showRememberMe" class="adf-login__remember-me">
|
<div *ngIf="showRememberMe" class="adf-login__remember-me" id ="login-remember">
|
||||||
<md-checkbox>{{'LOGIN.LABEL.REMEMBER' | translate }}</md-checkbox>
|
<md-checkbox>{{'LOGIN.LABEL.REMEMBER' | translate }}</md-checkbox>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="showLoginActions" class="mdl-card__actions mdl-card--border mdl-card__link">
|
<div class="mdl-card__actions mdl-card--border mdl-card__link">
|
||||||
|
|
||||||
<!--FOOTER TEMPLATE-->
|
<!--FOOTER TEMPLATE-->
|
||||||
<template *ngIf="footerTemplate"
|
<template *ngIf="footerTemplate"
|
||||||
ngFor [ngForOf]="[data]"
|
ngFor [ngForOf]="[data]"
|
||||||
[ngForTemplate]="footerTemplate">
|
[ngForTemplate]="footerTemplate">
|
||||||
</template>
|
</template>
|
||||||
<div class="login-action" *ngIf="!footerTemplate">
|
<div class="login-action" *ngIf="!footerTemplate && showLoginActions">
|
||||||
<div id="login-action-help" class="login-action-left">
|
<div id="login-action-help" class="login-action-left">
|
||||||
<a href="{{needHelpLink}}">{{'LOGIN.ACTION.HELP' | translate }}</a>
|
<a href="{{needHelpLink}}">{{'LOGIN.ACTION.HELP' | translate }}</a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -63,17 +63,15 @@ describe('AlfrescoLogin', () => {
|
|||||||
expect(element.querySelector('[for="username"]')).toBeDefined();
|
expect(element.querySelector('[for="username"]')).toBeDefined();
|
||||||
expect(element.querySelector('[for="username"]').innerText).toEqual('LOGIN.LABEL.USERNAME');
|
expect(element.querySelector('[for="username"]').innerText).toEqual('LOGIN.LABEL.USERNAME');
|
||||||
|
|
||||||
|
expect(element.querySelector('#login-remember')).toBeDefined();
|
||||||
|
expect(element.querySelector('#login-remember').innerText).toContain('LOGIN.LABEL.REMEMBER');
|
||||||
|
|
||||||
expect(element.querySelector('[for="password"]')).toBeDefined();
|
expect(element.querySelector('[for="password"]')).toBeDefined();
|
||||||
expect(element.querySelector('[for="password"]').innerText).toEqual('LOGIN.LABEL.PASSWORD');
|
expect(element.querySelector('[for="password"]').innerText).toEqual('LOGIN.LABEL.PASSWORD');
|
||||||
|
|
||||||
expect(element.querySelector('#login-button')).toBeDefined();
|
expect(element.querySelector('#login-button')).toBeDefined();
|
||||||
expect(element.querySelector('#login-button').innerText).toEqual('LOGIN.BUTTON.LOGIN');
|
expect(element.querySelector('#login-button').innerText).toEqual('LOGIN.BUTTON.LOGIN');
|
||||||
|
|
||||||
/*
|
|
||||||
expect(element.querySelector('#login-remember')).toBeDefined();
|
|
||||||
expect(element.querySelector('#login-remember').innerText).toEqual('LOGIN.LABEL.REMEMBER');
|
|
||||||
*/
|
|
||||||
|
|
||||||
expect(element.querySelector('#login-action-help')).toBeDefined();
|
expect(element.querySelector('#login-action-help')).toBeDefined();
|
||||||
expect(element.querySelector('#login-action-help').innerText).toEqual('LOGIN.ACTION.HELP');
|
expect(element.querySelector('#login-action-help').innerText).toEqual('LOGIN.ACTION.HELP');
|
||||||
|
|
||||||
@ -89,6 +87,23 @@ describe('AlfrescoLogin', () => {
|
|||||||
expect(element.querySelector('input[type="text"]').value).toEqual('');
|
expect(element.querySelector('input[type="text"]').value).toEqual('');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should hide remember me if showRememberMe is false', () => {
|
||||||
|
component.showRememberMe = false;
|
||||||
|
|
||||||
|
fixture.detectChanges();
|
||||||
|
|
||||||
|
expect(element.querySelector('#login-remember')).toBe(null);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should hide login actions if showLoginActions is false', () => {
|
||||||
|
component.showLoginActions = false;
|
||||||
|
|
||||||
|
fixture.detectChanges();
|
||||||
|
|
||||||
|
expect(element.querySelector('#login-action-help')).toBe(null);
|
||||||
|
expect(element.querySelector('#login-action-register')).toBe(null);
|
||||||
|
});
|
||||||
|
|
||||||
it('should render validation min-length error when the username is just 1 character', () => {
|
it('should render validation min-length error when the username is just 1 character', () => {
|
||||||
usernameInput.value = '1';
|
usernameInput.value = '1';
|
||||||
usernameInput.dispatchEvent(new Event('input'));
|
usernameInput.dispatchEvent(new Event('input'));
|
||||||
|
@ -33,10 +33,10 @@ export class AlfrescoLoginComponent implements OnInit {
|
|||||||
isPasswordShow: boolean = false;
|
isPasswordShow: boolean = false;
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
showRememberMe: boolean = false;
|
showRememberMe: boolean = true;
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
showLoginActions: boolean = false;
|
showLoginActions: boolean = true;
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
needHelpLink: string = '';
|
needHelpLink: string = '';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user