mirror of
https://github.com/friendica/friendica
synced 2025-04-21 01:50:17 +00:00
Add new ignoreChildren behavior to HTML::tagToBBCode
- Allow discarding HTML tag children for single-value BBCode - Add test for it
This commit is contained in:
parent
d8484e65bd
commit
1f20a9330c
2 changed files with 54 additions and 10 deletions
|
@ -50,4 +50,30 @@ class HTMLTest extends MockedTest
|
|||
|
||||
$this->assertEquals($expected, $output);
|
||||
}
|
||||
|
||||
public function dataHTMLText()
|
||||
{
|
||||
return [
|
||||
'bug-7665-audio-tag' => [
|
||||
'expectedBBCode' => '[audio]http://www.cendrones.fr/colloque2017/jonathanbocquet.mp3[/audio]',
|
||||
'html' => '<audio src="http://www.cendrones.fr/colloque2017/jonathanbocquet.mp3" controls="controls"><a href="http://www.cendrones.fr/colloque2017/jonathanbocquet.mp3">http://www.cendrones.fr/colloque2017/jonathanbocquet.mp3</a></audio>',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Test convert bbcodes to HTML
|
||||
*
|
||||
* @dataProvider dataHTMLText
|
||||
*
|
||||
* @param string $expectedBBCode Expected BBCode output
|
||||
* @param string $html HTML text
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public function testToBBCode($expectedBBCode, $html)
|
||||
{
|
||||
$actual = HTML::toBBCode($html);
|
||||
|
||||
$this->assertEquals($expectedBBCode, $actual);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue