mirror of
https://github.com/James-Yu/LaTeX-Workshop.git
synced 2024-10-05 07:37:24 +03:00
Add waitGivenRootFile
This commit is contained in:
parent
5a33152ecc
commit
b6dfdafd4b
@ -7,9 +7,9 @@ import {
|
||||
assertPdfIsGenerated,
|
||||
executeVscodeCommandAfterActivation,
|
||||
getFixtureDir, isDockerEnabled, runTestWithFixture,
|
||||
waitGivenRootFile,
|
||||
waitLatexWorkshopActivated,
|
||||
waitRootFileFound,
|
||||
waitUntil
|
||||
waitRootFileFound
|
||||
} from './utils'
|
||||
|
||||
|
||||
@ -165,24 +165,16 @@ suite('Multi-root workspace test suite', () => {
|
||||
const docA = await vscode.workspace.openTextDocument(texFilePathA)
|
||||
await vscode.window.showTextDocument(docA)
|
||||
const extension = await waitLatexWorkshopActivated()
|
||||
await waitUntil(() => {
|
||||
const rootFile = extension.exports.realExtension?.manager.rootFile
|
||||
return rootFile === docA.fileName
|
||||
})
|
||||
await waitGivenRootFile(docA.fileName)
|
||||
await sleep(1000)
|
||||
const docB = await vscode.workspace.openTextDocument(texFilePathB)
|
||||
await vscode.window.showTextDocument(docB)
|
||||
await waitUntil(() => {
|
||||
const rootFile = extension.exports.realExtension?.manager.rootFile
|
||||
return rootFile === docB.fileName
|
||||
})
|
||||
await waitGivenRootFile(docB.fileName)
|
||||
await sleep(1000)
|
||||
await vscode.window.showTextDocument(docA)
|
||||
await waitUntil(() => {
|
||||
const rootFile = extension.exports.realExtension?.manager.rootFile
|
||||
return rootFile === docA.fileName
|
||||
})
|
||||
await waitGivenRootFile(docA.fileName)
|
||||
await sleep(1000)
|
||||
|
||||
const structure = extension.exports.realExtension?.structureProvider.ds
|
||||
const filesWatched = extension.exports.realExtension?.manager.getFilesWatched()
|
||||
const isStructureOK = structure && structure.length > 0 && structure[0].fileName === docA.fileName
|
||||
|
@ -142,6 +142,14 @@ export function waitRootFileFound() {
|
||||
)
|
||||
}
|
||||
|
||||
export function waitGivenRootFile(file: string) {
|
||||
return waitUntil( async () => {
|
||||
const extension = await waitLatexWorkshopActivated()
|
||||
const rootFile = extension.exports.realExtension?.manager.rootFile
|
||||
return rootFile === file
|
||||
})
|
||||
}
|
||||
|
||||
export async function executeVscodeCommandAfterActivation(command: string) {
|
||||
await waitLatexWorkshopActivated()
|
||||
return vscode.commands.executeCommand(command)
|
||||
|
Loading…
Reference in New Issue
Block a user