-
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.
protocol adapters: e2e test, nodom binary, and bump worker-dom. (#29541)
* amp-script: nodom variant - adds support for nodom flag to amp-script, for protocol adapters. - upgrades worker-dom to the latest (which has support for callFunction, and lite binaries). - adds e2e test for "script" uri in amp-list. * lint * force nodom to not have width/height. * 2019 --> 2020
- Loading branch information
Showing
8 changed files
with
150 additions
and
6 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
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,58 @@ | ||
/** | ||
* Copyright 2020 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. | ||
*/ | ||
|
||
describes.endtoend( | ||
'amp-list "amp-script:" uri', | ||
{ | ||
testUrl: | ||
'http://localhost:8000/test/fixtures/e2e/amp-list/amp-list-function-src.html', | ||
experiments: ['protocol-adapters'], | ||
environments: ['single'], | ||
}, | ||
async (env) => { | ||
let controller; | ||
|
||
beforeEach(async () => { | ||
controller = env.controller; | ||
}); | ||
|
||
it.configure().run( | ||
'should render list backed by amp-script data', | ||
async function () { | ||
const container = await getListContainer(controller); | ||
await verifyContainer(controller, container); | ||
|
||
// Verify that all items rendered. | ||
const listItems = await getListItems(controller); | ||
await expect(listItems).to.have.length(2); | ||
} | ||
); | ||
} | ||
); | ||
|
||
function getListContainer(controller) { | ||
return controller.findElement('div[role=list]'); | ||
} | ||
|
||
function getListItems(controller) { | ||
return controller.findElements('div[role=listitem]'); | ||
} | ||
|
||
async function verifyContainer(controller, container) { | ||
await expect(controller.getElementAttribute(container, 'class')).to.equal( | ||
'i-amphtml-fill-content i-amphtml-replaced-content' | ||
); | ||
} |
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
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
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,26 @@ | ||
<!doctype html> | ||
<html ⚡> | ||
<head> | ||
<meta charset="utf-8"> | ||
<script async src="https://cdn.ampproject.org/v0.js"></script> | ||
<script async custom-element="amp-list" src="https://cdn.ampproject.org/v0/amp-list-0.1.js"></script> | ||
<script async custom-element="amp-script" src="https://cdn.ampproject.org/v0/amp-script-0.1.js"></script> | ||
<script async custom-template="amp-mustache" src="https://cdn.ampproject.org/v0/amp-mustache-0.2.js"></script> | ||
<style amp4email-boilerplate>body{visibility:hidden}</style> | ||
</head> | ||
<body> | ||
|
||
<amp-script id="fns" script="fruit-script" nodom data-ampdevmode></amp-script> | ||
<script id="fruit-script" type="text/plain" target="amp-script"> | ||
exportFunction('getFruit', () => ({items: [{name: 'Pineapple'}, {name: 'Mango'}]})); | ||
</script> | ||
|
||
<amp-list id="amp-list" width="auto" height="100" layout="fixed-height" | ||
src="amp-script:fns.getFruit"> | ||
<template type="amp-mustache"> | ||
<div class="fruit">{{name}}</div> | ||
</template> | ||
</amp-list> | ||
|
||
</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 |
---|---|---|
|
@@ -73,10 +73,10 @@ | |
resolved "https://registry.yarnpkg.com/@ampproject/viewer-messaging/-/viewer-messaging-1.1.0.tgz#404f92c5754bac61014ed2272dd5e87174b9af84" | ||
integrity sha512-SoR1dGl2Pl8eJlyGCU/9Gz/orOggmW/13wUh7NnuGvDYqLdlhnRBzvEGqEAlq/fQKel9ZM6RNtu85Jw8WC3K2Q== | ||
|
||
"@ampproject/[email protected].1": | ||
version "0.25.1" | ||
resolved "https://registry.yarnpkg.com/@ampproject/worker-dom/-/worker-dom-0.25.1.tgz#3f97441b94ee5d84f882f4f1262ca0c4888b11b6" | ||
integrity sha512-6qfHzg7YFNwcUr9a2iWWQp0ZTUlM+O4UUDFClM5O3ZZ28CooK4xdhOdLCOQr04zQ0td+6zd02rUip2JBcWx4aQ== | ||
"@ampproject/[email protected].2": | ||
version "0.25.2" | ||
resolved "https://registry.yarnpkg.com/@ampproject/worker-dom/-/worker-dom-0.25.2.tgz#910eed5b0f842ed139ab84719097297ca67fa23a" | ||
integrity sha512-l6H1vJ2AfvvkXiGH2a5HDT4ft+YDhnbtzd0GslIiRDYcmKJ6yiJXdicvpBWQu9PLapa59Q4hW0HMxEaYRZOHeg== | ||
|
||
"@ava/babel-plugin-throws-helper@^4.0.0": | ||
version "4.0.0" | ||
|