File tree 1 file changed +19
-1
lines changed
packages/editor/__tests__
1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change 5
5
6
6
import { createEditor , createToolbar } from '../../../packages/editor/src/index'
7
7
import { ICreateEditorOption , ICreateToolbarOption } from '../../../packages/editor/src/create'
8
+ import { DOMElement } from '../../../packages/editor/src/utils/dom'
9
+ import Boot from '../../../packages/editor/src/Boot'
8
10
9
11
function customCreateEditor ( config : Partial < ICreateEditorOption > = { } ) {
10
12
const editorContainer = document . createElement ( 'div' )
@@ -29,14 +31,30 @@ function customCreateToolbar(config: Partial<ICreateToolbarOption> = {}) {
29
31
// create toolbar
30
32
const toolbar = createToolbar ( {
31
33
editor,
32
- selector : toolbarContainer ,
34
+ selector : toolbarContainer as DOMElement ,
33
35
...config ,
34
36
} )
35
37
36
38
return toolbar
37
39
}
38
40
39
41
describe ( 'create editor and toolbar' , ( ) => {
42
+ test ( 'create editor selector undefind' , ( ) => {
43
+ const editor = customCreateEditor ( )
44
+ expect ( ( ) => {
45
+ createToolbar ( {
46
+ editor,
47
+ selector : undefined as any ,
48
+ } )
49
+ } ) . toThrow ( `Cannot find 'selector' when create toolbar` )
50
+ } )
51
+
52
+ test ( 'test new Boot and registerModule' , ( ) => {
53
+ expect ( ( ) => {
54
+ new Boot ( )
55
+ } ) . toThrow ( '不能例化\nCan not construct a instance' )
56
+ } )
57
+
40
58
test ( 'create editor with default mode' , ( ) => {
41
59
const editor = customCreateEditor ( )
42
60
You can’t perform that action at this time.
0 commit comments