LaTeX-Workshop/test/completion.test.ts
Takashi Tamura 7d0501b21a - Use the height attribute of an img tag to scale an image.
- Remove a dependency on the jimp package.
- Drop the support for VS Code prior to v1.62.0
2021-11-06 11:19:21 +09:00

46 lines
1.4 KiB
TypeScript

import * as assert from 'assert'
// import * as os from 'os'
import * as path from 'path'
import * as process from 'process'
import * as vscode from 'vscode'
import {
getFixtureDir,
// isDockerEnabled,
runTestWithFixture,
waitLatexWorkshopActivated
} from './utils'
suite('Completion test suite', () => {
suiteSetup(() => {
const config = vscode.workspace.getConfiguration()
if (process.env['LATEXWORKSHOP_CI_ENABLE_DOCKER']) {
return config.update('latex-workshop.docker.enabled', true, vscode.ConfigurationTarget.Global)
}
return
})
runTestWithFixture('fixture001', 'basic completion', async () => {
const fixtureDir = getFixtureDir()
const texFileName = 't.tex'
const texFilePath = vscode.Uri.file(path.join(fixtureDir, texFileName))
const doc = await vscode.workspace.openTextDocument(texFilePath)
await vscode.window.showTextDocument(doc)
const extension = await waitLatexWorkshopActivated()
const pos = new vscode.Position(3,1)
const token = new vscode.CancellationTokenSource().token
const items = await extension.exports.realExtension?.completer.provideCompletionItems?.(
doc, pos, token,
{
triggerKind: vscode.CompletionTriggerKind.Invoke,
triggerCharacter: undefined
}
)
assert.ok(items && items.length > 0)
})
})