@@ -27,7 +27,22 @@ function textOfTestDocument(node: JSONContent): string {
2727}
2828
2929describe ( "exportDocumentToDcHtml" , ( ) => {
30- it ( "appends a subtle linked attribution footer to copied DC HTML" , async ( ) => {
30+ it ( "returns empty HTML for an empty editor document" , async ( ) => {
31+ const document : JSONContent = {
32+ type : "doc" ,
33+ content : [ { type : "paragraph" } ] ,
34+ } ;
35+
36+ await expect ( exportDocumentToDcHtml ( document , exportOptions ) ) . resolves . toBe ( "" ) ;
37+ await expect (
38+ exportDocumentToDcHtml ( document , {
39+ ...exportOptions ,
40+ includeAttribution : true ,
41+ } ) ,
42+ ) . resolves . toBe ( "" ) ;
43+ } ) ;
44+
45+ it ( "omits the attribution footer by default for preview HTML" , async ( ) => {
3146 const document : JSONContent = {
3247 type : "doc" ,
3348 content : [
@@ -39,6 +54,27 @@ describe("exportDocumentToDcHtml", () => {
3954 } ;
4055
4156 const html = await exportDocumentToDcHtml ( document , exportOptions ) ;
57+
58+ expect ( html ) . toContain ( "본문 내용" ) ;
59+ expect ( html ) . not . toContain ( "Created with dc-code-paste" ) ;
60+ expect ( html ) . not . toContain ( 'href="https://0disoft.github.io/dc-code-paste/"' ) ;
61+ } ) ;
62+
63+ it ( "appends a subtle linked attribution footer to copied DC HTML" , async ( ) => {
64+ const document : JSONContent = {
65+ type : "doc" ,
66+ content : [
67+ {
68+ type : "paragraph" ,
69+ content : [ { type : "text" , text : "본문 내용" } ] ,
70+ } ,
71+ ] ,
72+ } ;
73+
74+ const html = await exportDocumentToDcHtml ( document , {
75+ ...exportOptions ,
76+ includeAttribution : true ,
77+ } ) ;
4278 const footerStart = html . indexOf ( "Created with dc-code-paste" ) ;
4379
4480 expect ( footerStart ) . toBeGreaterThan ( html . indexOf ( "본문 내용" ) ) ;
@@ -66,6 +102,7 @@ describe("exportDocumentToDcHtml", () => {
66102 const html = await exportDocumentToDcHtml ( document , {
67103 ...exportOptions ,
68104 documentTheme : "darkEditorial" ,
105+ includeAttribution : true ,
69106 } ) ;
70107
71108 expect ( html ) . toContain ( "Created with dc-code-paste" ) ;
@@ -637,6 +674,7 @@ describe("exportDocumentToDcHtml", () => {
637674 bodyFontSize : "17px" ,
638675 codeFontSize : "15px" ,
639676 theme : "catppuccin-mocha" ,
677+ includeAttribution : true ,
640678 } ) ;
641679
642680 expect ( markdown . length ) . toBeGreaterThan ( 3_000 ) ;
0 commit comments