Skip to content

Commit

Permalink
Modify asciidoctorconfig.test.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
marieflorescontact committed Oct 10, 2022
1 parent 31d6e4a commit 844b47f
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions src/test/asciidoctorconfig.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import * as assert from 'assert'
import * as vscode from 'vscode'
import { AsciidocParser } from '../asciidocParser'
import { AsciidocContributionProvider, AsciidocContributions } from '../asciidocExtensions'
import { AsciidocPreview } from '../features/preview'
import { AsciidoctorExtensionsSecurityPolicyArbiter } from '../security'
import { WebviewResourceProvider } from '../util/resources'

Expand Down Expand Up @@ -55,20 +54,11 @@ suite('asciidoc.Asciidoctorconfig', () => {
})

test('Pick up config from root workspace folder', async () => {
const webview = vscode.window.createWebviewPanel(
AsciidocPreview.viewType,
'Test',
vscode.ViewColumn.One
)
try {
const root = vscode.workspace.workspaceFolders[0].uri.fsPath
const file = await vscode.workspace.openTextDocument(vscode.Uri.file(`${root}/attributes.adoc`))
// eslint-disable-next-line max-len
const asciidocParser = new AsciidocParser(new AsciidocContributionProviderTest(extensionContext.extensionUri), new AsciidoctorExtensionsSecurityPolicyArbiter(extensionContext))
const { html } = await asciidocParser.convertUsingJavascript(file.getText(), file, extensionContext, new TestWebviewResourceProvider())
assert.strictEqual(html.includes('<h1>Asciidoctor VS Code Extension</h1>'), true, '{application-name} should be substituted by the value defined in .asciidoctorconfig')
} finally {
webview.dispose()
}
const root = vscode.workspace.workspaceFolders[0].uri.fsPath
const file = await vscode.workspace.openTextDocument(vscode.Uri.file(`${root}/attributes.adoc`))
// eslint-disable-next-line max-len
const asciidocParser = new AsciidocParser(new AsciidocContributionProviderTest(extensionContext.extensionUri), new AsciidoctorExtensionsSecurityPolicyArbiter(extensionContext))
const { html } = await asciidocParser.convertUsingJavascript(file.getText(), file, extensionContext, new TestWebviewResourceProvider())
assert.strictEqual(html.includes('<h1>Asciidoctor VS Code Extension</h1>'), true, '{application-name} should be substituted by the value defined in .asciidoctorconfig')
})
})

0 comments on commit 844b47f

Please sign in to comment.