|
@@ 1053-1061 (lines=9) @@
|
| 1050 |
|
* @covers Jetpack_Photon::filter_the_content |
| 1051 |
|
* @since 8.0.0 |
| 1052 |
|
*/ |
| 1053 |
|
public function test_photon_filter_the_content_ignores_data_width_and_data_height_attributes() { |
| 1054 |
|
$sample_html = '<img src="http://example.com/test.png" class="test" data-width="100" data-height="200" />'; |
| 1055 |
|
$filtered_content = Jetpack_Photon::filter_the_content( $sample_html ); |
| 1056 |
|
$attributes = wp_kses_hair( $filtered_content, wp_allowed_protocols() ); |
| 1057 |
|
$query_str = wp_parse_url( $attributes['src']['value'], PHP_URL_QUERY ); |
| 1058 |
|
parse_str( $query_str, $query_params ); |
| 1059 |
|
|
| 1060 |
|
$this->assertArrayNotHasKey( 'resize', $query_params ); |
| 1061 |
|
} |
| 1062 |
|
|
| 1063 |
|
/** |
| 1064 |
|
* Checks that Photon parses correctly the width and height attributes when they are not preceded by a space. |
|
@@ 1070-1079 (lines=10) @@
|
| 1067 |
|
* @covers Jetpack_Photon::filter_the_content |
| 1068 |
|
* @since 8.0.0 |
| 1069 |
|
*/ |
| 1070 |
|
public function test_photon_filter_the_content_parses_width_height_when_no_spaces_between_attributes() { |
| 1071 |
|
$sample_html = '<img src="http://example.com/test.png" class="test"width="100"height="200" />'; |
| 1072 |
|
$filtered_content = Jetpack_Photon::filter_the_content( $sample_html ); |
| 1073 |
|
$attributes = wp_kses_hair( $filtered_content, wp_allowed_protocols() ); |
| 1074 |
|
$query_str = wp_parse_url( $attributes['src']['value'], PHP_URL_QUERY ); |
| 1075 |
|
parse_str( $query_str, $query_params ); |
| 1076 |
|
|
| 1077 |
|
$this->assertArrayHasKey( 'resize', $query_params ); |
| 1078 |
|
$this->assertEquals( '100,200', $query_params['resize'] ); |
| 1079 |
|
} |
| 1080 |
|
|
| 1081 |
|
/** |
| 1082 |
|
* Data provider for filtered attributes. |