Add more integration tests for amp-form#7525
Conversation
| actionXhr: baseUrl + '/form/post', | ||
| on: 'submit:sameform.submit', | ||
| }); | ||
| const ampForm = new AmpForm(form); |
There was a problem hiding this comment.
I see AmpForm constructor takes in an element and an id? Should we add an id here?
| ' {{#interests}}{{title}} {{/interests}}.', | ||
| errorTemplate: 'Should not render this.', | ||
| }); | ||
| new AmpForm(form); |
| new AmpForm(form); | ||
| const errors = []; | ||
| const realSetTimeout = window.setTimeout; | ||
| sandbox.stub(window, 'setTimeout', (callback, delay) => { |
There was a problem hiding this comment.
I don't quite get why are we stubing window.setTimeout here. Shouldn't the callback takes care of error handling?
There was a problem hiding this comment.
Ah yeah, I am doing this because of the rethrowAsync call inside the catch callback of the fetch call. The only way I could think of catching the async error is through stubbing timeout and forcing a try-catch clause to avoid the tests flaking because of async-thrown error.
There was a problem hiding this comment.
Then a brief description would be helpful here i think.
|
PTAL 👀 |
| new AmpForm(form); | ||
| const errors = []; | ||
| const realSetTimeout = window.setTimeout; | ||
| sandbox.stub(window, 'setTimeout', (callback, delay) => { |
There was a problem hiding this comment.
Then a brief description would be helpful here i think.
Closes #7154