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.

856 B
Raw Blame
import { describe, expect, it } from 'vitest';

import { selectionOpFor } from './selectionOpMode';

const none = { alt: false, ctrl: false, meta: false, shift: false };

describe('selectionOpFor', () => {
  it('falls back to the persistent mode when no modifier is held', () => {
    expect(selectionOpFor(none, 'replace')).toBe('replace');
    expect(selectionOpFor(none, 'add')).toBe('add');
    expect(selectionOpFor(none, 'subtract')).toBe('subtract');
    expect(selectionOpFor(none, 'intersect')).toBe('intersect');
  });

  it('lets held modifiers override the persistent mode', () => {
    expect(selectionOpFor({ ...none, shift: true }, 'replace')).toBe('add');
    expect(selectionOpFor({ ...none, alt: true }, 'replace')).toBe('subtract');
    expect(selectionOpFor({ ...none, alt: true, shift: true }, 'replace')).toBe('intersect');
  });
});