testHtmlLinesCloseWhatSpansALine

tcmts.share.testHtmlLinesCloseWhatSpansALine · #3xdgja76 · term

Lines of highlighted code each close what they open: a comment over three lines is three spans.

import { htmlLines } from "#codebase/tcmts/share";
import assert from "node:assert/strict";

export const testHtmlLinesCloseWhatSpansALine = () => {
  assert.deepEqual(htmlLines('a <span class="c">/* x\ny */</span> b\n'), [
    'a <span class="c">/* x</span>',
    '<span class="c">y */</span> b',
  ]);
  assert.deepEqual(htmlLines('<a href="#">p<b>q\n\nr</b></a>'), [
    '<a href="#">p<b>q</b></a>',
    '<a href="#"><b></b></a>',
    '<a href="#"><b>r</b></a>',
  ]);
  assert.deepEqual(htmlLines(""), [""]);
  assert.deepEqual(htmlLines("one\n\n"), ["one", ""]);
}

uses