mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-02 14:31:31 +01:00
@@ -30,22 +30,23 @@ suite('markdown.engine', () => {
|
||||
});
|
||||
});
|
||||
|
||||
suite('image-caching', () => {
|
||||
suite.only('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" dir="auto">'
|
||||
+ '<img src="img.png" alt="" class="loading" id="image-hash--754511435" data-src="img.png"> '
|
||||
+ '<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" data-src="http://example.org/img.png"> '
|
||||
+ '<img src="img.png" alt="" class="loading" id="image-hash--754511435" data-src="img.png"> '
|
||||
+ '<img src="./img2.png" alt="" class="loading" id="image-hash-265238964" data-src="./img2.png">'
|
||||
+ '</p>\n'
|
||||
,
|
||||
containingImages: [{ src: 'img.png' }, { src: 'http://example.org/img.png' }, { src: 'img.png' }, { src: './img2.png' }],
|
||||
});
|
||||
const result = await engine.render(input);
|
||||
assert.deepStrictEqual(result.html,
|
||||
'<p data-line="0" class="code-line" dir="auto">'
|
||||
+ '<img src="img.png" alt="" data-src="img.png"> '
|
||||
+ '<a href="no-img.png" data-href="no-img.png"></a> '
|
||||
+ '<img src="http://example.org/img.png" alt="" data-src="http://example.org/img.png"> '
|
||||
+ '<img src="img.png" alt="" data-src="img.png"> '
|
||||
+ '<img src="./img2.png" alt="" data-src="./img2.png">'
|
||||
+ '</p>\n'
|
||||
);
|
||||
|
||||
assert.deepStrictEqual([...result.containingImages], ['img.png', 'http://example.org/img.png', './img2.png']);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user