-
Notifications
You must be signed in to change notification settings - Fork 244
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
Add isVisible and stub transition/transition-group by default #212
Conversation
} | ||
} | ||
|
||
it('returns false when element hidden via v-show', () => { |
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.
suggestion: WDYT of adding one more pair of tests returns false when ancestor is hidden via v-show
to capture our intent - we're detecting visibility not only on entire element itself
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.
Sure, good idea.
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.
done!
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.
LGTM, nice work @lmiller1990 !
element.nodeName !== '#comment' && | ||
isStyleVisible(element) && | ||
isAttributeVisible(element) && | ||
(!element.parentElement || isElementVisible(element.parentElement)) |
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.
I guess this was battle-tested in VTU 1, but just in case here is how jQuery tests the visibility https://github.com/jquery/jquery/blob/d0ce00cdfa680f1f0c38460bc51ea14079ae8b07/src/css/hiddenVisibleSelectors.js (we implement the same logic in an Angular testing library).
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.
I just coped this from another library (dom-testing-library, or something? same as V1).
There is even more robust visible checks out there; since the primary use case is v-show
, which does this via display: none
, I think this should cover the main use cases. We could make it more robust if someone has a problem. Surprisingly how had a true visibility selector can be to implement...
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.
resolves #210
isVisible
back. We decided to un-deprecate it in V1, porting it to V2.v-show
.transition: false
andtransition-group: false
toglobal.stubs
.config.global.stubs = { transition: false }
. This is useful for libraries like cypress-vue who do not stub things, since they are not constrained by things likenextTick
like when testing in jsdom with jest.