@@ -14,29 +14,29 @@ struct GutenbergPostExcerptGeneratorTests {
1414 let content = " <!-- wp:gallery { \" ids \" :[2315,2309,2308]} --><figure class= \" wp-block-gallery columns-3 is-cropped \" ><ul class= \" blocks-gallery-grid \" ><li class= \" blocks-gallery-item \" ><figure><img src= \" https://diegotest4.files.wordpress.com/2020/01/img_0005-1-1.jpg \" data-id= \" 2315 \" class= \" wp-image-2315 \" /><figcaption class= \" blocks-gallery-item__caption \" >Asdasdasd</figcaption></figure></li><li class= \" blocks-gallery-item \" ><figure><img src= \" https://diegotest4.files.wordpress.com/2020/01/img_0111-1-1.jpg \" data-id= \" 2309 \" class= \" wp-image-2309 \" /><figcaption class= \" blocks-gallery-item__caption \" >Asdasdasd</figcaption></figure></li><li class= \" blocks-gallery-item \" ><figure><img src= \" https://diegotest4.files.wordpress.com/2020/01/img_0004-1.jpg \" data-id= \" 2308 \" class= \" wp-image-2308 \" /><figcaption class= \" blocks-gallery-item__caption \" >Adsasdasdasd</figcaption></figure></li></ul></figure><!-- /wp:gallery --><p>Some Content</p> "
1515
1616 let summary = GutenbergExcerptGenerator . firstParagraph ( from: content, maxLength: 150 )
17- #expect( summary == " Some Content " )
17+ #expect( summary == " Some Content… " )
1818 }
1919
2020 @Test func summaryForContentWithGallery2( ) {
2121 let content = " <p>Before</p> \n <!-- wp:gallery { \" ids \" :[2315,2309,2308]} --><figure class= \" wp-block-gallery columns-3 is-cropped \" ><ul class= \" blocks-gallery-grid \" ><li class= \" blocks-gallery-item \" ><figure><img src= \" https://diegotest4.files.wordpress.com/2020/01/img_0005-1-1.jpg \" data-id= \" 2315 \" class= \" wp-image-2315 \" /><figcaption class= \" blocks-gallery-item__caption \" >Asdasdasd</figcaption></figure></li><li class= \" blocks-gallery-item \" ><figure><img src= \" https://diegotest4.files.wordpress.com/2020/01/img_0111-1-1.jpg \" data-id= \" 2309 \" class= \" wp-image-2309 \" /><figcaption class= \" blocks-gallery-item__caption \" >Asdasdasd</figcaption></figure></li><li class= \" blocks-gallery-item \" ><figure><img src= \" https://diegotest4.files.wordpress.com/2020/01/img_0004-1.jpg \" data-id= \" 2308 \" class= \" wp-image-2308 \" /><figcaption class= \" blocks-gallery-item__caption \" >Adsasdasdasd</figcaption></figure></li></ul></figure><!-- /wp:gallery --><p>After</p> "
2222
2323 let summary = GutenbergExcerptGenerator . firstParagraph ( from: content, maxLength: 150 )
24- #expect( summary == " Before " )
24+ #expect( summary == " Before… " )
2525 }
2626
2727 @Test
2828 func testVideoPressBlock( ) {
2929 let content = " <p>Before</p> \n <!-- wp:videopress/video { \" title \" : \" demo \" , \" description \" : \" \" , \" id \" :5297, \" guid \" : \" AbCDe \" , \" videoRatio \" :56.333333333333336, \" privacySetting \" :2, \" allowDownload \" :false, \" rating \" : \" G \" , \" isPrivate \" :true, \" duration \" :1673} --> \n <figure class= \" wp-block-videopress-video wp-block-jetpack-videopress jetpack-videopress-player \" ><div class= \" jetpack-videopress-player__wrapper \" > \n https://videopress.com/v/AbCDe?resizeToParent=true&cover=true&preloadContent=metadata&useAverageColor=true \n </div></figure> \n <!-- /wp:videopress/video --> \n <p>After</p> "
3030
3131 let summary = GutenbergExcerptGenerator . firstParagraph ( from: content, maxLength: 150 )
32- #expect( summary == " Before " )
32+ #expect( summary == " Before… " )
3333 }
3434
3535 @Test func testPostWithBRTags( ) {
3636 let content = #"<p class="wp-block-paragraph">Yes,<br>look behind<br>in remembrance and with gratitude.</p><p class="wp-block-paragraph">Then,<br>stay present,<br>or miss memories in the making.</p>"#
3737
3838 let summary = GutenbergExcerptGenerator . firstParagraph ( from: content, maxLength: 150 )
3939 print ( summary)
40- #expect( summary == " Yes, look behind in remembrance and with gratitude. " )
40+ #expect( summary == " Yes, look behind in remembrance and with gratitude… " )
4141 }
4242}
0 commit comments