From f6d63c2bbb0f13559d23cbe815f63bac7a629ab9 Mon Sep 17 00:00:00 2001 From: Tomas Vondracek Date: Mon, 26 Oct 2026 11:39:48 +0100 Subject: [PATCH] refactor: replace the slot-scope syntax and $set removed in Vue 3 Vue 3 drops the `slot`/`slot-scope` attributes and `vm.$set`; both replacements already work on Vue 2.7, and behaviour is unchanged. Select: the record-link `singleLabel` template moves to `#singleLabel`. Its `v-if` reads the slot props, so it moves inside the slot; when it is false the slot renders nothing and vue-multiselect falls back to its own label, as before. The status `singleLabel` template is removed: Vue 2 keeps only the last template per slot name, so it never rendered. Imagelist: `this.$set(list, i, item)` becomes `list.splice(i, 1, item)`, which is what `$set` does for arrays in Vue 2. The multiselect stub now passes the first selected item to `singleLabel`, like vue-multiselect, so the selected-value label can be tested. --- assets/js/app/editor/Components/Imagelist.vue | 2 +- assets/js/app/editor/Components/Select.vue | 24 +++++++++---------- tests/unit/components/Select.spec.ts | 17 +++++++++++++ tests/unit/helpers/stubs.ts | 8 +++++-- 4 files changed, 35 insertions(+), 16 deletions(-) diff --git a/assets/js/app/editor/Components/Imagelist.vue b/assets/js/app/editor/Components/Imagelist.vue index 8e7e57875b..6e417aff2a 100644 --- a/assets/js/app/editor/Components/Imagelist.vue +++ b/assets/js/app/editor/Components/Imagelist.vue @@ -119,7 +119,7 @@ export default { let fieldNumber = this.getFieldNumberFromElement(elem); let updatedImage = this.containerImages[fieldNumber]; updatedImage.hidden = true; - this.$set(this.containerImages, fieldNumber, updatedImage); + this.containerImages.splice(fieldNumber, 1, updatedImage); }, fieldName(index) { return this.name + '[' + index + ']'; diff --git a/assets/js/app/editor/Components/Select.vue b/assets/js/app/editor/Components/Select.vue index 9c87b06913..dcc5ad1879 100644 --- a/assets/js/app/editor/Components/Select.vue +++ b/assets/js/app/editor/Components/Select.vue @@ -19,24 +19,22 @@ :loading="isLoading" @tag="addTag" > - -