/
githubmirror
/
amphtml
Обзор
Документация
Войти
/
githubmirror
/
amphtml
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
test/e2e/test-amp-bind-form.js
55 строк
2 KB
Kristofer Baxter
♻️ Remove Notice from JS and Markdown (#35717)
19 авг 2021, 21:21
Не верифицирован
19 авг 2021, 21:21
f564b7e
Код
Авторство
О чём код?
describes.endtoend( 'amp-bind', { fixture: 'amp-bind/bind-form.html', }, (env) => { let controller; beforeEach(() => { controller = env.controller; }); describe('with <amp-form>', () => { it('should NOT allow invalid bindings or values', async function () { const xhrText = await controller.findElement('#xhrText'); const templatedText = await controller.findElement('#templatedText'); const illegalHref = await controller.findElement('#illegalHref'); const submitButton = await controller.findElement('#submitButton'); await expect(controller.getElementText(xhrText)).to.equal(''); await expect(controller.getElementAttribute(illegalHref, 'href')).to.be .null; await expect(controller.getElementAttribute(templatedText, 'onclick')) .to.be.null; await expect( controller.getElementAttribute(templatedText, 'onmouseover') ).to.be.null; await expect(controller.getElementAttribute(templatedText, 'style')).to .be.null; await expect(controller.getElementText(templatedText)).to.equal(''); await controller.click(submitButton); // The <amp-form> has on="submit-success:AMP.setState(...)". // References to XHR JSON data should work on submit-success. await expect(controller.getElementText(xhrText)).to.equal( 'John Miller' ); await expect(controller.getElementAttribute(illegalHref, 'href')).to.be .null; await expect(controller.getElementAttribute(templatedText, 'onclick')) .to.be.null; await expect( controller.getElementAttribute(templatedText, 'onmouseover') ).to.be.null; await expect(controller.getElementAttribute(templatedText, 'style')).to .be.null; await expect(controller.getElementText(templatedText)).to.equal( 'textIsLegal' ); }); }); } );