@@ -196,95 +196,6 @@ describe('useMarkdown', () => {
196196 } )
197197 } )
198198
199- describe ( 'packageName prop' , ( ) => {
200- it ( 'strips package name from the beginning of plain text' , ( ) => {
201- const processed = useMarkdown ( {
202- text : 'my-package - A great library' ,
203- packageName : 'my-package' ,
204- } )
205- expect ( processed . value ) . toBe ( 'A great library' )
206- } )
207-
208- it ( 'strips package name with colon separator' , ( ) => {
209- const processed = useMarkdown ( {
210- text : 'my-package: A great library' ,
211- packageName : 'my-package' ,
212- } )
213- expect ( processed . value ) . toBe ( 'A great library' )
214- } )
215-
216- it ( 'strips package name with em dash separator' , ( ) => {
217- const processed = useMarkdown ( {
218- text : 'my-package — A great library' ,
219- packageName : 'my-package' ,
220- } )
221- expect ( processed . value ) . toBe ( 'A great library' )
222- } )
223-
224- it ( 'strips package name without separator' , ( ) => {
225- const processed = useMarkdown ( {
226- text : 'my-package A great library' ,
227- packageName : 'my-package' ,
228- } )
229- expect ( processed . value ) . toBe ( 'A great library' )
230- } )
231-
232- it ( 'is case-insensitive' , ( ) => {
233- const processed = useMarkdown ( {
234- text : 'MY-PACKAGE - A great library' ,
235- packageName : 'my-package' ,
236- } )
237- expect ( processed . value ) . toBe ( 'A great library' )
238- } )
239-
240- it ( 'does not strip package name from middle of text' , ( ) => {
241- const processed = useMarkdown ( {
242- text : 'A great my-package library' ,
243- packageName : 'my-package' ,
244- } )
245- expect ( processed . value ) . toBe ( 'A great my-package library' )
246- } )
247-
248- it ( 'handles scoped package names' , ( ) => {
249- const processed = useMarkdown ( {
250- text : '@org/my-package - A great library' ,
251- packageName : '@org/my-package' ,
252- } )
253- expect ( processed . value ) . toBe ( 'A great library' )
254- } )
255-
256- it ( 'handles package names with special regex characters' , ( ) => {
257- const processed = useMarkdown ( {
258- text : 'pkg.name+test - A great library' ,
259- packageName : 'pkg.name+test' ,
260- } )
261- expect ( processed . value ) . toBe ( 'A great library' )
262- } )
263-
264- it ( 'strips package name from HTML-containing descriptions' , ( ) => {
265- const processed = useMarkdown ( {
266- text : '<b>my-package</b> - A great library' ,
267- packageName : 'my-package' ,
268- } )
269- expect ( processed . value ) . toBe ( 'A great library' )
270- } )
271-
272- it ( 'strips package name from descriptions with markdown images' , ( ) => {
273- const processed = useMarkdown ( {
274- text : ' my-package - A great library' ,
275- packageName : 'my-package' ,
276- } )
277- expect ( processed . value ) . toBe ( 'A great library' )
278- } )
279-
280- it ( 'does nothing when packageName is not provided' , ( ) => {
281- const processed = useMarkdown ( {
282- text : 'my-package - A great library' ,
283- } )
284- expect ( processed . value ) . toBe ( 'my-package - A great library' )
285- } )
286- } )
287-
288199 describe ( 'HTML tag stripping' , ( ) => {
289200 it ( 'strips simple HTML tags but keeps content' , ( ) => {
290201 const processed = useMarkdown ( { text : '<b>bold text</b> here' } )
0 commit comments