mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ci:force] Fix failing copy to clipboard test (#7631)
This commit is contained in:
committed by
GitHub
parent
24e5893a56
commit
fa82d3216f
@@ -121,20 +121,20 @@ describe('CopyClipboardDirective', () => {
|
||||
it('should copy the content of element when click it', fakeAsync(() => {
|
||||
const spanHTMLElement = element.querySelector<HTMLInputElement>('span');
|
||||
fixture.detectChanges();
|
||||
spyOn(document, 'execCommand');
|
||||
spyOn(navigator.clipboard, 'writeText');
|
||||
spanHTMLElement.dispatchEvent(new Event('click'));
|
||||
tick();
|
||||
fixture.detectChanges();
|
||||
expect(document.execCommand).toHaveBeenCalledWith('copy');
|
||||
expect(navigator.clipboard.writeText).toHaveBeenCalledWith('text to copy');
|
||||
}));
|
||||
|
||||
it('should not copy the content of element when click it', fakeAsync(() => {
|
||||
const spanHTMLElement = element.querySelector<HTMLInputElement>('span');
|
||||
fixture.detectChanges();
|
||||
spyOn(document, 'execCommand');
|
||||
spyOn(navigator.clipboard, 'writeText');
|
||||
spanHTMLElement.dispatchEvent(new Event('mouseleave'));
|
||||
tick();
|
||||
fixture.detectChanges();
|
||||
expect(document.execCommand).not.toHaveBeenCalled();
|
||||
expect(navigator.clipboard.writeText).not.toHaveBeenCalled();
|
||||
}));
|
||||
});
|
||||
|
Reference in New Issue
Block a user