Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update AMP validator spec to 2011140244000 #5608

Merged
merged 7 commits into from
Nov 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions assets/src/block-editor/helpers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,9 @@ const ampLayoutOptions = [
],
},
{
// Not supported by video.
value: 'intrinsic',
label: __( 'Intrinsic', 'amp' ),
notAvailable: [
'core/video',
'core-embed/youtube',
'core-embed/facebook',
'core-embed/instagram',
Expand Down
2 changes: 1 addition & 1 deletion bin/ci/after-wp-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ fi
if [[ -n $INSTALL_PWA_PLUGIN ]]; then
echo -n "Installing PWA plugin..."
wget -O "$WP_CORE_DIR/src/wp-content/plugins/pwa.zip" https://downloads.wordpress.org/plugin/pwa.zip
unzip -d "$WP_CORE_DIR/src/wp-content/plugins/pwa/" "$WP_CORE_DIR/src/wp-content/plugins/pwa.zip"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How did you come across this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed a series of skipped tests in the PHPUnit output, and traced it back to the Test_AMP_Service_Worker class being skipped. Those tests are only skipped when the PWA plugin is not active.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PWA plugin was being extracted to the directory $WP_CORE_DIR/src/wp-content/plugins/pwa/pwa, which didn't match the hardcoded path used to activate the plugin.

unzip -d "$WP_CORE_DIR/src/wp-content/plugins/" "$WP_CORE_DIR/src/wp-content/plugins/pwa.zip"
echo "done"
fi

Expand Down
116 changes: 105 additions & 11 deletions includes/sanitizers/class-amp-allowed-tags-generated.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 10 additions & 3 deletions tests/php/test-tag-and-attribute-sanitizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ static function () {
<amp-story-page id="my-second-page">
<amp-analytics config="https://example.com/analytics.account.config.json"></amp-analytics>
<amp-story-grid-layer template="fill">
<amp-story-360 layout="responsive" width="100" height="100" heading-start="-45" pitch-start="-20" heading-end="95" pitch-end="-10" zoom-end="4" duration="30s">
<amp-story-360 controls="gyroscope" layout="fixed" width="100" height="100" heading-start="-45" pitch-start="-20" heading-end="95" pitch-end="-10" scene-heading="0.00" scene-pitch="0.00" scene-roll="0.00" zoom-end="4" duration="30s">
<amp-img src="img/panorama1.jpg" layout="fixed" width="200" height="100" crossorigin="anonymous" referrerpolicy="origin"></amp-img>
</amp-story-360>
</amp-story-grid-layer>
Expand Down Expand Up @@ -559,6 +559,7 @@ static function () {
<amp-story-grid-layer template="fill">
<amp-story-interactive-poll id="correct-poll" endpoint="https://webstoriesinteractivity-beta.web.app/api/v1" theme="dark" chip-style="shadow" class="nice-quiz" prompt-text="What country do you like the most?" option-1-text="France" option-1-confetti="🇺🇾" option-1-results-category="Dog" option-2-text="Spain" option-2-confetti="🇺🇾" option-2-results-category="Cat" option-3-text="Uruguay" option-3-confetti="🇺🇾" option-3-results-category="Bunny" option-4-text="Brazil" option-4-confetti="🇺🇾" option-4-results-category="Mouse">
</amp-story-interactive-poll>
<amp-story-interactive-results prompt-text="Your level is" option-1-results-category="Beginner" option-1-image="beginner.png" option-1-results-threshold="10" option-2-results-category="Expet" option-2-image="expert.png" option-2-results-threshold="80"></amp-story-interactive-results>
</amp-story-grid-layer>
</amp-story-page>
<amp-story-page id="amp-story-interactive-binary-poll">
Expand Down Expand Up @@ -663,7 +664,7 @@ static function () {
],

'amp-video' => [
'<amp-video width="432" height="987" src="/video/location.mp4"></amp-video>',
'<amp-video width="432" height="987" layout="intrinsic" src="/video/location.mp4"></amp-video>',
null, // No change.
[ 'amp-video' ],
],
Expand Down Expand Up @@ -2318,7 +2319,7 @@ function getRemoteData() { /*...*/ }
'amp-autocomplete' => [
'
<form method="post" action-xhr="/form/echo-json/post" target="_blank" on="submit-success:AMP.setState({result: event.response})">
<amp-autocomplete id="autocomplete" filter="substring" min-characters="0" inline="@" max-items="10">
<amp-autocomplete id="autocomplete" filter="substring" min-characters="0" inline="@" max-items="10" prefetch>
<input type="text" id="input">
<script type="application/json" id="script">
{ "items" : ["apple", "banana", "orange"] }
Expand Down Expand Up @@ -2959,6 +2960,12 @@ class="slide"
AMP_Tag_And_Attribute_Sanitizer::SPECIFIED_LAYOUT_INVALID,
],
],

'amp-onetap-google' => [
'<amp-onetap-google layout="nodisplay" data-src="https://rp.com/intermediate"></amp-onetap-google>',
null,
[ 'amp-onetap-google' ],
],
];
}

Expand Down
13 changes: 10 additions & 3 deletions tests/php/validation/test-class-amp-validation-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -1672,6 +1672,11 @@ public function test_has_parameters_passed_by_reference() {
* @throws Exception If assertion fails.
*/
public function test_decorate_shortcode_and_filter_source() {
global $post;
if ( empty( $post ) ) {
$post = self::factory()->post->create_and_get();
}

AMP_Validation_Manager::add_validation_error_sourcing();
$shortcode_fallback = static function() {
return '<b>test</b>';
Expand Down Expand Up @@ -1877,9 +1882,11 @@ public function test_decorate_shortcode_and_filter_source() {

$source_json = wp_json_encode(
[
'hook' => 'the_content',
'filter' => true,
'sources' => $sources,
'hook' => 'the_content',
'filter' => true,
'post_id' => get_the_ID(),
'post_type' => get_post_type(),
'sources' => $sources,
]
);

Expand Down