all tests pass but only if md-delim display: inline

This commit is contained in:
evilchili
2026-07-10 12:39:35 -07:00
parent 818ee418d5
commit c1dc49f0b3
23 changed files with 5109 additions and 6197 deletions
+16 -31
View File
@@ -107,14 +107,6 @@ describe('RibbitEditor modes', () => {
expect(editor.element.contentEditable).toBe('true');
});
it('switches to edit', () => {
const editor = new lib.Editor({});
editor.run();
editor.wysiwyg();
editor.edit();
expect(editor.getState()).toBe('edit');
});
it('switches back to view', () => {
const editor = new lib.Editor({});
editor.run();
@@ -135,25 +127,10 @@ describe('RibbitEditor modes', () => {
});
editor.run();
editor.wysiwyg();
editor.edit();
editor.view();
expect(modes).toEqual(['view', 'wysiwyg', 'edit', 'view']);
expect(modes).toEqual(['view', 'wysiwyg', 'view']);
});
it('sourceMode disabled blocks edit', () => {
resetDOM();
const editor = new lib.Editor({
currentTheme: 'no-source',
themes: [{
name: 'no-source',
features: { sourceMode: false },
}],
});
editor.run();
editor.wysiwyg();
editor.edit();
expect(editor.getState()).toBe('wysiwyg');
});
});
describe('ThemeManager', () => {
@@ -229,7 +206,6 @@ describe('defaultTheme', () => {
it('has correct shape', () => {
expect(lib.defaultTheme.name).toBe('ribbit-default');
expect(lib.defaultTheme.tags).toBeDefined();
expect(lib.defaultTheme.features.sourceMode).toBe(true);
});
});
@@ -252,17 +228,26 @@ describe('Utility functions', () => {
});
describe('Editor htmlToMarkdown', () => {
beforeEach(() => resetDOM());
it('converts strong', () => {
it('returns markdown in view state', () => {
resetDOM('**bold**');
const editor = new lib.Editor({});
editor.run();
expect(editor.htmlToMarkdown('<strong>bold</strong>')).toBe('**bold**');
expect(editor.getMarkdown()).toBe('**bold**');
});
it('converts em', () => {
it('returns markdown in wysiwyg state', () => {
resetDOM('**bold**');
const editor = new lib.Editor({});
editor.run();
expect(editor.htmlToMarkdown('<em>italic</em>')).toBe('*italic*');
editor.wysiwyg();
expect(editor.getMarkdown()).toBe('**bold**');
});
it('round-trips inline formatting', () => {
resetDOM('hello **world** and *italic*');
const editor = new lib.Editor({});
editor.run();
editor.wysiwyg();
expect(editor.getMarkdown()).toBe('hello **world** and *italic*');
});
});