Closed aforcier closed 8 years ago
Nice:
HTML to Visual formatter should correctly convert
✓ single-line HTML
✓ multi-paragraph HTML
image wrapped in link
✓ alone in post
✓ with paragraphs above and below
✓ with line breaks above and below
✓ start of post, with paragraph underneath
✓ start of post, with line break underneath
✓ end of post, with paragraph above
✓ end of post, with line break above
image not wrapped in link
✓ alone in post
✓ with paragraphs above and below
✓ with line breaks above and below
✓ start of post, with paragraph underneath
✓ start of post, with line break underneath
✓ end of post, with paragraph above
✓ end of post, with line break above
non-VideoPress video
✓ alone in post
✓ with paragraphs above and below
✓ with line breaks above and below
✓ start of post, with paragraph underneath
✓ start of post, with line break underneath
✓ end of post, with paragraph above
✓ end of post, with line break above
VideoPress video
✓ alone in post
✓ with paragraphs above and below
✓ with line breaks above and below
✓ start of post, with paragraph underneath
✓ start of post, with line break underneath
✓ end of post, with paragraph above
✓ end of post, with line break above
30 passing (16ms)
:shipit:
Adds JS unit tests using Mocha. For now, the tests check paragraph formatting when loading HTML into the visual editor.
To build tests without relying on the full
ZSSEditor
or the DOM, I refactored some of the HTML-to-visual conversion code to make it functional, and extracted as many methods as possible to a new helper file,editor-utils-formatter.js
, against which the tests are run.To run the tests,
npm
must be installed, as well asMocha
(see the updated README for full instructions).Hat-tip to @v18 for guidance with setting up Mocha tests 😀.
cc @maxme