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 spec generation to file revision 712 (amphtml tag 1533692711873) #1315

Merged
merged 5 commits into from Aug 23, 2018

Conversation

3 participants
@westonruter
Copy link
Member

westonruter commented Aug 3, 2018

This is a follow-up on #1312. Since there are validator spec changes another PR was needed to deal with them.

  • Update spec reader to account for spec format changes.
  • Add support for amp-embedly-card and amp-embedly-key.
  • Add minimum-nights attribute to amp-date-picker.
  • Add animate-in attribute to amp-lightbox.
  • Add submitting and verify-error to form.
  • Add more amp-fx values.
  • Verify updates to accommodate spec changes are correct.
  • Add changelog.
  • Add tests.

Fixes #1330.

hellofromtonya added some commits Aug 22, 2018

@hellofromtonya hellofromtonya added this to In progress in v1.0 Aug 22, 2018

@hellofromtonya
Copy link
Collaborator

hellofromtonya left a comment

@westonruter I just ran the update spec generator. It performed as expected. It did add the new updates from the new specification, including allowing the amp-lightbox animation attributions to pass through the sanitizer.

As we discussed, we should also update the amphtml-update.py instructions, i.e. to point it to the Updating Allowed Tags and Attributes section. Done in d576d44.

if ( $node->hasAttribute( $attr_name ) ) {
$attr_value = strtolower( $node->getAttribute( $attr_name ) );
if ( $attr_value === (string) $rule_value ) {
return AMP_Rule_Spec::PASS;
} else {
return AMP_Rule_Spec::FAIL;
$result = AMP_Rule_Spec::FAIL;

This comment has been minimized.

@hellofromtonya

hellofromtonya Aug 22, 2018

Collaborator

@westonruter Why are we allowing the rule iteration to continue if it fails? With this approach, it could fail on one of the values, but then pass on another. When it passes, it would return a pass and bail out, even though it failed previously. Is this what we want here?

This comment has been minimized.

@westonruter

westonruter Aug 23, 2018

Member

Good question. The reason is that the spec changed from value_casei being a scalar value to being an array. So instead of testing a single value, we now need to check if any match. You can see in the if condition immediately preceding that it will return immediately upon a match. But then if it does not match then this FAIL will end up being the return value after all of the values are matched. But if the element doesn't have the attribute at all, then the NOT_APPLICABLE value is returned.

This comment has been minimized.

@hellofromtonya

hellofromtonya Aug 23, 2018

Collaborator

@westonruter Thank you for clarifying. That makes sense.

@@ -1099,13 +1122,13 @@ private function check_attr_spec_rule_value_casei( $node, $attr_name, $attr_spec
if ( $attr_value === (string) $rule_value ) {
return AMP_Rule_Spec::PASS;
} else {
return AMP_Rule_Spec::FAIL;
$result = AMP_Rule_Spec::FAIL;

This comment has been minimized.

@hellofromtonya

hellofromtonya Aug 22, 2018

Collaborator

Same quest here as above.

This comment has been minimized.

@westonruter

westonruter Aug 23, 2018

Member

See above: https://github.com/Automattic/amp-wp/pull/1315/files/d576d442c081c14c84018ea398d4449ba43d333e#r212449155

Also, this change was required to get unit tests to pass, as I recall.

This comment has been minimized.

@hellofromtonya

hellofromtonya Aug 23, 2018

Collaborator

@westonruter What you have presently looks good. Ping me when you the other TODOs ready for review.

@westonruter westonruter changed the title [WIP] Update spec generation to file revision 699 (amphtml tag 1532461037969) [WIP] Update spec generation to file revision 712 (amphtml tag 1533692711873) Aug 23, 2018

Changes have been completed

@westonruter westonruter changed the title [WIP] Update spec generation to file revision 712 (amphtml tag 1533692711873) Update spec generation to file revision 712 (amphtml tag 1533692711873) Aug 23, 2018

@hellofromtonya
Copy link
Collaborator

hellofromtonya left a comment

Great job @westonruter!

@westonruter westonruter merged commit e6077c3 into develop Aug 23, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@westonruter westonruter deleted the update/amp-spec-1532461037969 branch Aug 23, 2018

@westonruter westonruter moved this from In progress to Ready for review in v1.0 Aug 23, 2018

@westonruter westonruter moved this from Ready for review to Ready for QA in v1.0 Aug 23, 2018

@kienstra

This comment has been minimized.

Copy link
Collaborator

kienstra commented Sep 18, 2018

Moving To 'Ready For Merging'

If it's alright, I'm moving this to 'Ready For Merging,' as I don't think it needs functional testing. Feel free to move it back.

@kienstra kienstra moved this from Ready for QA to Ready for Merging in v1.0 Sep 18, 2018

@kienstra kienstra moved this from Ready for Merging to In Production in v1.0 Dec 11, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment