-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Allow <amp-render> within story pages and story page attachments (#…
…35497) * Allow <amp-render> as a valid child component of story pages and story page attachments * Add newline to end of the .out test file * Update copyright date in extensions/amp-story/1.0/test/validator-amp-story-amp-render.html Co-authored-by: Gabriel Majoulet <gmajoulet@google.com> * Move the placeholder and fallback divs within the amp-render element * Update mustache templates * Remove unnecessary template attribute * Add newline at end of .out file * Add comments to test file that point to the amp-render usage * Add the TEMPLATE tag as a valid descendant of page attachments, and then move the template element in validator-amp-story-amp-render.html inside of the amp-story-page-attachment element * Update the validator output file * Add newline to end of .out file Co-authored-by: Gabriel Majoulet <gmajoulet@google.com>
- Loading branch information
1 parent
7741dcc
commit 3081038
Showing
3 changed files
with
198 additions
and
0 deletions.
There are no files selected for viewing
97 changes: 97 additions & 0 deletions
97
extensions/amp-story/1.0/test/validator-amp-story-amp-render.html
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
<!-- | ||
Copyright 2021 The AMP HTML Authors. All Rights Reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS-IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the license. | ||
--> | ||
<!-- | ||
Test Description: | ||
Tests for the amp-render functionality inside amp-story. | ||
--> | ||
<!DOCTYPE html> | ||
<html amp lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<script async src="https://cdn.ampproject.org/v0.js"></script> | ||
<script async custom-element="amp-story" | ||
src="https://cdn.ampproject.org/v0/amp-story-1.0.js"></script> | ||
<script async custom-element="amp-render" | ||
src="https://cdn.ampproject.org/v0/amp-render-1.0.js"></script> | ||
<script async custom-template="amp-mustache" | ||
src="https://cdn.ampproject.org/v0/amp-mustache-0.2.js"></script> | ||
<script async custom-element="amp-bind" | ||
src="https://cdn.ampproject.org/v0/amp-bind-0.1.js"></script> | ||
<title>amp-render</title> | ||
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/> | ||
<link rel="canonical" href="index.html" /> | ||
<style amp-boilerplate> | ||
body{ | ||
-webkit-animation:-amp-start 8s steps(1, end) 0s 1 normal both; | ||
-moz-animation:-amp-start 8s steps(1, end) 0s 1 normal both; | ||
-ms-animation:-amp-start 8s steps(1, end) 0s 1 normal both; | ||
animation:-amp-start 8s steps(1, end) 0s 1 normal both | ||
} | ||
@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}} | ||
@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}} | ||
@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}} | ||
@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}} | ||
@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}} | ||
</style> | ||
<noscript> | ||
<style amp-boilerplate> | ||
body{ | ||
-webkit-animation:none; | ||
-moz-animation:none; | ||
-ms-animation:none; | ||
animation:none | ||
} | ||
</style> | ||
</noscript> | ||
</head> | ||
|
||
<body> | ||
<amp-story standalone title="My Story" publisher="Me" | ||
publisher-logo-src="http://me.com/logo.png" | ||
poster-portrait-src="http://me.com/poster.jpg"> | ||
<amp-story-page id="page-rendering"> | ||
<amp-story-grid-layer template="vertical"> | ||
<!-- Valid: amp-render within amp-story-page --> | ||
<amp-render | ||
layout="fixed-height" | ||
height="100" | ||
src="/examples/images.json" | ||
binding="no"> | ||
<template id="my-page-template" type="amp-mustache"> | ||
<div>{{#images}}<b><a href="{{urls.picsum}}">{{author}}</a></b>{{/images}}</div> | ||
</template> | ||
<div placeholder>Loading ...</div> | ||
<div fallback>Failed to load data.</div> | ||
</amp-render> | ||
</amp-story-grid-layer> | ||
</amp-story-page> | ||
|
||
<amp-story-page id="attachment-rendering"> | ||
<amp-story-page-attachment layout="nodisplay"> | ||
<h1>Page Attachment</h1> | ||
<!-- Valid: amp-render within amp-story-page-attachment --> | ||
<amp-render | ||
layout="fixed-height" | ||
height="100" | ||
src="/examples/images.json" | ||
binding="no" | ||
template="my-attachment-template"> | ||
</amp-render> | ||
<template id="my-attachment-template" type="amp-mustache"> | ||
<div>{{#images}}<b><a href="{{urls.picsum}}">{{author}}</a></b>{{/images}}</div> | ||
</template> | ||
</amp-story-page-attachment> | ||
</amp-story-page> | ||
</amp-story> | ||
</body> | ||
</html> |
98 changes: 98 additions & 0 deletions
98
extensions/amp-story/1.0/test/validator-amp-story-amp-render.out
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
PASS | ||
| <!-- | ||
| Copyright 2021 The AMP HTML Authors. All Rights Reserved. | ||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS-IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the license. | ||
| --> | ||
| <!-- | ||
| Test Description: | ||
| Tests for the amp-render functionality inside amp-story. | ||
| --> | ||
| <!DOCTYPE html> | ||
| <html amp lang="en"> | ||
| <head> | ||
| <meta charset="utf-8" /> | ||
| <script async src="https://cdn.ampproject.org/v0.js"></script> | ||
| <script async custom-element="amp-story" | ||
| src="https://cdn.ampproject.org/v0/amp-story-1.0.js"></script> | ||
| <script async custom-element="amp-render" | ||
| src="https://cdn.ampproject.org/v0/amp-render-1.0.js"></script> | ||
| <script async custom-template="amp-mustache" | ||
| src="https://cdn.ampproject.org/v0/amp-mustache-0.2.js"></script> | ||
| <script async custom-element="amp-bind" | ||
| src="https://cdn.ampproject.org/v0/amp-bind-0.1.js"></script> | ||
| <title>amp-render</title> | ||
| <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/> | ||
| <link rel="canonical" href="index.html" /> | ||
| <style amp-boilerplate> | ||
| body{ | ||
| -webkit-animation:-amp-start 8s steps(1, end) 0s 1 normal both; | ||
| -moz-animation:-amp-start 8s steps(1, end) 0s 1 normal both; | ||
| -ms-animation:-amp-start 8s steps(1, end) 0s 1 normal both; | ||
| animation:-amp-start 8s steps(1, end) 0s 1 normal both | ||
| } | ||
| @-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}} | ||
| @-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}} | ||
| @-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}} | ||
| @-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}} | ||
| @keyframes -amp-start{from{visibility:hidden}to{visibility:visible}} | ||
| </style> | ||
| <noscript> | ||
| <style amp-boilerplate> | ||
| body{ | ||
| -webkit-animation:none; | ||
| -moz-animation:none; | ||
| -ms-animation:none; | ||
| animation:none | ||
| } | ||
| </style> | ||
| </noscript> | ||
| </head> | ||
| | ||
| <body> | ||
| <amp-story standalone title="My Story" publisher="Me" | ||
| publisher-logo-src="http://me.com/logo.png" | ||
| poster-portrait-src="http://me.com/poster.jpg"> | ||
| <amp-story-page id="page-rendering"> | ||
| <amp-story-grid-layer template="vertical"> | ||
| <!-- Valid: amp-render within amp-story-page --> | ||
| <amp-render | ||
| layout="fixed-height" | ||
| height="100" | ||
| src="/examples/images.json" | ||
| binding="no"> | ||
| <template id="my-page-template" type="amp-mustache"> | ||
| <div>{{#images}}<b><a href="{{urls.picsum}}">{{author}}</a></b>{{/images}}</div> | ||
| </template> | ||
| <div placeholder>Loading ...</div> | ||
| <div fallback>Failed to load data.</div> | ||
| </amp-render> | ||
| </amp-story-grid-layer> | ||
| </amp-story-page> | ||
| | ||
| <amp-story-page id="attachment-rendering"> | ||
| <amp-story-page-attachment layout="nodisplay"> | ||
| <h1>Page Attachment</h1> | ||
| <!-- Valid: amp-render within amp-story-page-attachment --> | ||
| <amp-render | ||
| layout="fixed-height" | ||
| height="100" | ||
| src="/examples/images.json" | ||
| binding="no" | ||
| template="my-attachment-template"> | ||
| </amp-render> | ||
| <template id="my-attachment-template" type="amp-mustache"> | ||
| <div>{{#images}}<b><a href="{{urls.picsum}}">{{author}}</a></b>{{/images}}</div> | ||
| </template> | ||
| </amp-story-page-attachment> | ||
| </amp-story-page> | ||
| </amp-story> | ||
| </body> | ||
| </html> |
This file contains 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