Skip to content
Open
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 @@ -4,6 +4,7 @@ import { describe, expect, it } from 'vitest'
import type { ComponentProps } from 'vue-component-type-helpers'

import { i18n } from '@/i18n'
import { useColorPaletteStore } from '@/stores/workspace/colorPaletteStore'

import AgentConsentCard from './AgentConsentCard.vue'

Expand All @@ -23,6 +24,23 @@ function renderCard(
}

describe('AgentConsentCard', () => {
it.for([
{ paletteId: 'light', forcesDarkTheme: true },
{ paletteId: 'dark', forcesDarkTheme: false },
{ paletteId: 'solarized', forcesDarkTheme: false },
{ paletteId: 'nord', forcesDarkTheme: false }
])(
'with the $paletteId palette active, forces its own dark theme: $forcesDarkTheme',
({ paletteId, forcesDarkTheme }) => {
useColorPaletteStore().activePaletteId = paletteId
renderCard()

const themeScope = screen.getByTestId('agent-consent-theme-scope')
if (forcesDarkTheme) expect(themeScope).toHaveClass('dark-theme')
else expect(themeScope).not.toHaveClass('dark-theme')
}
)

it('labels the supplied copy for its parent dialog', () => {
renderCard()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ import { createReusableTemplate, useResizeObserver } from '@vueuse/core'
import { computed, ref } from 'vue'
import type { ComponentProps } from 'vue-component-type-helpers'

import { cn } from '@comfyorg/tailwind-utils'

import Video from '@/components/common/Video.vue'
import Button from '@/components/ui/button/Button.vue'
import { useColorPaletteStore } from '@/stores/workspace/colorPaletteStore'

const {
title,
Expand All @@ -31,6 +34,11 @@ const emit = defineEmits<{
accept: []
}>()

const colorPaletteStore = useColorPaletteStore()
const isLightPalette = computed(
() => colorPaletteStore.completedActivePalette.light_theme === true
)

const CONTAINER_XL_MIN_WIDTH = 576
const [DefineDocsLink, ReuseDocsLink] = createReusableTemplate()
const containerRef = ref<HTMLElement>()
Expand Down Expand Up @@ -68,7 +76,13 @@ function choose(action: 'accept' | 'reject'): void {
</Button>
</DefineDocsLink>

<div ref="containerRef" class="dark-theme @container w-full max-w-[640px]">
<div
ref="containerRef"
data-testid="agent-consent-theme-scope"
:class="
cn('@container w-full max-w-[640px]', isLightPalette && 'dark-theme')
"
>
<div
data-testid="agent-consent-card"
class="max-h-[85dvh] overflow-y-auto rounded-2xl border border-component-node-border bg-base-background shadow-[0_20px_24px_-4px_rgba(10,13,18,0.4),0_8px_8px_-4px_rgba(10,13,18,0.25),0_3px_3px_-1.5px_rgba(10,13,18,0.2)]"
Expand Down
Loading