public function test__args__placeholder() { $source = '<iframe src="https://example.com/video/132886713" width="500" height="281"></iframe>'; $expected = '<amp-iframe src="https://example.com/video/132886713" width="500" height="281" sandbox="allow-scripts allow-same-origin" sizes="(min-width: 500px) 500px, 100vw" class="amp-wp-enforced-sizes"><div placeholder="" class="amp-wp-iframe-placeholder"></div></amp-iframe>'; $dom = AMP_DOM_Utils::get_dom_from_content($source); $sanitizer = new AMP_Iframe_Sanitizer($dom, array('add_placeholder' => true)); $sanitizer->sanitize(); $content = AMP_DOM_Utils::get_content_from_dom($dom); $this->assertEquals($expected, $content); }
public function test_get_scripts__did_convert() { $source = '<iframe src="https://player.vimeo.com/video/132886713" width="500" height="281"></iframe>'; $expected = array('amp-iframe' => 'https://cdn.ampproject.org/v0/amp-iframe-0.1.js'); $dom = AMP_DOM_Utils::get_dom_from_content($source); $sanitizer = new AMP_Iframe_Sanitizer($dom); $sanitizer->sanitize(); $scripts = $sanitizer->get_scripts(); $this->assertEquals($expected, $scripts); }