Fix incorrect conversion of JS template variable containing path #2657

This commit is contained in:
Kijin Sung 2026-02-05 23:05:19 +09:00
parent 8920cb7491
commit 26c59c251c
2 changed files with 11 additions and 1 deletions

View file

@ -676,6 +676,16 @@ class TemplateParserV2Test extends \Codeception\Test\Unit
$source = '<p class="url(foo.svg)" style="url(../foo.jpg)"> url(img/foo.jpg); } </p>';
$target = '<p class="url(foo.svg)" style="url(' . $this->baseurl . 'tests/_data/foo.jpg)"> url(img/foo.jpg); } </p>';
$this->assertEquals($target, $this->_parse($source));
// No conversion if it's a template variable
$source = '<img src="{ get_image_path(\'foo/bar.jpg\') }" />';
$target = '<img src="{ get_image_path(\'foo/bar.jpg\') }" />';
$this->assertEquals($target, $this->_parse($source));
// No conversion if it's a JS template variable
$source = '@verbatim let src = `<source src="${foo.url}" />` @endverbatim';
$target = ' let src = `<source src="${foo.url}" />` ';
$this->assertEquals($target, $this->_parse($source));
}
public function testBlockConditions()