/** @jsx jsx */ import { expectEditorEqualOutput, jsx } from '../../../../__fixtures__/hyperscript'; import { createToggleMarkCreator } from './createToggleMarkCreator'; const createToggleMark = createToggleMarkCreator({ type: 'foo' }); describe('ToggleMark', () => { const ToggleMark = createToggleMark(); it('should has type', () => { expect(ToggleMark.type).toBe('foo'); }); describe('collapsed in mark', () => { const input = ( foo ) as any; it('should be active', () => { expect(ToggleMark.isToggleMarkActive(input)).toBe(true); }); }); describe('collapsed not in mark', () => { const input = ( foo ) as any; it('should be inactive', () => { expect(ToggleMark.isToggleMarkActive(input)).toBe(false); }); }); describe('collapsed not in mark, next to mark', () => { const input = ( foo ) as any; it('should be active', () => { expect(ToggleMark.isToggleMarkActive(input)).toBe(true); }); }); describe('expanded in mark', () => { const input = ( foo ) as any; const output = ( foo ) as any; it('should be active', () => { expect(ToggleMark.isToggleMarkActive(input)).toBe(true); }); it('after toggle', () => { ToggleMark.toggleMark(input); expectEditorEqualOutput(input, output); }); }); describe('expanded in half of mark, before mark', () => { const input = ( foo ) as any; const output = ( foo ) as any; it('should be inactive', () => { expect(ToggleMark.isToggleMarkActive(input)).toBe(false); }); it('after toggle', () => { ToggleMark.toggleMark(input); expectEditorEqualOutput(input, output); }); }); describe('expanded in half of mark, after mark', () => { const input = ( foo ) as any; const output = ( foo ) as any; it('should be active', () => { expect(ToggleMark.isToggleMarkActive(input)).toBe(true); }); it('after toggle', () => { ToggleMark.toggleMark(input); expectEditorEqualOutput(input, output); }); }); describe('expanded not in mark', () => { const input = ( foobar ) as any; const output = ( foobar ) as any; it('should be inactive', () => { expect(ToggleMark.isToggleMarkActive(input)).toBe(false); }); it('after toggle', () => { ToggleMark.toggleMark(input); expectEditorEqualOutput(input, output); }); }); });