-
Notifications
You must be signed in to change notification settings - Fork 6.7k
fix(modal): compile modal before inserting into DOM #5224
Conversation
This looks like a good fix to me - thoughts @Foxandxss and/or @icfantv ? |
If it fixes it, I am all in, but we need to be sure (AKA plunker). |
Looks like there's 13 broken tests in the build. Need to see if the tests are no longer valid or they need to be updated. @onumossn, if you would like this merged, your work is not yet complete. |
The original commit, actually, only fixed issue 1 of the two listed on #5183, so I made additional updates to fix the 2nd issue. @Foxandxss The cases can be tested from the demos, so is a plunker necessary? @icfantv Sorry about that. I had used the wrong command to test initially. I updated the tests. Previously an extra $animate.flush was used because the $compile would use more $animates after the first $animate.flush in the open function, but since the $compile no longer waits for the first $animate, its no longer necessary. |
A test to prove that your PR fixes the issue. |
@onumossn, what @Foxandxss means is take the proper file from the @Foxandxss, @wesleycho, IIRC we added those |
The What you could do is test for the newly created element's presence in the element being appended to ( |
|
before plunker: after plunker: |
@@ -2,5 +2,5 @@ | |||
uib-modal-animation-class="fade" | |||
modal-in-class="in" | |||
ng-style="{'z-index': 1050 + index*10, display: 'block'}"> | |||
<div class="modal-dialog" ng-class="size ? 'modal-' + size : ''"><div class="modal-content" uib-modal-transclude></div></div> | |||
<div class="modal-dialog {{size ? 'modal-' + size : ''}}"><div class="modal-content" uib-modal-transclude></div></div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this change made? This seems unnecessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ngClass was going through the animation processes of all the before and after classes which was causing the size when picking small or large to be regular size when initially rendered and the jump to the correct size.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh, that's a negative of it being tied to $animate...but I guess it can't be avoided then.
This needs a test still that the element is compiled before the $animate.enter completes. |
Added tests |
|
||
topModal = $uibModalStack.getTop(); | ||
|
||
expect(topModal.value.modalDomEl[0].querySelector('#test')).toBeNull(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could just do topModal.value.modalDomEl.find('#test')
here I believe - we have jQuery in the testing situation.
Once the query selectors are changed to just use jQuery, can you squash your commits into one? This LGTM otherwise. |
0447ae2
to
640806f
Compare
db2641b
to
84eaf34
Compare
Update the tests to use jQuery. Sorry for the delay. |
LGTM - thanks for this! |
I think this fixes #5183