diff --git a/assets/src/block-validation/components/higher-order/with-validation-error-notice/edit.css b/assets/src/block-validation/components/higher-order/with-validation-error-notice/edit.css
index e913f8b8855..798264e4bd6 100644
--- a/assets/src/block-validation/components/higher-order/with-validation-error-notice/edit.css
+++ b/assets/src/block-validation/components/higher-order/with-validation-error-notice/edit.css
@@ -1,4 +1,5 @@
-.amp-block-validation-errors {
+.amp-block-validation-errors,
+.amp-block-validation-errors * {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
font-size: 13px;
line-height: 1.5;
diff --git a/assets/src/block-validation/components/validation-error-message/index.js b/assets/src/block-validation/components/validation-error-message/index.js
index 86800c6989d..25bfe7e6ae8 100644
--- a/assets/src/block-validation/components/validation-error-message/index.js
+++ b/assets/src/block-validation/components/validation-error-message/index.js
@@ -7,42 +7,25 @@ import { ReactElement } from 'react';
/**
* WordPress dependencies
*/
-import { __, sprintf } from '@wordpress/i18n';
+import { __ } from '@wordpress/i18n';
/**
* Get message for validation error.
*
- * @param {Object} props Component props.
+ * @param {Object} props Component props.
+ * @param {?string} props.title Title for error (with HTML) as provided by \AMP_Validation_Error_Taxonomy::get_error_title_from_code().
* @param {?string} props.code Error code.
- * @param {?string} props.node_name Node name.
- * @param {?string} props.parent_name Parent node name.
* @param {?string|ReactElement} props.message Error message.
*
* @return {ReactElement} Validation error message.
*/
-const ValidationErrorMessage = ( { message, code, node_name: nodeName, parent_name: parentName } ) => {
+const ValidationErrorMessage = ( { title, message, code } ) => {
if ( message ) {
- return message;
+ return message; // @todo It doesn't appear this is ever set?
}
- if ( 'DISALLOWED_TAG' === code && nodeName ) { // @todo Needs to be fleshed out.
- return (
- <>
- { __( 'Invalid element: ', 'amp' ) }
- February 4 is Facebook’s 12th birthday! Our anniversary has a lot of meaning to me as an opportunity to reflect on how… Posted by Mark Zuckerberg on Tuesday, January 12, 2016 Posted by Facebook Engineering on Saturday, December 8, 2012 Meanwhile, Beast turned to the dark side. Posted by Mark Zuckerberg on Friday, December 18, 2015 I want to share a few more thoughts on the Chan Zuckerberg Initiative before I just start posting photos of me and Max for a while 🙂 I hope one idea comes through: that we as a society should make investments now to ensure this world is much better for the next generation. I don\'t think we do enough of this right now. Sure, there are many areas where investment now will solve problems for today and also improve the world for the future. We do muster the will to solve some of those. But for the problems that will truly take decades of investment before we see any major return, we are dramatically underinvested. One example is basic science research to cure disease. Another is developing clean energy to protect the world for the future. Another is the slow and steady improvement to modernize schools. Others are systematic issues around poverty and justice. There is a long list of these opportunities. The role of philanthropy is to invest in important areas that companies and governments aren\'t funding — either because they may not be profitable for companies or because they are too long term for people to want to invest now. In the case of disease, basic research often needs to be funded before biotech or pharma companies can create drugs to help people. If we invest more in science, we can make faster progress towards curing disease. Our investment in the Chan Zuckerberg Initiative is small compared to what the world can invest in solving these great challenges. My hope is that our work inspires more people to invest in these longer term issues. If we can do that, then we can all really make a difference together. Posted by Mark Zuckerberg on Friday, December 4, 2015
- { nodeName }
-
- >
- );
- } else if ( 'DISALLOWED_ATTR' === code && nodeName ) { // @todo Needs to be fleshed out.
- return (
- <>
- { __( 'Invalid attribute: ', 'amp' ) }
-
- { parentName ? sprintf( '%s[%s]', parentName, nodeName ) : nodeName }
-
- >
- );
+ if ( title ) {
+ return
}
return (
@@ -57,9 +40,8 @@ const ValidationErrorMessage = ( { message, code, node_name: nodeName, parent_na
ValidationErrorMessage.propTypes = {
message: PropTypes.string,
+ title: PropTypes.string,
code: PropTypes.string,
- node_name: PropTypes.string,
- parent_name: PropTypes.string,
};
export default ValidationErrorMessage;
diff --git a/assets/src/block-validation/components/validation-error-message/test/__snapshots__/index.js.snap b/assets/src/block-validation/components/validation-error-message/test/__snapshots__/index.js.snap
index c017314c04f..b863e11570b 100644
--- a/assets/src/block-validation/components/validation-error-message/test/__snapshots__/index.js.snap
+++ b/assets/src/block-validation/components/validation-error-message/test/__snapshots__/index.js.snap
@@ -9,31 +9,13 @@ Array [
]
`;
-exports[`ValidationErrorMessage renders an error for an invalid attribute 1`] = `
-Array [
- "Invalid attribute: ",
-
- bar
-
,
-]
-`;
-
-exports[`ValidationErrorMessage renders an error for an invalid attribute with parent node 1`] = `
-Array [
- "Invalid attribute: ",
+exports[`ValidationErrorMessage renders an error with a title 1`] = `
+
+ Invalid attribute
- baz[bar]
-
,
-]
-`;
-
-exports[`ValidationErrorMessage renders an error for an invalid element 1`] = `
-Array [
- "Invalid element: ",
-
- foo
-
,
-]
+ onclick
+
+
`;
exports[`ValidationErrorMessage renders an error for an unknown error code 1`] = `
diff --git a/assets/src/block-validation/components/validation-error-message/test/index.js b/assets/src/block-validation/components/validation-error-message/test/index.js
index 0b94167c40c..db90e62fbba 100644
--- a/assets/src/block-validation/components/validation-error-message/test/index.js
+++ b/assets/src/block-validation/components/validation-error-message/test/index.js
@@ -14,18 +14,8 @@ describe( 'ValidationErrorMessage', () => {
expect( errorMessage ).toMatchSnapshot();
} );
- it( 'renders an error for an invalid element', () => {
- const errorMessage = render(
-
+
-
+
-
+
-
-
+
- Posted by Facebook on Thursday, August 27, 2015 -+
-+Posted by Facebook on Thursday, August 27, 2015
-
Like Us+
- -+