@@ -302,6 +302,42 @@ describe('Clipboard', function () {
302302 expect ( block ) . toEqual ( `It’s a cat’s world.` )
303303 } )
304304
305+ it ( 'does not replace two apostrophe with quotes inside quotes' , function ( ) {
306+ const updatedConfig = cloneDeep ( config )
307+ updatedConfig . pastedHtmlRules . replaceQuotes = {
308+ quotes : [ '«' , '»' ] ,
309+ singleQuotes : [ '‹' , '›' ] ,
310+ apostrophe : '’'
311+ }
312+
313+ updateConfig ( updatedConfig )
314+ const block = extractSingleBlock ( `'It's a cat's world.'` )
315+ expect ( block ) . toEqual ( `‹It’s a cat’s world.›` )
316+ } )
317+
318+ it ( 'does not replace apostrophe at the beginning or end with quotes' , function ( ) {
319+ const updatedConfig = cloneDeep ( config )
320+ updatedConfig . pastedHtmlRules . replaceQuotes = {
321+ quotes : [ '«' , '»' ] ,
322+ singleQuotes : [ '‹' , '›' ] ,
323+ apostrophe : '’'
324+ }
325+
326+ updateConfig ( updatedConfig )
327+ const block = extractSingleBlock ( `Can I ask you somethin'? “'Twas the night before Christmas,” he said.` )
328+ expect ( block ) . toEqual ( `Can I ask you somethin’? «’Twas the night before Christmas,» he said.` )
329+ } )
330+
331+ it ( 'does not replace apostrophe at the beginning or end with quotes' , function ( ) {
332+ const block = extractSingleBlock ( `Gehen S' 'nauf!` )
333+ expect ( block ) . toEqual ( `Gehen S’ ’nauf!` )
334+ } )
335+
336+ it ( 'replaces quotes with punctuation after the closing quote' , function ( ) {
337+ const block = extractSingleBlock ( `Beginning of the sentence "inside quote".` )
338+ expect ( block ) . toEqual ( `Beginning of the sentence “inside quote”.` )
339+ } )
340+
305341 it ( 'replaces nested quotes with single quotes inside nested' , function ( ) {
306342 const block = extractSingleBlock ( `text outside "text 'inside „second inside text“'"` )
307343 expect ( block ) . toEqual ( 'text outside “text ‘inside “second inside text”’”' )
0 commit comments