Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Herwege <[email protected]>
  • Loading branch information
mherwege committed Nov 18, 2024
1 parent df523f3 commit 800c925
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ export default {
{ key: 'datetime', value: 'Date and Time' }
]

if (!this.itemsList || !this.itemsList.length) {
if (!this.itemsList) {
this.$oh.api.get('/rest/items?staticDataOnly=true').then((items) => {
this.items = items
this.itemsReady = true
})
} else {
this.items = this.itemsList
this.items = this.itemsList ?? []
this.itemsReady = true
}
},
Expand All @@ -89,7 +89,7 @@ export default {
},
widgetItemLabel (includeItemName) {
const item = this.items.find(i => i.name === this.widget.config.item)
return item.label + (includeItemName ? ' (' + item.name + ')' : '')
return (item?.label ?? this.widget.config.item) + (includeItemName ? ' (' + item?.name ?? '' + ')' : '')
},
widgetConfigDescription (includeItemName) {
const buttonPosition = this.widget.component === 'Button' ? ' (' + (this.widget.config?.row ?? '-') + ',' + (this.widget.config?.column ?? '-') + ')' : ''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
:key="idx"
:includeItemName="includeItemName"
:widget="childwidget" :parent-widget="widget"
:itemsList="itemsList"
:itemsList="items"
@selected="(event) => $emit('selected', event)"
:selected="selected" />
<div slot="label" class="subtitle">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import PagesList from '../../pages-list.vue'
import SitemapEdit from '../sitemap-edit.vue'
import { shallowMount, createLocalVue } from '@vue/test-utils'
import Framework7 from 'framework7'
Expand All @@ -24,7 +23,8 @@ describe('SitemapEdit', () => {
open: () => { }
}
}
}
},
data: { sitemap: {} }
}
}
})
Expand All @@ -34,7 +34,8 @@ describe('SitemapEdit', () => {
localVue,
propsData: {
createMode: true,
uid: 'test'
uid: 'test',
itemsList: []
}
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ export default {
WidgetDetails,
AttributeDetails
},
props: ['createMode', 'uid'],
props: ['createMode', 'uid', 'itemsList'],
data () {
if (!this.$f7.data.sitemap) this.$f7.data.sitemap = {}
return {
Expand Down

0 comments on commit 800c925

Please sign in to comment.