Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,7 @@ function renderBaseTerminal(props: Record<string, unknown> = {}) {
return render(BaseTerminal, {
props,
global: {
plugins: [getActivePinia()!, i18n],
stubs: {
Button: {
template: '<button v-bind="$attrs"><slot /></button>',
props: ['icon', 'severity', 'size']
}
}
plugins: [getActivePinia()!, i18n]
}
})
}
Expand Down
8 changes: 0 additions & 8 deletions src/components/common/CustomizationDialog.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,6 @@ vi.mock<unknown>(
})
)

vi.mock<unknown>(import('@/components/ui/button/Button.vue'), () => ({
default: {
name: 'Button',
template: `<button @click="$emit('click')"><slot /></button>`,
emits: ['click']
}
}))

const i18n = createI18n({ legacy: false, locale: 'en', messages: { en: {} } })

function renderDialog(extraProps: Record<string, unknown> = {}) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,7 @@ function renderComponent(
return render(CancelSubscriptionDialogContent, {
props,
global: {
plugins: [i18n],
stubs: {
Button: {
template: '<button :disabled="disabled"><slot /></button>',
props: ['disabled', 'variant', 'size', 'loading']
}
}
plugins: [i18n]
}
})
}
Expand Down
7 changes: 1 addition & 6 deletions src/components/error/ErrorOverlay.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,7 @@ function renderOverlay(props: { appMode?: boolean } = {}) {
return render(ErrorOverlay, {
props,
global: {
plugins: [createTestI18n()],
stubs: {
Button: {
template: '<button v-bind="$attrs"><slot /></button>'
}
}
plugins: [createTestI18n()]
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/hdr/HdrViewerContent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function makeViewer(overrides: Record<string, unknown> = {}) {
function renderViewer() {
return render(HdrViewerContent, {
props: { imageUrl: '/api/view?filename=out.exr' },
global: { plugins: [i18n], stubs: { Button: true } }
global: { plugins: [i18n] }
})
}

Expand Down
7 changes: 0 additions & 7 deletions src/components/imagecrop/WidgetImageCrop.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,6 @@ const i18n = createI18n({
}
})

const ButtonStub = defineComponent({
name: 'Button',
inheritAttrs: false,
template: '<button v-bind="$attrs" type="button"><slot /></button>'
})

const Passthrough = defineComponent({
template: '<div><slot /></div>'
})
Expand Down Expand Up @@ -144,7 +138,6 @@ function renderWidget(
global: {
plugins: [i18n],
stubs: {
Button: ButtonStub,
Select: Passthrough,
SelectContent: Passthrough,
SelectTrigger: Passthrough,
Expand Down
6 changes: 0 additions & 6 deletions src/components/load3d/Load3D.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,6 @@ function renderLoad3D(options: RenderOptions = {}) {
ViewerControls: {
name: 'ViewerControls',
template: '<div data-testid="viewer-controls" />'
},
Button: {
name: 'Button',
props: ['ariaLabel'],
template:
'<button type="button" :aria-label="ariaLabel"><slot /></button>'
}
},
directives: {
Expand Down
4 changes: 0 additions & 4 deletions src/components/load3d/Load3dViewerContent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,6 @@ async function renderViewerContent(options: RenderOptions = {}) {
SceneControls: {
name: 'SceneControls',
template: '<div data-testid="scene-controls" />'
},
Button: {
name: 'Button',
template: '<button type="button"><slot /></button>'
}
}
}
Expand Down
9 changes: 0 additions & 9 deletions src/components/maskeditor/dialog/TopBarHeader.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,6 @@ vi.mock(import('@/composables/maskeditor/useMaskEditorSaver'), () => ({
useMaskEditorSaver: () => mockSaver
}))

vi.mock<unknown>(import('@/components/ui/button/Button.vue'), () => ({
default: {
name: 'ButtonStub',
props: ['variant', 'disabled'],
template:
'<button :data-variant="variant" :disabled="disabled"><slot /></button>'
}
}))

const i18n = createI18n({
legacy: false,
locale: 'en',
Expand Down
8 changes: 1 addition & 7 deletions src/components/painter/WidgetPainter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,6 @@ const i18n = createI18n({
}
})

const ButtonStub = defineComponent({
name: 'Button',
inheritAttrs: false,
template: '<button v-bind="$attrs" type="button"><slot /></button>'
})

const SliderStub = defineComponent({
name: 'Slider',
props: {
Expand Down Expand Up @@ -106,7 +100,7 @@ function renderWidget(initialModel = '') {
return render(Harness, {
global: {
plugins: [i18n],
stubs: { Button: ButtonStub, Slider: SliderStub }
stubs: { Slider: SliderStub }
}
})
}
Expand Down
14 changes: 1 addition & 13 deletions src/components/queue/job/JobContextMenu.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,6 @@ const popoverStub = defineComponent({
`
})

const buttonStub = {
props: {
disabled: { type: Boolean, default: false },
ariaLabel: { type: String, default: undefined }
},
template: `
<button :disabled="disabled" :aria-label="ariaLabel">
<slot />
</button>
`
}

type MenuHandle = { open: (e: Event) => Promise<void>; hide: () => void }

const createEntries = (): MenuEntry[] => [
Expand Down Expand Up @@ -98,7 +86,7 @@ function renderMenu(entries: MenuEntry[], onAction?: ReturnType<typeof vi.fn>) {
const { unmount } = render(Wrapper, {
props: { onAction: actionSpy },
global: {
stubs: { Popover: popoverStub, Button: buttonStub }
stubs: { Popover: popoverStub }
}
})

Expand Down
1 change: 0 additions & 1 deletion src/components/rightSidePanel/RightSidePanel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ function createPanelI18n() {
}

const panelStubs = {
Button: { template: '<button><slot /></button>' },
EditableText: true,
Tab: { template: '<button v-bind="$attrs"><slot /></button>' },
TabErrors: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,7 @@ describe('ErrorNodeCard.vue', () => {
global: {
plugins: [PrimeVue, i18n, getActivePinia()!],
stubs: {
TransitionCollapse: { template: '<div><slot /></div>' },
Button: {
template: '<button v-bind="$attrs"><slot /></button>'
}
TransitionCollapse: { template: '<div><slot /></div>' }
}
}
})
Expand Down
3 changes: 0 additions & 3 deletions src/components/rightSidePanel/errors/TabErrors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,6 @@ describe('TabErrors.vue', () => {
AsyncSearchInput: {
template:
'<input @input="$emit(\'update:modelValue\', $event.target.value)" />'
},
Button: {
template: '<button v-bind="$attrs"><slot /></button>'
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ describe('SectionWidgets', () => {
global: {
plugins: [i18n],
stubs: {
Button: true,
WidgetItem: WidgetItemStub,
PropertiesAccordionItem: PropertiesAccordionItemStub
}
Expand Down
5 changes: 0 additions & 5 deletions src/components/sidebar/tabs/AssetsSidebarTab.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,6 @@ const assetsGridStub = {
`
}

const buttonStub = {
template: '<button><slot /></button>'
}

function renderTab() {
return render(AssetsSidebarTab, {
global: {
Expand All @@ -149,7 +145,6 @@ function renderTab() {
SidebarTabTemplate: sidebarTabTemplateStub,
AssetsSidebarGridView: assetsGridStub,
AssetsSidebarListView: true,
Button: buttonStub,
MediaAssetFilterBar: true,
MediaAssetSelectionBar: true,
MediaLightbox: true,
Expand Down
4 changes: 0 additions & 4 deletions src/components/sidebar/tabs/BaseWorkflowsSidebarTab.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,6 @@ vi.mock<unknown>(
})
)

vi.mock<unknown>(import('@/components/ui/button/Button.vue'), () => ({
default: { name: 'Button', template: '<button><slot /></button>' }
}))

vi.mock<unknown>(import('@/composables/useTreeExpansion'), () => ({
useTreeExpansion: () => ({
expandNode: mockExpandNode,
Expand Down
5 changes: 1 addition & 4 deletions src/components/topbar/WorkflowTab.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,7 @@ function renderTab({
global: {
plugins: [i18n],
stubs: {
WorkflowActionsList: true,
Button: {
template: '<button v-bind="$attrs"><slot /></button>'
}
WorkflowActionsList: true
}
},
props: {
Expand Down
3 changes: 1 addition & 2 deletions src/components/videoEdit/VideoEditPanel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ function renderPanel(props: Partial<PanelProps> = {}) {
SelectTrigger: stub('stub-select-trigger'),
SelectValue: stub('stub-select-value'),
SelectContent: stub('stub-select-content'),
SelectItem: stub('stub-select-item'),
Button: stub('stub-lock-button')
SelectItem: stub('stub-select-item')
}
}
})
Expand Down
3 changes: 1 addition & 2 deletions src/platform/assets/components/AssetCard.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ function renderCard(asset: AssetDisplayItem) {
AssetBadgeGroup: true,
IconGroup: true,
MoreButton: true,
StatusBadge: true,
Button: { template: '<button><slot /></button>' }
StatusBadge: true
},
directives: {
tooltip: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,6 @@ const asset: AssetItem = fromPartial({
user_metadata: {}
})

const buttonStub = {
template: '<div class="button-stub"><slot /></div>'
}

interface MediaAssetContextMenuExposed {
show: (event: MouseEvent) => void
}
Expand All @@ -129,8 +125,7 @@ function mountComponent(targetAsset: AssetItem = asset) {
global: {
plugins: [i18n],
stubs: {
ContextMenu: contextMenuStub,
Button: buttonStub
ContextMenu: contextMenuStub
}
}
}
Expand Down
15 changes: 7 additions & 8 deletions src/platform/cloud/subscription/components/CreditsTile.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,6 @@ function renderTile(props: Record<string, unknown> = {}) {
plugins: [i18n],
directives: { tooltip: () => {} },
stubs: {
Button: {
template:
'<button v-bind="$attrs" :data-variant="variant" :disabled="loading" @click="$emit(\'click\')"><slot/></button>',
props: ['variant', 'size', 'loading'],
emits: ['click']
},
Skeleton: { template: '<div role="status" aria-label="Loading"></div>' }
}
}
Expand Down Expand Up @@ -576,7 +570,10 @@ describe('CreditsTile', () => {
"You're now spending additional credits."
)
expect(screen.getByText('In use')).toBeTruthy()
expect(screen.getByText('Add credits').dataset.variant).toBe('secondary')
expect(screen.getByRole('button', { name: 'Add credits' })).toHaveClass(
'bg-interface-menu-component-surface-selected',
'hover:bg-secondary-background-hover'
)
})

it('emphasizes add-credits when fully out of credits', () => {
Expand All @@ -594,7 +591,9 @@ describe('CreditsTile', () => {
'Add more credits to continue generating.'
)
expect(screen.queryByText('In use')).toBeNull()
expect(screen.getByText('Add credits').dataset.variant).toBe('inverted')
expect(screen.getByRole('button', { name: 'Add credits' })).toHaveClass(
'bg-base-foreground'
)
})

it('suppresses the depletion notice until the balance has loaded', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,7 @@ function renderComponent(
return render(SubscriptionFooterLinks, {
props,
global: {
plugins: [i18n],
stubs: {
Button: {
props: ['loading'],
emits: ['click'],
template: '<button @click="$emit(\'click\')"><slot /></button>'
}
}
plugins: [i18n]
}
})
}
Expand Down
4 changes: 0 additions & 4 deletions src/platform/secrets/components/SecretFormDialog.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ vi.mock<unknown>(
})
)

vi.mock<unknown>(import('@/components/ui/button/Button.vue'), () => ({
default: { name: 'Button', template: '<button><slot /></button>' }
}))

vi.mock<unknown>(import('@/components/ui/select/Select.vue'), () => ({
default: { name: 'Select', template: '<div><slot /></div>' }
}))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ vi.mock<unknown>(import('primevue/password'), () => ({
default: { name: 'Password', template: '<input type="password" />' }
}))

vi.mock<unknown>(import('@/components/ui/button/Button.vue'), () => ({
default: { name: 'Button', template: '<button><slot /></button>' }
}))
vi.mock<unknown>(import('@/components/ui/select/Select.vue'), () => ({
default: { name: 'Select', template: '<div><slot /></div>' }
}))
Expand Down
7 changes: 0 additions & 7 deletions src/platform/secrets/components/SecretListItem.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,6 @@ function renderComponent(props: {
props,
global: {
plugins: [i18n],
stubs: {
Button: {
template:
'<button :disabled="disabled" @click="$emit(\'click\')"><slot /></button>',
props: ['disabled', 'variant', 'size', 'aria-label']
}
},
directives: {
tooltip: () => {}
}
Expand Down
5 changes: 0 additions & 5 deletions src/platform/secrets/components/SecretsPanel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,6 @@ function renderPanel() {
TabPanel: { template: '<div><slot /></div>' },
Divider: true,
ProgressSpinner: true,
Button: {
template:
'<button :disabled="disabled" @click="$emit(\'click\')"><slot /></button>',
props: ['disabled']
},
SecretListItem: {
template:
'<button data-testid="delete-trigger" @click="$emit(\'delete\')">delete</button>',
Expand Down
Loading
Loading