mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-23 10:08:49 +01:00
Refresh Images In Markdown Preview On Change (#114083)
* Refresh Images In Markdown Preview On Change (implements #65258). * Fixes tests. * Implements etags. * Adds tests for urlToUri. * Updates doc comment.
This commit is contained in:
committed by
GitHub
parent
686cd7df53
commit
1f8643ef76
@@ -21,12 +21,31 @@ suite('markdown.engine', () => {
|
||||
test('Renders a document', async () => {
|
||||
const doc = new InMemoryDocument(testFileName, input);
|
||||
const engine = createNewMarkdownEngine();
|
||||
assert.strictEqual(await engine.render(doc), output);
|
||||
assert.strictEqual((await engine.render(doc)).html, output);
|
||||
});
|
||||
|
||||
test('Renders a string', async () => {
|
||||
const engine = createNewMarkdownEngine();
|
||||
assert.strictEqual(await engine.render(input), output);
|
||||
assert.strictEqual((await engine.render(input)).html, output);
|
||||
});
|
||||
});
|
||||
|
||||
suite('image-caching', () => {
|
||||
const input = ' [](no-img.png)   ';
|
||||
|
||||
test('Extracts all images', async () => {
|
||||
const engine = createNewMarkdownEngine();
|
||||
assert.deepStrictEqual((await engine.render(input)), {
|
||||
html: '<p data-line="0" class="code-line">'
|
||||
+ '<img src="img.png" alt="" class="loading" id="image-hash--754511435"> '
|
||||
+ '<a href="no-img.png" data-href="no-img.png"></a> '
|
||||
+ '<img src="http://example.org/img.png" alt="" class="loading" id="image-hash--1903814170"> '
|
||||
+ '<img src="img.png" alt="" class="loading" id="image-hash--754511435"> '
|
||||
+ '<img src="./img2.png" alt="" class="loading" id="image-hash-265238964">'
|
||||
+ '</p>\n'
|
||||
,
|
||||
containingImages: [{ src: 'img.png' }, { src: 'http://example.org/img.png' }, { src: 'img.png' }, { src: './img2.png' }],
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user