Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-Fix build being called before element is ready to build. #4476

Merged
merged 8 commits into from
Aug 12, 2016

Conversation

mkhatib
Copy link
Contributor

@mkhatib mkhatib commented Aug 11, 2016

This is a resubmit of a reverted PR with a fix to the broken test

Original PR: #4426
Revert PR: #4467

Fixes #4397

@mkhatib mkhatib force-pushed the fix-build-ready-bug branch from dca6e50 to bf89cdc Compare August 11, 2016 21:41
@@ -21,8 +21,6 @@ function checkElementUpgrade(element) {
expect(element).to.have.class('-amp-element');
expect(element).to.have.class('-amp-layout-responsive');
expect(element).to.have.class('-amp-layout-size-defined');
expect(element).to.not.have.class('-amp-notbuilt');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please explain.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes sorry. So @zhouyx here is testing only if the element was upgraded and so checking if it doesn't have -amp-unresolved should be enough. Our theory is that the event the test is waiting on is fired maybe too early before the iframe gets built and we weren't able to wait on amp:load:start to fire for the iframe since it might not be laid out because it probably is out of the viewport during the test.

So we opted for just dropping testing the build part in this test and just test upgrade which what the test is intended for.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so removing this works @mkhatib ?
Yes since after the change we don't build directly after upgrade, we can't expect element to be built here. if we dispatch event like amp:built later, we can introduce integration test that test all element gets built correctly. (If necessary)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it passed when I made this change.

@dvoytenko pointed out that we might be breaking something here so I am doing few other runs with different setup, the safest path he suggested is to bring back the build during discoverWork_ but protect against unready-builds. Testing few combinations now will report back.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. brought back the build during discover - and changed the tests to wait on multiple events for the elements numbers. This has passed but the test flaked - rerunning the test for this but it should be good to go.

@zhouyx
Copy link
Contributor

zhouyx commented Aug 11, 2016

LGTM. defer to @dvoytenko

@dvoytenko
Copy link
Contributor

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

buildCallback invoked when hasNextNodeInDocumentOrder is false
3 participants