-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
916852f
commit e6f67ca
Showing
2 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/// <reference types="cypress" /> | ||
|
||
import { Editor } from '@tiptap/core' | ||
import Document from '@tiptap/extension-document' | ||
import Paragraph from '@tiptap/extension-paragraph' | ||
import Text from '@tiptap/extension-text' | ||
|
||
describe('editorProps', () => { | ||
it('editorProps can be set while constructing Editor', () => { | ||
function transformPastedHTML(html: string) { | ||
return html | ||
} | ||
|
||
const editor = new Editor({ | ||
extensions: [Document, Paragraph, Text], | ||
editorProps: { transformPastedHTML }, | ||
}) | ||
|
||
expect(transformPastedHTML) | ||
.to.eq(editor.options.editorProps.transformPastedHTML) | ||
.and.to.eq(editor.options.editorProps.transformPastedHTML) | ||
}) | ||
|
||
it('editorProps can be set through setOptions', () => { | ||
function transformPastedHTML(html: string) { | ||
return html | ||
} | ||
|
||
const editor = new Editor({ | ||
extensions: [Document, Paragraph, Text], | ||
}) | ||
|
||
editor.setOptions({ editorProps: { transformPastedHTML } }) | ||
|
||
expect(transformPastedHTML) | ||
.to.eq(editor.options.editorProps.transformPastedHTML) | ||
.and.to.eq(editor.options.editorProps.transformPastedHTML) | ||
}) | ||
|
||
it('editorProps can be set directly through options', () => { | ||
function transformPastedHTML(html: string) { | ||
return html | ||
} | ||
|
||
const editor = new Editor({ | ||
extensions: [Document, Paragraph, Text], | ||
}) | ||
|
||
editor.options.editorProps.transformPastedHTML = transformPastedHTML | ||
|
||
expect(transformPastedHTML) | ||
.to.eq(editor.options.editorProps.transformPastedHTML) | ||
.and.to.eq(editor.options.editorProps.transformPastedHTML) | ||
}) | ||
}) |