mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
Revert "[ACS-4051] Copy to clipboard button is now accessible through the keyboard enter earlier which was only accessible through mouse click (#8119)" (#8159)
This reverts commit 067d4e9369335268094b2e05c51dcd4e343e9f1c.
This commit is contained in:
parent
cc33c5dec1
commit
32e4564e14
@ -64,14 +64,6 @@ describe('ClipboardDirective', () => {
|
|||||||
|
|
||||||
expect(clipboardService.copyToClipboard).toHaveBeenCalled();
|
expect(clipboardService.copyToClipboard).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should notify copy target value on mouse enter event', () => {
|
|
||||||
spyOn(clipboardService, 'copyToClipboard');
|
|
||||||
fixture.nativeElement.querySelector('input').value = 'some value';
|
|
||||||
window.dispatchEvent(new KeyboardEvent('keydown', {code: 'Enter', key: 'Enter'}));
|
|
||||||
|
|
||||||
expect(clipboardService.copyToClipboard).toHaveBeenCalled();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('CopyClipboardDirective', () => {
|
describe('CopyClipboardDirective', () => {
|
||||||
@ -136,15 +128,6 @@ describe('CopyClipboardDirective', () => {
|
|||||||
expect(navigator.clipboard.writeText).toHaveBeenCalledWith('text to copy');
|
expect(navigator.clipboard.writeText).toHaveBeenCalledWith('text to copy');
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should copy the content of element on mouse enter', fakeAsync(() => {
|
|
||||||
fixture.detectChanges();
|
|
||||||
spyOn(navigator.clipboard, 'writeText');
|
|
||||||
window.dispatchEvent(new KeyboardEvent('keydown', {code: 'Enter', key: 'Enter'}));
|
|
||||||
tick();
|
|
||||||
fixture.detectChanges();
|
|
||||||
expect(navigator.clipboard.writeText).toHaveBeenCalledWith('text to copy');
|
|
||||||
}));
|
|
||||||
|
|
||||||
it('should not copy the content of element when click it', fakeAsync(() => {
|
it('should not copy the content of element when click it', fakeAsync(() => {
|
||||||
const spanHTMLElement = element.querySelector<HTMLInputElement>('span');
|
const spanHTMLElement = element.querySelector<HTMLInputElement>('span');
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
@ -46,12 +46,6 @@ export class ClipboardDirective {
|
|||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
this.copyToClipboard();
|
this.copyToClipboard();
|
||||||
}
|
}
|
||||||
@HostListener('window:keydown.enter', ['$event'])
|
|
||||||
handleKeyDown(event: KeyboardEvent){
|
|
||||||
event.preventDefault();
|
|
||||||
event.stopPropagation();
|
|
||||||
this.copyToClipboard();
|
|
||||||
}
|
|
||||||
|
|
||||||
@HostListener('mouseenter')
|
@HostListener('mouseenter')
|
||||||
showTooltip() {
|
showTooltip() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user