fix(58584): formatJSDocLink shouldn't introduce a trailing space when non link text. (#58585)

This commit is contained in:
Matthieu Riegler
2024-05-21 23:53:52 +02:00
committed by GitHub
parent cd40d26f01
commit 75342d8ca8
3 changed files with 20 additions and 2 deletions

View File

@@ -560,4 +560,22 @@ class Foo {};
assert.equal(ts.getTextOfJSDocComment(seeTag.comment), "{@link foo#bar label}");
});
});
describe("getTextOfJSDocComment", () => {
it("should preserve link without introducing space", () => {
const sourceText = `
/**
*
* @see {@link foo}
*/
class Foo {};
`;
const root = ts.createSourceFile("foo.ts", sourceText, ts.ScriptTarget.ES5, /*setParentNodes*/ true);
const [classDecl] = root.statements;
const [seeTag] = ts.getJSDocTags(classDecl);
assert.equal(ts.getTextOfJSDocComment(seeTag.comment), "{@link foo}");
});
});
});