-
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.
Merge pull request #1143 from powdercloud/layouts
Make AMP Layouts first class in the validator.
- Loading branch information
Showing
14 changed files
with
876 additions
and
552 deletions.
There are no files selected for viewing
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,124 @@ | ||
<!-- | ||
Copyright 2015 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: | ||
This is a (partial) transcription from test/functional/test-layout.js. | ||
--> | ||
<!doctype html> | ||
<html ⚡> | ||
<head> | ||
<meta charset="utf-8"> | ||
<link rel="canonical" href="./regular-html-version.html" /> | ||
<meta name="viewport" content="width=device-width,minimum-scale=1"> | ||
<style>body {opacity: 0}</style><noscript><style>body {opacity: 1}</style></noscript> | ||
<script async src="https://cdn.ampproject.org/v0.js"></script> | ||
</head> | ||
<body> | ||
<!-- valid: layout=nodisplay --> | ||
<amp-img layout="nodisplay" src="itshappening.gif"></amp-img> | ||
|
||
<!-- valid: layout=fixed --> | ||
<amp-img layout="fixed" width="100" height="200" | ||
src="itshappening.gif"></amp-img> | ||
|
||
<!-- valid: layout=fixed default width/height --> | ||
<amp-img width="100" height="200" src="itshappening.gif"></amp-img> | ||
|
||
<!-- invalid: layout=fixed - requires width/height --> | ||
<amp-img layout="fixed" src="itshappening.gif"></amp-img> | ||
|
||
<!-- valid: layout=fixed-height --> | ||
<amp-img layout="fixed-height" height="200" src="itshappening.gif"></amp-img> | ||
|
||
<!-- valid: layout=fixed-height, with width=auto --> | ||
<amp-img layout="fixed-height" height="200" width="auto" | ||
src="itshappening.gif"></amp-img> | ||
|
||
<!-- invalid: layout=fixed-height, prohibit width!=auto --> | ||
<amp-img layout="fixed-height" height="200" width="300" | ||
src="itshappening.gif"></amp-img> | ||
|
||
<!-- valid: layout=fixed-height - default with height --> | ||
<amp-img height="200" src="itshappening.gif"></amp-img> | ||
|
||
<!-- valid: layout=fixed-height - default with height and width=auto --> | ||
<amp-img height="200" width="auto" src="itshappening.gif"></amp-img> | ||
|
||
<!-- invalid: layout=fixed-height - requires height --> | ||
<amp-img layout="fixed-height" src="itshappening.gif"></amp-img> | ||
|
||
<!-- valid: layout=responsive --> | ||
<amp-img layout="responsive" width="100" height="200" | ||
src="itshappening.gif"></amp-img> | ||
|
||
<!-- valid: layout=responsive with sizes --> | ||
<amp-img layout="responsive" width="100" height="200" sizes="50vw" | ||
src="itshappening.gif"></amp-img> | ||
|
||
<!-- valid: layout=fill --> | ||
<amp-img layout="fill" src="itshappening.gif"></amp-img> | ||
|
||
<!-- invalid: layout=container | ||
Note that this would be valid if amp-img allowed container. | ||
It doesn't and there is no other element that does. | ||
TODO(johannes): Long run we should get rid of container or use it. | ||
https://github.com/ampproject/amphtml/issues/1109 | ||
--> | ||
<amp-img layout="container" src="itshappening.gif"></amp-img> | ||
|
||
<!-- invalid: layout=unknown --> | ||
<amp-img layout="unknown" src="itshappening.gif"></amp-img> | ||
|
||
<!-- valid: should configure natural dimensions; default layout --> | ||
<amp-pixel src="https://www.example.com/make-my-visit-count"></amp-pixel> | ||
|
||
<!-- valid: should configure natural dimensions; default layout; | ||
with width --> | ||
<amp-pixel src="https://www.example.com/make-my-visit-count" width="11"> | ||
</amp-pixel> | ||
|
||
<!-- valid: should configure natural dimensions; default layout; | ||
with height --> | ||
<amp-pixel src="https://www.example.com/make-my-visit-count" height="11"> | ||
</amp-pixel> | ||
|
||
<!-- valid: should configure natural dimensions; layout=fixed --> | ||
<amp-pixel src="https://www.example.com/make-my-visit-count" layout="fixed"> | ||
</amp-pixel> | ||
|
||
<!-- valid: should configure natural dimensions; layout=fixed --> | ||
<amp-pixel src="https://www.example.com/make-my-visit-count" | ||
layout="fixed"> | ||
</amp-pixel> | ||
|
||
<!-- valid: width and hight set with valid css lengths --> | ||
<amp-pixel src="https://www.example.com/make-my-visit-count" | ||
width="1px" height="1px"></amp-pixel> | ||
|
||
<!-- invalid: width=auto won't work because amp-pixel doesn't | ||
support fixed-height layout. --> | ||
<amp-pixel src="https://www.example.com/make-my-visit-count" | ||
width="auto" height="1px"></amp-pixel> | ||
|
||
<!-- invalid: width=X. --> | ||
<amp-pixel src="https://www.example.com/make-my-visit-count" | ||
width="X" height="1px"></amp-pixel> | ||
|
||
<!-- invalid: height=X. --> | ||
<amp-pixel src="https://www.example.com/make-my-visit-count" | ||
height="X" width="1px"></amp-pixel> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FAIL | ||
feature_tests/amp_layouts.html:41:2 MANDATORY_ATTR_MISSING height (see https://github.com/ampproject/amphtml/blob/master/builtins/amp-img.md) | ||
feature_tests/amp_layouts.html:51:2 INVALID_ATTR_VALUE layout FIXED_HEIGHT requires width='auto' (see https://github.com/ampproject/amphtml/blob/master/builtins/amp-img.md) | ||
feature_tests/amp_layouts.html:61:2 MANDATORY_ATTR_MISSING height (see https://github.com/ampproject/amphtml/blob/master/builtins/amp-img.md) | ||
feature_tests/amp_layouts.html:80:2 INVALID_ATTR_VALUE layout CONTAINER not supported (see https://github.com/ampproject/amphtml/blob/master/builtins/amp-img.md) | ||
feature_tests/amp_layouts.html:83:2 INVALID_ATTR_VALUE layout (see https://github.com/ampproject/amphtml/blob/master/builtins/amp-img.md) | ||
feature_tests/amp_layouts.html:113:2 IMPLIED_LAYOUT_INVALID layout FIXED_HEIGHT not supported (see https://github.com/ampproject/amphtml/blob/master/builtins/amp-pixel.md) | ||
feature_tests/amp_layouts.html:117:2 INVALID_ATTR_VALUE width (see https://github.com/ampproject/amphtml/blob/master/builtins/amp-pixel.md) | ||
feature_tests/amp_layouts.html:121:2 INVALID_ATTR_VALUE height (see https://github.com/ampproject/amphtml/blob/master/builtins/amp-pixel.md) |
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
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
FAIL | ||
feature_tests/amp_list.html:35:2 MANDATORY_ATTR_MISSING src (see https://github.com/ampproject/amphtml/blob/master/extensions/amp-list/amp-list.md) | ||
feature_tests/amp_list.html:36:2 DISALLOWED_ATTR wdith (see https://github.com/ampproject/amphtml/blob/master/extensions/amp-list/amp-list.md) | ||
feature_tests/amp_list.html:41:2 IMPLIED_LAYOUT_INVALID layout CONTAINER not supported (see https://github.com/ampproject/amphtml/blob/master/extensions/amp-list/amp-list.md) |
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
Oops, something went wrong.