@@ -50,9 +50,16 @@ describe("USJ Marker Action Utils", () => {
5050
5151 it ( "should insert a chapter" , ( ) => {
5252 const { editor } = createBasicTestEnvironment ( nodes , $defaultInitialEditorState ) ;
53- const markerAction = getUsjMarkerAction ( "c" , expandedNoteKeyRef , undefined , undefined , {
54- discrete : true ,
55- } ) ;
53+ const markerAction = getUsjMarkerAction (
54+ "c" ,
55+ expandedNoteKeyRef ,
56+ undefined ,
57+ undefined ,
58+ undefined ,
59+ {
60+ discrete : true ,
61+ } ,
62+ ) ;
5663 updateSelection ( editor , secondVerseTextNode ) ;
5764
5865 markerAction . action ( { editor, reference } ) ;
@@ -70,9 +77,16 @@ describe("USJ Marker Action Utils", () => {
7077 describe ( "should insert a verse" , ( ) => {
7178 it ( "with no leading space" , ( ) => {
7279 const { editor } = createBasicTestEnvironment ( nodes , $defaultInitialEditorState ) ;
73- const markerAction = getUsjMarkerAction ( "v" , expandedNoteKeyRef , undefined , undefined , {
74- discrete : true ,
75- } ) ;
80+ const markerAction = getUsjMarkerAction (
81+ "v" ,
82+ expandedNoteKeyRef ,
83+ undefined ,
84+ undefined ,
85+ undefined ,
86+ {
87+ discrete : true ,
88+ } ,
89+ ) ;
7690 updateSelection ( editor , secondVerseTextNode , 7 ) ;
7791
7892 markerAction . action ( { editor, reference } ) ;
@@ -93,9 +107,16 @@ describe("USJ Marker Action Utils", () => {
93107
94108 it ( "but move leading space to previous node" , ( ) => {
95109 const { editor } = createBasicTestEnvironment ( nodes , $defaultInitialEditorState ) ;
96- const markerAction = getUsjMarkerAction ( "v" , expandedNoteKeyRef , undefined , undefined , {
97- discrete : true ,
98- } ) ;
110+ const markerAction = getUsjMarkerAction (
111+ "v" ,
112+ expandedNoteKeyRef ,
113+ undefined ,
114+ undefined ,
115+ undefined ,
116+ {
117+ discrete : true ,
118+ } ,
119+ ) ;
99120 updateSelection ( editor , secondVerseTextNode , 6 ) ;
100121
101122 markerAction . action ( { editor, reference } ) ;
@@ -118,9 +139,16 @@ describe("USJ Marker Action Utils", () => {
118139 describe ( "should insert a char" , ( ) => {
119140 it ( "with no leading space" , ( ) => {
120141 const { editor } = createBasicTestEnvironment ( nodes , $defaultInitialEditorState ) ;
121- const markerAction = getUsjMarkerAction ( "wj" , expandedNoteKeyRef , undefined , undefined , {
122- discrete : true ,
123- } ) ;
142+ const markerAction = getUsjMarkerAction (
143+ "wj" ,
144+ expandedNoteKeyRef ,
145+ undefined ,
146+ undefined ,
147+ undefined ,
148+ {
149+ discrete : true ,
150+ } ,
151+ ) ;
124152 updateSelection ( editor , secondVerseTextNode , 7 ) ;
125153
126154 markerAction . action ( { editor, reference } ) ;
@@ -140,9 +168,16 @@ describe("USJ Marker Action Utils", () => {
140168
141169 it ( "with leading space" , ( ) => {
142170 const { editor } = createBasicTestEnvironment ( nodes , $defaultInitialEditorState ) ;
143- const markerAction = getUsjMarkerAction ( "wj" , expandedNoteKeyRef , undefined , undefined , {
144- discrete : true ,
145- } ) ;
171+ const markerAction = getUsjMarkerAction (
172+ "wj" ,
173+ expandedNoteKeyRef ,
174+ undefined ,
175+ undefined ,
176+ undefined ,
177+ {
178+ discrete : true ,
179+ } ,
180+ ) ;
146181 updateSelection ( editor , secondVerseTextNode , 6 ) ;
147182
148183 markerAction . action ( { editor, reference } ) ;
@@ -162,9 +197,16 @@ describe("USJ Marker Action Utils", () => {
162197
163198 it ( "at end of para" , ( ) => {
164199 const { editor } = createBasicTestEnvironment ( nodes , $defaultInitialEditorState ) ;
165- const markerAction = getUsjMarkerAction ( "wj" , expandedNoteKeyRef , undefined , undefined , {
166- discrete : true ,
167- } ) ;
200+ const markerAction = getUsjMarkerAction (
201+ "wj" ,
202+ expandedNoteKeyRef ,
203+ undefined ,
204+ undefined ,
205+ undefined ,
206+ {
207+ discrete : true ,
208+ } ,
209+ ) ;
168210 updateSelection ( editor , secondVerseTextNode ) ;
169211
170212 markerAction . action ( { editor, reference } ) ;
@@ -186,9 +228,16 @@ describe("USJ Marker Action Utils", () => {
186228 describe ( "should wrap selection in char" , ( ) => {
187229 it ( "with no leading space" , ( ) => {
188230 const { editor } = createBasicTestEnvironment ( nodes , $defaultInitialEditorState ) ;
189- const markerAction = getUsjMarkerAction ( "wj" , expandedNoteKeyRef , undefined , undefined , {
190- discrete : true ,
191- } ) ;
231+ const markerAction = getUsjMarkerAction (
232+ "wj" ,
233+ expandedNoteKeyRef ,
234+ undefined ,
235+ undefined ,
236+ undefined ,
237+ {
238+ discrete : true ,
239+ } ,
240+ ) ;
192241 updateSelection ( editor , secondVerseTextNode , 7 , secondVerseTextNode , 12 ) ;
193242
194243 markerAction . action ( { editor, reference } ) ;
@@ -211,9 +260,16 @@ describe("USJ Marker Action Utils", () => {
211260
212261 it ( "but move leading space to previous node" , ( ) => {
213262 const { editor } = createBasicTestEnvironment ( nodes , $defaultInitialEditorState ) ;
214- const markerAction = getUsjMarkerAction ( "wj" , expandedNoteKeyRef , undefined , undefined , {
215- discrete : true ,
216- } ) ;
263+ const markerAction = getUsjMarkerAction (
264+ "wj" ,
265+ expandedNoteKeyRef ,
266+ undefined ,
267+ undefined ,
268+ undefined ,
269+ {
270+ discrete : true ,
271+ } ,
272+ ) ;
217273 updateSelection ( editor , secondVerseTextNode , 6 , secondVerseTextNode , 12 ) ;
218274
219275 markerAction . action ( { editor, reference } ) ;
@@ -240,9 +296,16 @@ describe("USJ Marker Action Utils", () => {
240296
241297 it ( "of type footnote" , ( ) => {
242298 const { editor } = createBasicTestEnvironment ( nodes , $defaultInitialEditorState ) ;
243- const markerAction = getUsjMarkerAction ( "f" , expandedNoteKeyRef , undefined , undefined , {
244- discrete : true ,
245- } ) ;
299+ const markerAction = getUsjMarkerAction (
300+ "f" ,
301+ expandedNoteKeyRef ,
302+ undefined ,
303+ undefined ,
304+ undefined ,
305+ {
306+ discrete : true ,
307+ } ,
308+ ) ;
246309 // caret after the word "second"
247310 updateSelection ( editor , secondVerseTextNode , 6 ) ;
248311
@@ -266,9 +329,16 @@ describe("USJ Marker Action Utils", () => {
266329
267330 it ( "of type endnote" , ( ) => {
268331 const { editor } = createBasicTestEnvironment ( nodes , $defaultInitialEditorState ) ;
269- const markerAction = getUsjMarkerAction ( "fe" , expandedNoteKeyRef , undefined , undefined , {
270- discrete : true ,
271- } ) ;
332+ const markerAction = getUsjMarkerAction (
333+ "fe" ,
334+ expandedNoteKeyRef ,
335+ undefined ,
336+ undefined ,
337+ undefined ,
338+ {
339+ discrete : true ,
340+ } ,
341+ ) ;
272342 // caret after the word "second"
273343 updateSelection ( editor , secondVerseTextNode , 6 ) ;
274344
@@ -287,9 +357,16 @@ describe("USJ Marker Action Utils", () => {
287357
288358 it ( "of type extended note" , ( ) => {
289359 const { editor } = createBasicTestEnvironment ( nodes , $defaultInitialEditorState ) ;
290- const markerAction = getUsjMarkerAction ( "ef" , expandedNoteKeyRef , undefined , undefined , {
291- discrete : true ,
292- } ) ;
360+ const markerAction = getUsjMarkerAction (
361+ "ef" ,
362+ expandedNoteKeyRef ,
363+ undefined ,
364+ undefined ,
365+ undefined ,
366+ {
367+ discrete : true ,
368+ } ,
369+ ) ;
293370 // caret after the word "second"
294371 updateSelection ( editor , secondVerseTextNode , 6 ) ;
295372
@@ -308,9 +385,16 @@ describe("USJ Marker Action Utils", () => {
308385
309386 it ( "of type cross reference" , ( ) => {
310387 const { editor } = createBasicTestEnvironment ( nodes , $defaultInitialEditorState ) ;
311- const markerAction = getUsjMarkerAction ( "x" , expandedNoteKeyRef , undefined , undefined , {
312- discrete : true ,
313- } ) ;
388+ const markerAction = getUsjMarkerAction (
389+ "x" ,
390+ expandedNoteKeyRef ,
391+ undefined ,
392+ undefined ,
393+ undefined ,
394+ {
395+ discrete : true ,
396+ } ,
397+ ) ;
314398 // caret after the word "second"
315399 updateSelection ( editor , secondVerseTextNode , 6 ) ;
316400
@@ -334,9 +418,16 @@ describe("USJ Marker Action Utils", () => {
334418
335419 it ( "of type extended cross reference" , ( ) => {
336420 const { editor } = createBasicTestEnvironment ( nodes , $defaultInitialEditorState ) ;
337- const markerAction = getUsjMarkerAction ( "ex" , expandedNoteKeyRef , undefined , undefined , {
338- discrete : true ,
339- } ) ;
421+ const markerAction = getUsjMarkerAction (
422+ "ex" ,
423+ expandedNoteKeyRef ,
424+ undefined ,
425+ undefined ,
426+ undefined ,
427+ {
428+ discrete : true ,
429+ } ,
430+ ) ;
340431 // caret after the word "second"
341432 updateSelection ( editor , secondVerseTextNode , 6 ) ;
342433
@@ -353,4 +444,16 @@ describe("USJ Marker Action Utils", () => {
353444 } ) ;
354445 } ) ;
355446 } ) ;
447+
448+ describe ( "unsupported markers" , ( ) => {
449+ it ( "should throw for an unknown marker" , ( ) => {
450+ expect ( ( ) => getUsjMarkerAction ( "zzz" , expandedNoteKeyRef ) ) . toThrow (
451+ "Unsupported marker 'zzz'" ,
452+ ) ;
453+ } ) ;
454+
455+ it . each ( [ "p" , "wj" , "f" , "v" , "c" ] ) ( "should not throw for supported marker '%s'" , ( marker ) => {
456+ expect ( ( ) => getUsjMarkerAction ( marker , expandedNoteKeyRef ) ) . not . toThrow ( ) ;
457+ } ) ;
458+ } ) ;
356459} ) ;
0 commit comments