mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-07 18:25:09 +00:00
[ci:force] Fix failing copy to clipboard test (#7631)
This commit is contained in:
parent
24e5893a56
commit
fa82d3216f
@ -121,20 +121,20 @@ describe('CopyClipboardDirective', () => {
|
|||||||
it('should copy the content of element when click it', fakeAsync(() => {
|
it('should 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();
|
||||||
spyOn(document, 'execCommand');
|
spyOn(navigator.clipboard, 'writeText');
|
||||||
spanHTMLElement.dispatchEvent(new Event('click'));
|
spanHTMLElement.dispatchEvent(new Event('click'));
|
||||||
tick();
|
tick();
|
||||||
fixture.detectChanges();
|
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(() => {
|
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();
|
||||||
spyOn(document, 'execCommand');
|
spyOn(navigator.clipboard, 'writeText');
|
||||||
spanHTMLElement.dispatchEvent(new Event('mouseleave'));
|
spanHTMLElement.dispatchEvent(new Event('mouseleave'));
|
||||||
tick();
|
tick();
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
expect(document.execCommand).not.toHaveBeenCalled();
|
expect(navigator.clipboard.writeText).not.toHaveBeenCalled();
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user