mirror of
https://github.com/coder/code-server.git
synced 2026-06-11 12:37:10 +02:00
Squashed 'lib/vscode/' content from commit e5a624b788
git-subtree-dir: lib/vscode git-subtree-split: e5a624b788d92b8d34d1392e4c4d9789406efe8f
This commit is contained in:
72
src/vs/base/test/common/markdownString.test.ts
Normal file
72
src/vs/base/test/common/markdownString.test.ts
Normal file
@@ -0,0 +1,72 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { MarkdownString } from 'vs/base/common/htmlContent';
|
||||
|
||||
suite('MarkdownString', () => {
|
||||
|
||||
test('appendText', () => {
|
||||
|
||||
const mds = new MarkdownString();
|
||||
mds.appendText('# foo\n*bar*');
|
||||
|
||||
assert.equal(mds.value, '\\# foo\n\n\\*bar\\*');
|
||||
});
|
||||
|
||||
suite('ThemeIcons', () => {
|
||||
|
||||
suite('Support On', () => {
|
||||
|
||||
test('appendText', () => {
|
||||
const mds = new MarkdownString(undefined, { supportThemeIcons: true });
|
||||
mds.appendText('$(zap) $(not a theme icon) $(add)');
|
||||
|
||||
assert.equal(mds.value, '\\\\$\\(zap\\) $\\(not a theme icon\\) \\\\$\\(add\\)');
|
||||
});
|
||||
|
||||
test('appendMarkdown', () => {
|
||||
const mds = new MarkdownString(undefined, { supportThemeIcons: true });
|
||||
mds.appendMarkdown('$(zap) $(not a theme icon) $(add)');
|
||||
|
||||
assert.equal(mds.value, '$(zap) $(not a theme icon) $(add)');
|
||||
});
|
||||
|
||||
test('appendMarkdown with escaped icon', () => {
|
||||
const mds = new MarkdownString(undefined, { supportThemeIcons: true });
|
||||
mds.appendMarkdown('\\$(zap) $(not a theme icon) $(add)');
|
||||
|
||||
assert.equal(mds.value, '\\$(zap) $(not a theme icon) $(add)');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
suite('Support Off', () => {
|
||||
|
||||
test('appendText', () => {
|
||||
const mds = new MarkdownString(undefined, { supportThemeIcons: false });
|
||||
mds.appendText('$(zap) $(not a theme icon) $(add)');
|
||||
|
||||
assert.equal(mds.value, '$\\(zap\\) $\\(not a theme icon\\) $\\(add\\)');
|
||||
});
|
||||
|
||||
test('appendMarkdown', () => {
|
||||
const mds = new MarkdownString(undefined, { supportThemeIcons: false });
|
||||
mds.appendMarkdown('$(zap) $(not a theme icon) $(add)');
|
||||
|
||||
assert.equal(mds.value, '$(zap) $(not a theme icon) $(add)');
|
||||
});
|
||||
|
||||
test('appendMarkdown with escaped icon', () => {
|
||||
const mds = new MarkdownString(undefined, { supportThemeIcons: true });
|
||||
mds.appendMarkdown('\\$(zap) $(not a theme icon) $(add)');
|
||||
|
||||
assert.equal(mds.value, '\\$(zap) $(not a theme icon) $(add)');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user