3
0

Fix lib/js tests

This commit is contained in:
Jože Fortun
2023-09-21 14:48:37 +02:00
parent a544780753
commit 733c56e7fc
3 changed files with 21 additions and 5 deletions
@@ -1040,8 +1040,8 @@ export default {
beforeDestroy () {
this.abortRequests()
this.setDefaultValues()
this.destroyEvents()
this.setDefaultValues()
},
created () {
@@ -834,8 +834,11 @@ export default {
}
this.page = new compose.Page(page)
await this.fetchPageLayouts()
this.setLayout(layout.pageLayoutID)
if (layout.pageLayoutID !== this.layout.pageLayoutID) {
await this.fetchPageLayouts()
this.setLayout(layout.pageLayoutID)
}
}).finally(() => {
this.processing = false
}).catch(this.toastErrorHandler(this.$t('notification:page.page-layout.save.failed')))
@@ -973,6 +976,18 @@ export default {
},
async setLayout (layoutID) {
const oldLayoutID = this.$route.query.layoutID
// Cancelable redirect
if (layoutID && oldLayoutID !== layoutID) {
try {
await this.$router.replace({ ...this.$route, query: { ...this.$route.query, layoutID } })
} catch {
this.$refs.layoutSelect.localValue = oldLayoutID
return
}
}
this.processingLayout = true
layoutID = layoutID || this.$route.query.layoutID
@@ -987,6 +1002,7 @@ export default {
return this.$router.push(this.pageEditor)
}
// If no previous layout was set and it exists, replace the URL with the proper layoutID
if (this.$route.query.layoutID !== this.layout.pageLayoutID) {
this.$router.replace({ ...this.$route, query: { ...this.$route.query, layoutID: this.layout.pageLayoutID } })
}
+2 -2
View File
@@ -105,8 +105,8 @@ export class PageBlock {
this.meta.tempID = this.meta.tempID || generateUID()
}
clone (): PageBlockInput {
return PageBlockMaker({ ...JSON.parse(JSON.stringify(this)), blockID: NoID, meta: { tempID: generateUID() } })
clone (): this {
return new (this.constructor as new (i?: PageBlockInput) => this)({ ...JSON.parse(JSON.stringify(this)), blockID: NoID, meta: { tempID: '' } })
}
}