From b08d1221e30ce35f1f62fdf6b148da880c141de0 Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Sun, 10 Apr 2022 20:19:18 +0300 Subject: [PATCH] utils: test encoding icon for css that contains + --- packages/utils/tests/encode-url-test.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/packages/utils/tests/encode-url-test.ts b/packages/utils/tests/encode-url-test.ts index c96693d..85e791f 100644 --- a/packages/utils/tests/encode-url-test.ts +++ b/packages/utils/tests/encode-url-test.ts @@ -1,3 +1,4 @@ +import { trimSVG } from '../lib/svg/trim'; import { svgToURL } from '../lib/svg/url'; describe('Testing generating url()', () => { @@ -19,4 +20,20 @@ describe('Testing generating url()', () => { "url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cstyle%3Epath { fill: %23f80; }%3C/style%3E%3Cpath d='M0 0h16v16z' /%3E%3C/svg%3E\")" ); }); + + test('Icon with +', () => { + const html = ` + + + + + + + +`; + const url = svgToURL(trimSVG(html)); + expect(url).toBe( + "url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Crect x='2' y='2' width='20' height='10' fill='currentColor'%3E%3Canimate id='animation1' attributeName='height' values='10;5' dur='0.5s' fill='freeze' /%3E%3Canimate id='animation2' attributeName='width' values='20;5' dur='0.2s' begin='animation1.end+1s' fill='freeze' /%3E%3C/rect%3E%3Crect x='2' y='12' width='20' height='5' fill='currentColor'%3E%3Canimate attributeName='height' values='5;10;5' begin='animation1.end+0.2s;animation2.end-0.2s' dur='0.3s' /%3E%3C/rect%3E%3C/svg%3E\")" + ); + }); });