all tests pass but only if md-delim display: inline
This commit is contained in:
+16
-31
@@ -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*');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user