mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
* [ACA-2368] UI Issues while editing Metadata in the Preview Page #1091 * tslint fxed * [ACA-2368] UI Issues while editing Metadata in the Preview Page #1091 * * revert commits * Revert "* revert commits" This reverts commit fd0e86084cc4ac14870d9008400528f63a681c59. * * unit test added
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
</mat-expansion-panel-header>
|
||||
|
||||
<adf-card-view
|
||||
(keydown)="keyDown($event)"
|
||||
[properties]="basicProperties$ | async"
|
||||
[editable]="editable"
|
||||
[displayEmpty]="displayEmpty">
|
||||
@@ -30,6 +31,7 @@
|
||||
</mat-expansion-panel-header>
|
||||
|
||||
<adf-card-view
|
||||
(keydown)="keyDown($event)"
|
||||
[properties]="group.properties"
|
||||
[editable]="editable"
|
||||
[displayEmpty]="displayEmpty">
|
||||
|
@@ -352,7 +352,6 @@ describe('ContentMetadataComponent', () => {
|
||||
expect(defaultProp.componentInstance.expanded).toBeTruthy();
|
||||
expect(exifProp.componentInstance.expanded).toBeFalsy();
|
||||
expect(customProp.componentInstance.expanded).toBeFalsy();
|
||||
|
||||
}));
|
||||
|
||||
it('should not expand anything if input is wrong', async(() => {
|
||||
@@ -370,6 +369,35 @@ describe('ContentMetadataComponent', () => {
|
||||
|
||||
}));
|
||||
});
|
||||
|
||||
describe('events', () => {
|
||||
it('should not propagate the event on left arrows press', () => {
|
||||
fixture.detectChanges();
|
||||
const event = { keyCode: 37, stopPropagation: () => {} };
|
||||
spyOn(event, 'stopPropagation').and.stub();
|
||||
const element = fixture.debugElement.query(By.css('adf-card-view'));
|
||||
element.triggerEventHandler('keydown', event);
|
||||
expect(event.stopPropagation).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should not propagate the event on right arrows press', () => {
|
||||
fixture.detectChanges();
|
||||
const event = { keyCode: 39, stopPropagation: () => {} };
|
||||
spyOn(event, 'stopPropagation').and.stub();
|
||||
const element = fixture.debugElement.query(By.css('adf-card-view'));
|
||||
element.triggerEventHandler('keydown', event);
|
||||
expect(event.stopPropagation).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should propagate the event on other keys press', () => {
|
||||
fixture.detectChanges();
|
||||
const event = { keyCode: 40, stopPropagation: () => {} };
|
||||
spyOn(event, 'stopPropagation').and.stub();
|
||||
const element = fixture.debugElement.query(By.css('adf-card-view'));
|
||||
element.triggerEventHandler('keydown', event);
|
||||
expect(event.stopPropagation).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function queryDom(fixture: ComponentFixture<ContentMetadataComponent>, properties: string = 'properties') {
|
||||
|
@@ -174,4 +174,10 @@ export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy {
|
||||
return !this.expanded || this.displayAspect === 'Properties';
|
||||
}
|
||||
|
||||
keyDown(event: KeyboardEvent) {
|
||||
if (event.keyCode === 37 || event.keyCode === 39) { // ArrowLeft && ArrowRight
|
||||
event.stopPropagation();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user