Skip to content

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.

1.0 KB
Raw Blame
import { describe, expect, it } from 'vitest';

import { GALLERY_WIDE_MIN_WIDTH_PX, getGalleryLayout } from './galleryDensity';

describe('getGalleryLayout', () => {
  it('keeps side panels stacked however wide they are measured', () => {
    expect(getGalleryLayout({ region: 'left', widthPx: 2000 })).toBe('stacked');
    expect(getGalleryLayout({ region: 'right', widthPx: 2000 })).toBe('stacked');
  });

  it('switches to wide at the threshold and back below it', () => {
    expect(getGalleryLayout({ region: 'center', widthPx: GALLERY_WIDE_MIN_WIDTH_PX })).toBe('wide');
    expect(getGalleryLayout({ region: 'center', widthPx: GALLERY_WIDE_MIN_WIDTH_PX - 1 })).toBe('stacked');
    expect(getGalleryLayout({ region: 'bottom', widthPx: GALLERY_WIDE_MIN_WIDTH_PX })).toBe('wide');
    expect(getGalleryLayout({ region: 'bottom', widthPx: 320 })).toBe('stacked');
  });

  it('stays stacked before the first measurement reports a width', () => {
    expect(getGalleryLayout({ region: 'center', widthPx: 0 })).toBe('stacked');
  });
});