Skip to content

Commit 5edec6a

Browse files
committed
(#463) Changed clipboard methods to setContent and getContent
1 parent 30edb2a commit 5edec6a

3 files changed

+8
-8
lines changed

lib/clipboard.class.e2e.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ describe("Clipboard class", () => {
77

88
const textToCopy = "bar";
99

10-
SUT.copy(textToCopy);
11-
await expect(SUT.paste()).resolves.toEqual(textToCopy);
10+
SUT.setContent(textToCopy);
11+
await expect(SUT.getContent()).resolves.toEqual(textToCopy);
1212
});
1313
});

lib/clipboard.class.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ describe("Clipboard class", () => {
2626
const textToCopy = "bar";
2727

2828
// WHEN
29-
SUT.copy(textToCopy);
29+
SUT.setContent(textToCopy);
3030

3131
// THEN
3232
expect(copyMock).toHaveBeenCalledTimes(1);
@@ -45,7 +45,7 @@ describe("Clipboard class", () => {
4545
providerRegistryMock.getLogProvider = () => new NoopLogProvider();
4646

4747
// WHEN
48-
SUT.paste();
48+
SUT.getContent();
4949

5050
// THEN
5151
expect(pasteMock).toHaveBeenCalledTimes(1);

lib/clipboard.class.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@ export class ClipboardClass {
1111
constructor(private providerRegistry: ProviderRegistry) {}
1212

1313
/**
14-
* {@link copy} copies a given text to the system clipboard
14+
* {@link setContent} copies a given text to the system clipboard
1515
* @param text The text to copy
1616
*/
17-
public copy(text: string): Promise<void> {
17+
public setContent(text: string): Promise<void> {
1818
this.providerRegistry.getLogProvider().debug(`Saving to clipboard`);
1919
return this.providerRegistry.getClipboard().copy(text);
2020
}
2121

2222
/**
23-
* {@link paste} returns the current content of the system clipboard (limited to text)
23+
* {@link getContent} returns the current content of the system clipboard (limited to text)
2424
*/
25-
public paste(): Promise<string> {
25+
public getContent(): Promise<string> {
2626
this.providerRegistry.getLogProvider().debug(`Fetching clipboard content`);
2727
return this.providerRegistry.getClipboard().paste();
2828
}

0 commit comments

Comments
 (0)