Fix the epic reference in the work item popover
What does this MR do and why?
The work item popover rendered epic references with a # instead of a &. An epic
that should read group/project&1 read group/project#1.
reference picks the separator from the work item type:
reference() {
return this.type === WORK_ITEM_TYPE_NAME_EPIC
? this.workItem.fullReference?.replaceAll('#', '&')
: this.workItem.fullReference;
},Nothing defines type. The component's props are target, namespacePath, iid,
cachedTitle, cachedTitleHtml and show, and there is no type computed property
or data key. So the value was always undefined and the epic branch never ran.
Where it went wrong
Commit 28f6772f added reference alongside a matching computed property:
type() {
return this.workItem.workItemType?.name;
},Commit 18b82a4b ("Show status badge on Issue popover") then renamed that property
to workItemType and workItemTypeName and updated the template, but left
reference reading the old name. This MR points it at workItemTypeName, which is
the direct successor.
How to verify
The spec gains a case for an epic. It fails on master and passes here:
yarn jest spec/frontend/issuable/popover/components/work_item_popover_spec.js
VUE_VERSION=3 yarn jest spec/frontend/issuable/popover/components/work_item_popover_spec.jsWithout the one-line change, the new test reports:
Expected substring: "namespace7/project-11&1"
Received string: "Opened 4 days ago My title 24 namespace7/project-11#1"The existing fixture is an issue, which is why no test caught this. The new case
reuses that fixture with workItemType.name set to Epic.
How it was found
By narrowing the Jest console watcher's render-warning suppression in !250835 (merged). That suppression hides every "property is not defined on the instance" warning. Vue 2 hides it as well, because it binds a computed getter to the raw instance and never warns, so only the Vue 3 lane reports it:
[Vue warn]: Property "type" was accessed during render but is not defined on instance.References
- Found while working on: !250835 (merged)
- Tracking issue for the defects it unmasked: #617796 (closed)