Skip to content

Commit cad339f

Browse files
authored
More recent versions of TypeScript do spacing slightly different for some parsed jsdoc. (#242)
* More recent versions of TypeScript do spacing slightly different for some parsed jsdoc. * Use t.true for more idiomatic assertion
1 parent 21bd3e7 commit cad339f

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

test/flavors/jsdoc/description-test.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { analyzeTextWithCurrentTsModule } from "../../helpers/analyze-text-with-current-ts-module";
22
import { tsTest } from "../../helpers/ts-test";
3+
import { inspect } from "util";
34

45
tsTest("jsdoc: Correctly discovers the description in the jsdoc", t => {
56
const {
@@ -17,14 +18,23 @@ tsTest("jsdoc: Correctly discovers the description in the jsdoc", t => {
1718
* This is an example
1819
* @element
1920
*/
20-
class MyElement extends HTMLElement {
21+
class MyElement extends HTMLElement {
2122
}
2223
`);
2324

2425
const declaration = result.componentDefinitions[0].declaration!;
2526

26-
t.is(
27-
declaration.jsDoc?.description,
27+
const description = declaration.jsDoc?.description ?? "";
28+
const allowed = new Set<string>([
29+
`layout to full document height as follows:
30+
\`\`\`
31+
@media screen {
32+
html, body {
33+
height: 100%;
34+
}
35+
}
36+
\`\`\`
37+
This is an example`,
2838
`layout to full document height as follows:
2939
\`\`\`
3040
@media screen {
@@ -34,5 +44,6 @@ tsTest("jsdoc: Correctly discovers the description in the jsdoc", t => {
3444
}
3545
\`\`\`
3646
This is an example`
37-
);
47+
]);
48+
t.true(allowed.has(description), `Expected ${inspect(description)} to be one of ${inspect(allowed)}`);
3849
});

0 commit comments

Comments
 (0)