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
Validator rules/test for amp-action-macro #20928
Validator rules/test for amp-action-macro #20928
Conversation
…ntime that doc height could have changed
# limitations under the license. | ||
# | ||
tags: { # amp-action-macro | ||
html_format: AMP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
have all these formats approved enabling this extension?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, good point though the extension augments and improves the dev experience with using actions so perhaps it's ok? But perhaps it's safer to exclude first and just add if it's requested.
@choumx thoughts on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's start with AMP and ACTIONS conservatively.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
name: "amp-action-macro" | ||
version: "0.1" | ||
version: "latest" | ||
requires_usage: GRANDFATHERED |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
version: "0.1" | ||
version: "latest" | ||
requires_usage: GRANDFATHERED | ||
deprecated_allow_duplicates: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
html_format: ACTIONS | ||
tag_name: "AMP-ACTION-MACRO" | ||
requires_extension: "amp-action-macro" | ||
attrs: { name: "id" mandatory: true } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please break each field onto their own lines when there are more than one. e.g.
attrs: {
name: "id"
mandatory: true
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
requires_extension: "amp-action-macro" | ||
attrs: { name: "id" mandatory: true } | ||
attrs: { name: "execute" mandatory: true } | ||
attrs: { name: "arguments" mandatory: false } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please alphabetize by attrs.name, e.g. arguments first, then execute, then id.
also mandatory defaults to false so unnecessary to include it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
<amp-action-macro id="action-macro-id"> | ||
</amp-action-macro> | ||
|
||
<!-- Valid, optional arguments --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please put valid tests before invalid tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks David
# limitations under the license. | ||
# | ||
tags: { # amp-action-macro | ||
html_format: AMP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, good point though the extension augments and improves the dev experience with using actions so perhaps it's ok? But perhaps it's safer to exclude first and just add if it's requested.
@choumx thoughts on this?
name: "amp-action-macro" | ||
version: "0.1" | ||
version: "latest" | ||
requires_usage: GRANDFATHERED |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
version: "0.1" | ||
version: "latest" | ||
requires_usage: GRANDFATHERED | ||
deprecated_allow_duplicates: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
html_format: ACTIONS | ||
tag_name: "AMP-ACTION-MACRO" | ||
requires_extension: "amp-action-macro" | ||
attrs: { name: "id" mandatory: true } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
requires_extension: "amp-action-macro" | ||
attrs: { name: "id" mandatory: true } | ||
attrs: { name: "execute" mandatory: true } | ||
attrs: { name: "arguments" mandatory: false } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
<amp-action-macro id="action-macro-id"> | ||
</amp-action-macro> | ||
|
||
<!-- Valid, optional arguments --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
<body> | ||
|
||
<!-- Valid --> | ||
<amp-action-macro id="action-macro-id" execute="amp-component.doSomething()"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We renamed this attribute to execute
? Isn't it a bit confusing with the registered action being "execute" as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, reason being that it clashed with the action
attribute that is also allowed and present in a <form>
.
I don't think it's confusing. Now there is a 1 to 1 mapping between the caller that calls execute method and the action being invoked in the action macro, which is now associated with the execute attribute.
Example:
<amp-action-macro
id="scrollable-carousel-macro-refers-an-action-macro"
execute="scrollable-carousel.slideTo(index=x)"
arguments="x">
</amp-action-macro>
<button on="tap:scrollable-carousel-macro-args.execute(x=1)">Go to slide 1</button>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
validation looks good
@choumx friendly ping |
* cl/234896906 Revision bump for #20969 * cl/235090073 Allow i-amphtml-layout on AMP elements only for Transformed AMP * cl/235216325 Disallow document properties in <form> attribute name. * cl/235271919 Revision bump for #20989 * cl/235833553 Revision bump for #20928 * cl/235843207 Revision bump for #20905
* cl/234896906 Revision bump for ampproject#20969 * cl/235090073 Allow i-amphtml-layout on AMP elements only for Transformed AMP * cl/235216325 Disallow document properties in <form> attribute name. * cl/235271919 Revision bump for ampproject#20989 * cl/235833553 Revision bump for ampproject#20928 * cl/235843207 Revision bump for ampproject#20905
* cl/234896906 Revision bump for ampproject#20969 * cl/235090073 Allow i-amphtml-layout on AMP elements only for Transformed AMP * cl/235216325 Disallow document properties in <form> attribute name. * cl/235271919 Revision bump for ampproject#20989 * cl/235833553 Revision bump for ampproject#20928 * cl/235843207 Revision bump for ampproject#20905
#19494