[
[
'#type' => 'video_embed_iframe',
],
'',
],
'URL' => [
[
'#type' => 'video_embed_iframe',
'#url' => 'https://www.youtube.com/embed/fdbFVWupSsw',
],
'',
],
'URL, query' => [
[
'#type' => 'video_embed_iframe',
'#url' => 'https://www.youtube.com/embed/fdbFVWupSsw',
'#query' => ['autoplay' => '1'],
],
'',
],
'URL, query, attributes' => [
[
'#type' => 'video_embed_iframe',
'#url' => 'https://www.youtube.com/embed/fdbFVWupSsw',
'#query' => ['autoplay' => '1'],
'#attributes' => [
'width' => '100',
],
],
'',
],
'Query' => [
[
'#type' => 'video_embed_iframe',
'#query' => ['autoplay' => '1'],
],
'',
],
'Query, attributes' => [
[
'#type' => 'video_embed_iframe',
'#query' => ['autoplay' => '1'],
'#attributes' => [
'width' => '100',
],
],
'',
],
'Attributes' => [
[
'#type' => 'video_embed_iframe',
'#attributes' => [
'width' => '100',
],
],
'',
],
'Fragment' => [
[
'#type' => 'video_embed_iframe',
'#url' => 'https://example.com',
'#fragment' => 'test fragment',
],
'',
],
'XSS Testing' => [
[
'#type' => 'video_embed_iframe',
'#attributes' => [
'xss' => '">',
],
'#query' => ['xss' => '">'],
'#url' => '">',
'#fragment' => '">',
],
'',
],
];
}
/**
* Test the video embed iframe renders correctly.
*
* @dataProvider videoEmbedIframeTestCases
*/
public function testVideoEmbedIframe($renderable, $markup) {
$this->assertEquals($markup, trim($this->container->get('renderer')->renderRoot($renderable)));
}
}