Fix spec failure in vue3 migration
What does this MR do and why?
resolves #2753 (closed)
In Vue3, a compiled SFC render function is using a _ctx
param refer to the context rather than using this
in Vue2, so in https://jihulab.com/gitlab-cn/gitlab/-/blob/6f27bb053ef63873e9541e9bdd59bf1368c95a2a/jh/app/assets/javascripts/repository/components/tree_content.vue#L56 , we need to pass this
as a param to the original render
function
Vue2
function () {
var _vm = this
var _h = _vm.$createElement
/* istanbul ignore next */
var _c = _vm._self._c || _h
return _c(
"div",
[
_c("file-table", {
attrs: {
path: _vm.path,
entries: _vm.entries,
"is-loading": _vm.isLoadingFiles,
"loading-path": _vm.loadingPath,
"has-more": _vm.hasShowMore,
commits: _vm.commits,
},
on: { showMore: _vm.handleShowMore, "row-appear": _vm.handleRowAppear },
}),
_vm._v(" "),
_vm.readme
? _c("file-preview", { attrs: { blob: _vm.readme } })
: _vm._e(),
],
1
)
}
Vue3
function render(_ctx, _cache) {
const _component_file_table = (0, _vue.resolveComponent)('file-table');
const _component_file_preview = (0, _vue.resolveComponent)('file-preview');
return (
(0, _vue.openBlock)(),
(0, _vue.createElementBlock)('div', null, [
(0, _vue.createVNode)(
_component_file_table,
{
path: _ctx.path,
entries: _ctx.entries,
'is-loading': _ctx.isLoadingFiles,
'loading-path': _ctx.loadingPath,
'has-more': _ctx.hasShowMore,
commits: _ctx.commits,
onShowMore: _ctx.handleShowMore,
onRowAppear: _ctx.handleRowAppear,
},
null,
8,
/* PROPS */
[
'path',
'entries',
'is-loading',
'loading-path',
'has-more',
'commits',
'onShowMore',
'onRowAppear',
],
),
(0, _vue.createTextVNode)(),
_ctx.readme
? ((0, _vue.openBlock)(),
(0, _vue.createBlock)(
_component_file_preview,
{
key: 0,
blob: _ctx.readme,
},
null,
8,
/* PROPS */
['blob'],
))
: (0, _vue.createCommentVNode)('v-if', true),
])
);
}
Screenshots or screen recordings
How to set up and validate locally
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
由 Kun Qian 编辑于