Skip to content

Commit 077351f

Browse files
committed
test: selects the given selection range
1 parent b0f30d8 commit 077351f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/adapters/show-document-adapter.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { expect } from "chai"
55
import { join, dirname } from "path"
66
import * as ShowDocumentAdapter from "../../lib/adapters/show-document-adapter"
77
import { LanguageClientConnection, ShowDocumentParams } from "../../lib/languageclient"
8+
import Convert from "../../lib/convert"
89
import { createSpyConnection } from "../helpers"
910

1011
describe("ShowDocumentAdapter", () => {
@@ -77,6 +78,17 @@ describe("ShowDocumentAdapter", () => {
7778
const editor = await canShowDocumentInAtom(params)
7879
expect(atom.workspace.getActivePane()?.getItems()[0]).equal(editor)
7980
})
81+
82+
it("selects the given selection range", async () => {
83+
const selectionLSRange = { start: { line: 1, character: 30 }, end: { line: 1, character: 43 } } // `"Hello World"` in JavaScript file
84+
const params: ShowDocumentParams = {
85+
uri: helloPath,
86+
selection: selectionLSRange,
87+
}
88+
const editor = await canShowDocumentInAtom(params)
89+
expect(editor.getSelectedBufferRange()).deep.equal(Convert.lsRangeToAtomRange(selectionLSRange))
90+
expect(editor.getSelectedText()).equal(`"Hello World"`)
91+
})
8092
})
8193

8294
describe("shows document in external programs", () => {

0 commit comments

Comments
 (0)