mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
[ACS-10319] SR: Personal files: Focus returns to input field instead of remaining on Copy link button (#11272)
This commit is contained in:
@@ -47,15 +47,11 @@ describe('ClipboardService', () => {
|
||||
|
||||
it('should copy text to clipboard', () => {
|
||||
spyOn(navigator.clipboard, 'writeText');
|
||||
spyOn(inputElement, 'select');
|
||||
spyOn(inputElement, 'setSelectionRange');
|
||||
|
||||
inputElement.value = 'some text';
|
||||
|
||||
clipboardService.copyToClipboard(inputElement);
|
||||
|
||||
expect(inputElement.select).toHaveBeenCalledWith();
|
||||
expect(inputElement.setSelectionRange).toHaveBeenCalledWith(0, inputElement.value.length);
|
||||
expect(navigator.clipboard.writeText).toHaveBeenCalledWith('some text');
|
||||
});
|
||||
|
||||
|
||||
@@ -45,8 +45,6 @@ export class ClipboardService {
|
||||
copyToClipboard(target: HTMLInputElement | HTMLTextAreaElement, message?: string) {
|
||||
if (this.isTargetValid(target)) {
|
||||
try {
|
||||
target.select();
|
||||
target.setSelectionRange(0, target.value.length);
|
||||
if (navigator.clipboard) {
|
||||
navigator.clipboard.writeText(target.value);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user