mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-05 05:32:02 +00:00
Migrate vue widget data to use refs
This commit is contained in:
@@ -3,6 +3,7 @@ import Button from 'primevue/button'
|
||||
import type { ButtonProps } from 'primevue/button'
|
||||
import PrimeVue from 'primevue/config'
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import { ref, watch } from 'vue'
|
||||
|
||||
import WidgetButton from '@/renderer/extensions/vueNodes/widgets/components/WidgetButton.vue'
|
||||
import type { SimplifiedWidget } from '@/types/simplifiedWidget'
|
||||
@@ -12,13 +13,16 @@ describe('WidgetButton Interactions', () => {
|
||||
options: Partial<ButtonProps> = {},
|
||||
callback?: () => void,
|
||||
name: string = 'test_button'
|
||||
): SimplifiedWidget<void> => ({
|
||||
name,
|
||||
type: 'button',
|
||||
value: undefined,
|
||||
options,
|
||||
callback
|
||||
})
|
||||
): SimplifiedWidget<void> => {
|
||||
const valueRef = ref()
|
||||
if (callback) watch(valueRef, callback)
|
||||
return {
|
||||
name,
|
||||
type: 'button',
|
||||
value: () => valueRef,
|
||||
options
|
||||
}
|
||||
}
|
||||
|
||||
const mountComponent = (widget: SimplifiedWidget<void>, readonly = false) => {
|
||||
return mount(WidgetButton, {
|
||||
|
||||
Reference in New Issue
Block a user