Tidy up validation error details#3721
Merged
westonruter merged 7 commits intodevelopfrom Nov 12, 2019
Merged
Conversation
westonruter
commented
Nov 12, 2019
kienstra
approved these changes
Nov 12, 2019
Contributor
kienstra
left a comment
There was a problem hiding this comment.
Approved
Hi @westonruter,
This looks good, pending your comment about the condition.
Like you mentioned, when using your Custom HTML snippet, the error codes look good:
Also, the validated URL page looks good. It doesn't have the 'Unknown error' code anymore:
| case 'stylesheet_file_missing': | ||
| return __( 'Missing stylesheet file', 'amp' ); | ||
| case 'illegal_css_important': | ||
| return __( 'Illegal CSS !important property', 'amp' ); |
Contributor
There was a problem hiding this comment.
Nice, it's good to have translated error messages.
Member
Author
|
Merged in spite of unrelated E2E test failures: https://travis-ci.org/ampproject/amp-wp/jobs/611080755#L923-L954 |
westonruter
added a commit
that referenced
this pull request
Nov 12, 2019
* Improve display of validation errors for invalid CSS properties * Present style/script text content in pre tag * Translate additional error codes from style sanitizer * Fix blatent logic typo which caused some sourcing info to not display * Include property for illegal_css_important errors * Prevent array-to-string conversion when CSS property has unexpected value * Remove duplicated condition
westonruter
added a commit
that referenced
this pull request
Nov 13, 2019
…ve-duplicate-amp-scripts * 'develop' of github.com:ampproject/amp-wp: (66 commits) Improve display of validation errors for scripts (#3722) Conditionally run E2E tests (#3723) Tidy up validation error details (#3721) Add missing space after sentence (#3720) Default to the homepage instead of fetching the first AMP compatible post to customize (#3715) Include text content of style element in validation error (#3717) Fix summarizing error sources both parent theme and child theme (#3709) Exclude WordPress.PHP.DisallowShortTernary phpcs sniff Fix phpcs issues with date() and current_time() Exclude Generic.Arrays.DisallowShortArraySyntax from WordPress-Core Update dependency wp-coding-standards/wpcs to v2.2.0 Improve specificity of JS doc Fix identifying sources for validation errors coming child themes (#3708) Fix failing E2E tests (#3707) Remove amp_validate query var from Validated URL 'View' row action Re-factor get_html_attribute_pattern as match_element_attributes Quote variables added to regex pattern Replace incorrect usage of esc_url() with esc_url_raw() Remove empty alt attributes Add object-fit=contain to amp-youtube placeholder image ...
westonruter
added a commit
that referenced
this pull request
Nov 14, 2019
* tag '1.4.1': (26 commits) Bump 1.4.1 Update screenshots for 1.4.1 Fix expected image name after upstream change (#3749) Use length property instead of count() method on DOMNodeList (#3727) Improve display of validation errors for scripts (#3722) Conditionally run E2E tests (#3723) Tidy up validation error details (#3721) Bump 1.4.1-RC1 Default to the homepage instead of fetching the first AMP compatible post to customize (#3715) Add missing space after sentence (#3720) Include text content of style element in validation error (#3717) Use bitwise operator. Check if element is not in top toolbar. Fix user select for meta date and author Allow right click for meta blocks Fix summarizing error sources both parent theme and child theme (#3709) Fix identifying sources for validation errors coming child themes (#3708) Fix failing E2E tests (#3707) Remove amp_validate query var from Validated URL 'View' row action (#3706) Escape instances of unescapeed output in AMP settings screen code (#3703) ...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Summary
Given a Custom HTML block that contains this
styleelement:There should be 4 validation errors (two for
!importantand two for illegalheight), but there are three:Also, the presentation of these validation errors is not ideal:
style(orscript) element does not present the contents in apreelement, leading to the content appearing minified.illegal_css_importanterrors get conflated because they lackpropertycontext (hence the 3 instead of 4 errors).This PR fixes those problems.
Before
After
Checklist