Loading
Fix three frontend specs for the Vue 3 compiler
What does this MR do and why?
These spec changes are needed before CI can run the Jest lanes with the Vue 3 template compiler. They also work with the Vue 2 compiler, so they can merge now. After that, the compiler switch MR contains only the switch.
dap_impact_panels_spec.js: the spec expected a space between two table cells. The Vue 3 compiler removes whitespace between elements, so the row text has no space before "DAP Impact group". The regex no longer requires that space.workplan_spec.js: the spec clicked a dropdown item right after it opened the dropdown. With the Vue 3 compiler, the items are slot content ofGlBaseDropdown, so opening the dropdown renders them again with new keys. The click landed on the old, unmounted item, and Vue 3 dropped its action event. The spec now waits foraria-expanded="true"on the toggle before it clicks.shared_sfc_mutation_spec.js: the spec tests the@vue/compatpatch for an options object that the Vue 2 and the Vue 3 runtime share. Production compiles that object with the Vue 2 compiler until Vue 2 is removed. With the Vue 3 template compiler, Jest built the fixtures for Vue 3 only, so the Vue 2 runtime could not render them. The two template fixtures are now plain options objects that compile their template withcompileTemplatefromvue/compiler-sfc, the Vue 2 call that vue-loader 15 makes. So the spec runs in every lane. Skipping it instead would leave the patch untested, because no other job runs its Vue 3 tests.
How to verify
I ran the specs locally on this branch, with the fixtures from a master pipeline:
| Spec | Default (Vue 2) | VUE_VERSION=3 VUE_COMPILER_VERSION=3 |
|---|---|---|
Both integration specs (yarn jest:integration) |
33 passed | 33 passed |
shared_sfc_mutation_spec.js |
2 passed, 7 skipped (Vue 3 only tests, as on master) | 9 passed |
With the master version of the two integration specs, the Vue 3 compiler lane fails 2 tests, one in each spec. That proves the change is necessary.
shared_sfc_mutation_spec.js also passes 9 of 9 with VUE_VERSION=3 and the Vue 2 compiler.
References
- Part of #634491
- Moved from !263251 (merged), which runs the Jest lanes with the Vue 3 compiler in CI
- Same plan as !263207, the Vue 2 removal POC
- Skip replaced after review in !263821 (merged), because it left the
@vue/compatpatch from 74eaa347 untested
Edited by Miguel Rincon