chore(vue3): explicitly unstub root component in test
What does this MR do?
@vue/test-utils
v1 has a limitation - when you're using shallowMount
it is not stubbing the component, located at root.
So if you have following template (for component named GlFormGroup
):
<template>
<b-form-group>
<div><b-some-component></b-some-component></div>
</b-form-group>
</template>
in @vue/test-utils@1
only <b-some-component>
will be stubbed:
flowchart LR
GlFormGroup:::unstubbed-->BFormGroup:::unstubbed-->div-->BSomeComponent:::stubbed
classDef unstubbed fill:lightgreen,stroke:black,stroke-width:4px
classDef stubbed fill:pink,stroke:black,stroke-width: 4px, stroke-dasharray: 20 5
This is due to limitations of extremely hacky createElement
patching.
In @vue/test-utils@2
situation is more consistent and expected:
flowchart LR
GlFormGroup:::unstubbed-->BFormGroup:::stubbed-->div-->BSomeComponent:::stubbed
classDef unstubbed fill:lightgreen,stroke:black,stroke-width:4px
classDef stubbed fill:pink,stroke:black,stroke-width: 4px, stroke-dasharray: 20 5
In order to support future migration to @vue/compat
we're explicitly unstubbing BFormGroup
in test
This is forward-compatible change to support @vue/compat #1981 (closed)
Does this MR meet the acceptance criteria?
Conformity
-
Code review guidelines. -
GitLab UI's contributing guidlines. -
If it changes a Pajamas-compliant component's look & feel, the MR has been reviewed by a UX designer. -
If it changes GitLab UI's documentation guidelines, the MR has been reviewed by a Technical Writer. -
If the MR changes a component's API, integration MR(s) have been opened in the following projects to ensure that the @gitlab/ui
package can be upgraded quickly after the changes are released:-
GitLab: mr_url -
CustomersDot: mr_url -
Status Page: mr_url
-
-
Added the ~"component:*"
label(s) if applicable.
Edited by Illya Klymov