All files / collaborative-slate/src/sync/__tests__/fixtures documents.ts

100% Statements 14/14
100% Branches 0/0
100% Functions 0/0
100% Lines 14/14

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143  3x   3x   3x           3x         3x                 3x   3x                     3x                 3x                                                                   3x                         3x                       3x                       3x                       3x                        
import type {SlateDocument} from '../../../types';
import {a, blockquote, em, h1, h2, h3, li, ol, p, strong, txt, ul} from '../tools/builder';
 
export const paragraph: SlateDocument = [p({}, txt('This is a paragraph.'))];
 
export const paragraphs: SlateDocument = [
  p({}, txt('This is a paragraph.')),
  p({}, txt('This is another paragraph.')),
  p({}, txt('This is yet another paragraph.')),
];
 
export const twoBlockquotes: SlateDocument = [
  blockquote({}, p({}, txt('This is a blockquote.'))),
  blockquote({}, p({}, txt('This is another blockquote. Without a paragraph.'))),
];
 
export const blockquotes: SlateDocument = [
  blockquote({}, p({}, txt('This is a blockquote.'))),
  blockquote({}, p({}, txt('This is another blockquote. Without a paragraph.'))),
  blockquote(
    p({}, txt('Blockquote with two paragraphs.')),
    p({}, txt('This is the second paragraph of the blockquote.')),
  ),
];
 
export const list: SlateDocument = [ul(li(p({}, txt('Item 1'))), li(p({}, txt('Item 2'))), li(p({}, txt('Item 3'))))];
 
export const nestedList: SlateDocument = [
  ul(
    li(p({}, txt('Item 1'))),
    li(
      p({}, txt('Item 2')),
      ul(li(p({}, txt('Subitem 2.1'))), li(p({}, txt('Subitem 2.2'))), li(p({}, txt('Subitem 2.3')))),
    ),
    li(p({}, txt('Item 3'))),
  ),
];
 
export const headings: SlateDocument = [
  h1(txt('Heading 1')),
  p({}, txt('This is a paragraph under heading 1.')),
  h2(txt('Heading 2')),
  p({}, txt('This is a paragraph under heading 2.')),
  h3(txt('Heading 3')),
  p({}, txt('This is a paragraph under heading 3.')),
];
 
export const realisticDoc: SlateDocument = [
  h1(txt('Main Title')),
  p(
    {},
    txt('This is the '),
    em('introduction'),
    txt(' paragraph. It introduces the document and provides some context.'),
  ),
  blockquote({}, p({}, txt('This is a quote from someone.'))),
  h2(txt('Section 1')),
  p({}, txt('This is the first section.')),
  ul(
    li(p({}, txt('First item in section 1. It has some details.'))),
    li(p({}, txt('Second item in section 1.'))),
    li(p({}, txt('Third item in section 1.'))),
  ),
  h2(txt('Section 2')),
  p({}, txt('This is the second section.')),
  blockquote({}, p({}, txt('This is another quote.'))),
  h3(txt('Subsection 2.1')),
  p({}, txt('This is a subsection under section 2.')),
  ol(
    1,
    li(p({}, txt('First item in subsection 2.1.'))),
    li(p({}, txt('Second item in subsection 2.1.'))),
    li(p({}, txt('Third item in subsection 2.1.'))),
  ),
  h3(txt('Subsection 2.2')),
  p({}, txt('This is another subsection under section 2.')),
  blockquote({}, p({}, txt('This is a quote in subsection 2.2.'))),
  h1(txt('Conclusion')),
  p({}, txt('This is the conclusion paragraph.')),
];
 
export const inlineStyles: SlateDocument = [
  p(
    {},
    txt('This is a paragraph with '),
    em('emphasized text'),
    txt(', '),
    strong('strong text'),
    txt(', and a link to '),
    a('https://example.com', 'example.com'),
    txt('.'),
  ),
];
 
export const nestedInlines: SlateDocument = [
  p(
    {},
    txt('This is a paragraph with '),
    {text: 'nested ', em: true},
    {text: 'inline styles', em: true, strong: true},
    txt(' and a link to '),
    {text: 'example.com', a: {href: 'https://example.com'}, strong: true},
    txt('.'),
  ),
];
 
export const nestedInlinesWithAttributes: SlateDocument = [
  p(
    {},
    txt('This is a paragraph with '),
    {text: 'nested ', em: true},
    {text: 'inline styles', em: true, strong: true},
    txt(' and a link to '),
    {text: 'example.com', a: {href: 'https://example.com'}, strong: true},
    txt('.'),
  ),
];
 
export const nestedInlinesWithAttributes2: SlateDocument = [
  p(
    {},
    txt('This is a paragraph with '),
    {text: 'nested ', em: true},
    {text: 'inline styles', em: true, strong: true},
    txt(' and a link to '),
    {text: 'example.com', a: {href: 'https://example.com'}, strong: true},
    txt('.'),
  ),
];
 
export const documents = {
  paragraph,
  twoBlockquotes,
  inlineStyles,
  nestedInlines,
  nestedInlinesWithAttributes,
  nestedInlinesWithAttributes2,
  blockquotes,
  headings,
  realisticDoc,
  paragraphs,
};