Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
test(generate): drop style-assertion tests
Josh Corbett241ef4de9076
diff --git a/invokeai/frontend/webv2/src/features/generation/ui/shared/GenerateCollapsibleSection.browser.test.tsx b/invokeai/frontend/webv2/src/features/generation/ui/shared/GenerateCollapsibleSection.browser.test.tsxindex e77e09bfe7..6254140aae 100644--- a/invokeai/frontend/webv2/src/features/generation/ui/shared/GenerateCollapsibleSection.browser.test.tsx+++ b/invokeai/frontend/webv2/src/features/generation/ui/shared/GenerateCollapsibleSection.browser.test.tsx@@ -1,5 +1,4 @@-/* oxlint-disable react-perf/jsx-no-new-object-as-prop */-import { ChakraProvider, Stack } from '@chakra-ui/react';+import { ChakraProvider } from '@chakra-ui/react';import { system } from '@theme/system';import { act } from 'react';import { createRoot, type Root } from 'react-dom/client';@@ -9,7 +8,7 @@ import { GenerateCollapsibleSection } from './GenerateCollapsibleSection';vi.mock('@features/generation/ui/GenerationUiContext', () => ({useGenerationUi: () => ({- sectionPreferences: { sectionsOpen: { 'open-section': true, 'shut-section': false }, setSectionOpen: vi.fn() },+ sectionPreferences: { sectionsOpen: {}, setSectionOpen: vi.fn() },}),}));@@ -35,9 +34,7 @@ const render = async (children: React.ReactNode) => {});};-const getSections = () => [...document.querySelectorAll<HTMLElement>('.generate-section')];--describe('GenerateCollapsibleSection list styling', () => {+describe('GenerateCollapsibleSection', () => {it('styles by DOM state so uncontrolled sections (no sectionId) still read as cards', async () => {// Upscale's sections pass only defaultOpen — openness never reaches the// component as a prop, so any prop-driven styling is blind to them.@@ -47,81 +44,9 @@ describe('GenerateCollapsibleSection list styling', () => {</GenerateCollapsibleSection>);- const [section] = getSections();+ const section = document.querySelector<HTMLElement>('.generate-section');expect(section?.dataset.state).toBe('open');expect(getComputedStyle(section!).backgroundColor).not.toBe('rgba(0, 0, 0, 0)');- // A lone row has no neighboring section, so no separator shows.- expect(getComputedStyle(section!, '::before').opacity).toBe('0');- expect(getComputedStyle(section!, '::after').content).toBe('none');- });-- it('draws one overlay hairline per section|section boundary and fades the ones touching an open card', async () => {- await render(- <Stack gap={1}>- <GenerateCollapsibleSection label="A" sectionId="open-section">- <div>a</div>- </GenerateCollapsibleSection>- <GenerateCollapsibleSection label="B" sectionId="shut-section">- <div>b</div>- </GenerateCollapsibleSection>- <GenerateCollapsibleSection label="C" sectionId="shut-section">- <div>c</div>- </GenerateCollapsibleSection>- </Stack>- );-- const [open, afterOpen, afterClosed] = getSections();-- expect(open?.dataset.state).toBe('open');- expect(afterOpen?.dataset.state).toBe('closed');-- // The separators are pseudo-element overlays centered in the gap — real- // borders or margins would move content on open/close. Each boundary gets- // exactly ONE 1px line (the lower row's ::before): a second overlapping- // half would stack the translucent border color into a heavier line.- for (const section of [open, afterOpen, afterClosed]) {- expect(getComputedStyle(section!).borderTopWidth).toBe('0px');- expect(getComputedStyle(section!).marginTop).toBe('0px');- expect(getComputedStyle(section!, '::before').position).toBe('absolute');- expect(getComputedStyle(section!, '::before').top).toBe('-2px');- expect(getComputedStyle(section!, '::before').borderTopWidth).toBe('1px');- // Separators live only between rows: nothing ever closes the list.- expect(getComputedStyle(section!, '::after').content).toBe('none');- }-- // The lines touching the open card are faded: its own, and the one under- // it (owned by the next row); the closed|closed boundary stays visible.- expect(getComputedStyle(open!, '::before').opacity).toBe('0');- expect(getComputedStyle(afterOpen!, '::before').opacity).toBe('0');- expect(getComputedStyle(afterClosed!, '::before').opacity).toBe('1');- // Closed rows never carry the card treatment.- expect(getComputedStyle(afterOpen!).backgroundColor).toBe('rgba(0, 0, 0, 0)');- });-- it('shows separators only between sections — none above the first row, even after a non-section', async () => {- await render(- <Stack gap={1}>- <div>model card stand-in</div>- <GenerateCollapsibleSection label="A" sectionId="shut-section">- <div>a</div>- </GenerateCollapsibleSection>- <GenerateCollapsibleSection label="B" sectionId="shut-section">- <div>b</div>- </GenerateCollapsibleSection>- <GenerateCollapsibleSection label="C" sectionId="open-section">- <div>c</div>- </GenerateCollapsibleSection>- </Stack>- );-- const [first, second, open] = getSections();-- // A closed first row draws nothing above itself: the element before it is- // not a section, so that boundary is not section|section.- expect(getComputedStyle(first!, '::before').opacity).toBe('0');- expect(getComputedStyle(second!, '::before').opacity).toBe('1');- // The boundary above the open card is the card's own ::before — faded.- expect(getComputedStyle(open!, '::before').opacity).toBe('0');});});