Add snapshot test for bubble svg strings

This commit is contained in:
Paul Kaplan
2018-05-29 15:07:01 -04:00
parent d7b26ea1be
commit 44c30d76ad
4 changed files with 31 additions and 4 deletions

View File

@@ -1,4 +1,4 @@
/* global vm, Promise */
/* global vm, render, Promise */
const {Chromeless} = require('chromeless');
const test = require('tap').test;
const path = require('path');
@@ -101,6 +101,16 @@ const testFile = file => test(file, async t => {
}
});
const testBubbles = () => test('bubble snapshot', async t => {
const bubbleSvg = await chromeless.goto(`file://${indexHTML}`)
.evaluate(() => {
const testString = '<e*&%$&^$></!abc\'>';
return render._svgTextBubble._buildTextFragment(testString);
});
t.matchSnapshot(bubbleSvg, 'bubble-text-snapshot');
t.end();
});
// immediately invoked async function to let us wait for each test to finish before starting the next.
(async () => {
const files = fs.readdirSync(testDir())
@@ -110,6 +120,8 @@ const testFile = file => test(file, async t => {
await testFile(file);
}
await testBubbles();
// close the browser window we used
await chromeless.end();
})();