-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #67 from YOCOING/feat/copy-whole-file
[Feat] copy whole file if there is no selection
- Loading branch information
Showing
2 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { after, before } from "mocha"; | ||
|
||
import * as vscode from "vscode"; | ||
|
||
suite("Copy whole code if there is no selected part", () => { | ||
before(async () => { | ||
vscode.window.showInformationMessage("Test is running"); | ||
await vscode.commands.executeCommand("workbench.action.closeAllEditors"); | ||
vscode.window.showInformationMessage("Start testing copy text with file path."); | ||
}); | ||
|
||
const content = "Extension without Selection Test"; | ||
|
||
// [test] 복사된 영역이 없을 때는 자동적으로 파일 전체로 인식 | ||
test("Copy full text to clipboard with no selection", async () => { | ||
const document = await vscode.workspace.openTextDocument({ | ||
content, | ||
language: "javascript", | ||
}); | ||
const editor = await vscode.window.showTextDocument(document); | ||
|
||
editor.selection = new vscode.Selection(0, 0, 0, 0); | ||
await vscode.commands.executeCommand("YOCO.copyTextWithFilePath"); | ||
}); | ||
|
||
after(() => { | ||
vscode.window.showInformationMessage("Test is done."); | ||
}); | ||
}); |