mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-14 01:20:03 +00:00
Move component tests into the same directory as their component counterparts (#3625)
Co-authored-by: Benjamin Lu <templu1107@proton.me>
This commit is contained in:
46
src/components/dialog/content/setting/SettingItem.spec.ts
Normal file
46
src/components/dialog/content/setting/SettingItem.spec.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import { mount } from '@vue/test-utils'
|
||||
import { createPinia } from 'pinia'
|
||||
import PrimeVue from 'primevue/config'
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import { createI18n } from 'vue-i18n'
|
||||
|
||||
import SettingItem from './SettingItem.vue'
|
||||
|
||||
const i18n = createI18n({
|
||||
legacy: false,
|
||||
locale: 'en'
|
||||
})
|
||||
|
||||
vi.mock('@/utils/formatUtil', () => ({
|
||||
normalizeI18nKey: vi.fn()
|
||||
}))
|
||||
|
||||
describe('SettingItem', () => {
|
||||
const mountComponent = (props: any, options = {}): any => {
|
||||
return mount(SettingItem, {
|
||||
global: {
|
||||
plugins: [PrimeVue, i18n, createPinia()]
|
||||
},
|
||||
props,
|
||||
...options
|
||||
})
|
||||
}
|
||||
|
||||
it('translates options that use legacy type', () => {
|
||||
const wrapper = mountComponent({
|
||||
setting: {
|
||||
id: 'Comfy.NodeInputConversionSubmenus',
|
||||
name: 'Node Input Conversion Submenus',
|
||||
type: 'combo',
|
||||
value: 'Top',
|
||||
options: () => ['Correctly Translated']
|
||||
}
|
||||
})
|
||||
|
||||
// Get the options property of the FormItem
|
||||
const options = wrapper.vm.formItem.options
|
||||
expect(options).toEqual([
|
||||
{ text: 'Correctly Translated', value: 'Correctly Translated' }
|
||||
])
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user