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

Validator rules/test for amp-action-macro #20928

Merged
merged 25 commits into from Feb 25, 2019
Merged

Validator rules/test for amp-action-macro #20928

merged 25 commits into from Feb 25, 2019

Conversation

alabiaga
Copy link
Contributor

@alabiaga alabiaga commented Feb 19, 2019

# limitations under the license.
#
tags: { # amp-action-macro
html_format: AMP
Copy link
Contributor

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?

Copy link
Contributor Author

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?

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.

Copy link
Contributor Author

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
Copy link
Contributor

Choose a reason for hiding this comment

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

please remove

Copy link
Contributor Author

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
Copy link
Contributor

Choose a reason for hiding this comment

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

please remove

Copy link
Contributor Author

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 }
Copy link
Contributor

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
}

Copy link
Contributor Author

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 }
Copy link
Contributor

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.

Copy link
Contributor Author

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 -->
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor Author

@alabiaga alabiaga left a 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
Copy link
Contributor Author

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
Copy link
Contributor Author

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
Copy link
Contributor Author

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 }
Copy link
Contributor Author

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 }
Copy link
Contributor Author

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 -->
Copy link
Contributor Author

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()">

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?

Copy link
Contributor Author

@alabiaga alabiaga Feb 20, 2019

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>

Copy link
Contributor

@honeybadgerdontcare honeybadgerdontcare left a comment

Choose a reason for hiding this comment

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

validation looks good

@alabiaga
Copy link
Contributor Author

@choumx friendly ping

@alabiaga alabiaga merged commit 56a8b0f into ampproject:master Feb 25, 2019
Gregable added a commit that referenced this pull request Feb 27, 2019
* 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
noranazmy pushed a commit to noranazmy/amphtml that referenced this pull request Mar 22, 2019
noranazmy pushed a commit to noranazmy/amphtml that referenced this pull request Mar 22, 2019
* 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
bramanudom pushed a commit to bramanudom/amphtml that referenced this pull request Mar 22, 2019
bramanudom pushed a commit to bramanudom/amphtml that referenced this pull request Mar 22, 2019
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants