@@ -374,6 +374,78 @@ describe('Inline Markdown', () => {
374374} ) ;
375375} ) ;
376376
377+ describe ( 'spoiler text' , ( ) => {
378+ test ( 'works when spoiler text is the only token' , ( ) => {
379+ const parser = create ( ) ;
380+ const ast = parser . tokenizeInline ( '~~~foobar~~~' ) ;
381+ expect ( ast ) . toMatchObject ( [
382+ {
383+ type :'spoiler' ,
384+ children :[
385+ {
386+ type :'text' ,
387+ value :'foobar' ,
388+ } ,
389+ ] ,
390+ } ,
391+ ] ) ;
392+ } ) ;
393+
394+ test ( 'works when inside other inline text' , ( ) => {
395+ const parser = create ( ) ;
396+ const ast = parser . tokenizeInline ( 'hello ~~~ foobar ~~~ world' ) ;
397+ expect ( ast ) . toMatchObject ( [
398+ { type :'text' , value :'hello ' } ,
399+ {
400+ type :'spoiler' ,
401+ children :[
402+ {
403+ type :'text' ,
404+ value :' foobar ' ,
405+ } ,
406+ ] ,
407+ } ,
408+ { type :'text' , value :' world' } ,
409+ ] ) ;
410+ } ) ;
411+
412+ test ( 'works when surrounded by deleted text' , ( ) => {
413+ const parser = create ( ) ;
414+ const ast = parser . tokenizeInline ( '~~hello~~ ~~~ foobar ~~~ ~~world~~' ) ;
415+ expect ( ast ) . toMatchObject ( [
416+ {
417+ type :'delete' ,
418+ children :[
419+ {
420+ type :'text' ,
421+ value :'hello' ,
422+ } ,
423+ ] ,
424+ } ,
425+ { type :'text' , value :' ' } ,
426+ {
427+ type :'spoiler' ,
428+ children :[
429+ {
430+ type :'text' ,
431+ value :' foobar ' ,
432+ } ,
433+ ] ,
434+ } ,
435+ { type :'text' , value :' ' } ,
436+ {
437+ type :'delete' ,
438+ children :[
439+ {
440+ type :'text' ,
441+ value :'world' ,
442+ } ,
443+ ] ,
444+ } ,
445+ ] ) ;
446+ } ) ;
447+ } ) ;
448+
377449describe ( 'math' , ( ) => {
378450test ( 'works' , ( ) => {
379451const parser = create ( ) ;