From 4f82c9acdf4e354984c6f1f2d3f9e4703a3e44b2 Mon Sep 17 00:00:00 2001 From: Mohamed Shams El-Deen Date: Tue, 4 Aug 2026 15:47:19 +0300 Subject: [PATCH] test(theme): add test fixtures for custom theme helpers --- tests/theme/fixtures/input.js | 70 ++++++++++++++++++++++++++++- tests/theme/theme.test.mjs.snapshot | 2 +- 2 files changed, 69 insertions(+), 3 deletions(-) diff --git a/tests/theme/fixtures/input.js b/tests/theme/fixtures/input.js index 4eb241a0..1594e188 100644 --- a/tests/theme/fixtures/input.js +++ b/tests/theme/fixtures/input.js @@ -1,6 +1,14 @@ /* eslint-disable */ -export class OverloadedTest { +/** + * Class demonstrating Webpack as a parent class. + */ +export class WebpackTest {} + +/** + * Class demonstrating overload signatures. + */ +export class OverloadTest { /** * First overload signature. * @overload @@ -21,5 +29,63 @@ export class OverloadedTest { * @param {boolean} isEnabled A simple boolean parameter * @returns {void} */ - overloadedMethod(id, isEnabled) {} + overloadMethod(id, isEnabled) {} +} + +/** + * Class demonstrating stability for deprecated, experimental, and legacy APIs. + */ +export class StabilityTest { + /** + * @deprecated Use the new API instead. + */ + deprecatedMethod() {} + + /** + * @experimental + */ + experimentalMethod() {} + + /** + * @legacy This is a legacy Webpack v4 API. + */ + legacyMethod() {} +} + +/** + * Class demonstrating the formatting of JSDoc example blocks. + */ +export class ExamplesTest { + /** + * A sample method for the ExamplesTest class. + * @param {string} name A simple string parameter + * @returns {void} + * @example + * exampleMethod('example-1'); + * + * @example + * ```ts + * exampleMethod('example-2'); + * ``` + */ + exampleMethod(name) {} +} + +/** + * Class demonstrating properties and typed lists. + */ +export class TypedListTest extends WebpackTest { + /** + * A sample property for the TypedListTest class. + * @type {string} + */ + typedListProperty; + + /** + * A sample method for the TypedListTest class. + * @param {string} name The name of the instance + * @param {number} count The count of items + * @returns {boolean} A boolean indicating success + */ + typedListMethod(name, count) {} } diff --git a/tests/theme/theme.test.mjs.snapshot b/tests/theme/theme.test.mjs.snapshot index 06ca5ffd..df06a1ee 100644 --- a/tests/theme/theme.test.mjs.snapshot +++ b/tests/theme/theme.test.mjs.snapshot @@ -1,3 +1,3 @@ exports[`TypeDoc Theme - Edge Cases Fixture 1`] = ` -"# Class: \`webpack.js.org.OverloadedTest\`\\n\\n## Constructors\\n\\n### \`new OverloadedTest()\`\\n\\n* Returns: {OverloadedTest}\\n\\n## Methods\\n\\n### \`overloadedMethod(name, count)\`\\n\\n#### Call Signature\\n\\n* \`name\` {string} A simple string parameter\\n* \`count\` {number} A simple number parameter\\n* Returns: {void} \\n\\nFirst overload signature.\\n\\n#### Call Signature\\n\\n* \`isEnabled\` {boolean} A simple boolean parameter\\n* Returns: {string} \\n\\nSecond overload signature.\\n\\n#### Call Signature\\n\\n* \`id\` {number} A simple string parameter\\n* \`isEnabled\` {boolean} A simple boolean parameter\\n* Returns: {void} \\n\\nThird overload signature.\\n" +"# Class: \`webpack.js.org.ExamplesTest\`\\n\\nClass demonstrating the formatting of JSDoc example blocks.\\n\\n## Constructors\\n\\n### \`new ExamplesTest()\`\\n\\n* Returns: {ExamplesTest}\\n\\n## Methods\\n\\n### \`exampleMethod(name)\`\\n\\n* \`name\` {string} A simple string parameter\\n* Returns: {void} \\n\\nA sample method for the ExamplesTest class.\\n\`\`\`ts\\nexampleMethod('example-1');\\n\`\`\`\\n\\n\`\`\`ts\\nexampleMethod('example-2');\\n\`\`\`\\n\\n\\n---\\n\\n# Class: \`webpack.js.org.OverloadTest\`\\n\\nClass demonstrating overload signatures.\\n\\n## Constructors\\n\\n### \`new OverloadTest()\`\\n\\n* Returns: {OverloadTest}\\n\\n## Methods\\n\\n### \`overloadMethod(name, count)\`\\n\\n#### Call Signature\\n\\n* \`name\` {string} A simple string parameter\\n* \`count\` {number} A simple number parameter\\n* Returns: {void} \\n\\nFirst overload signature.\\n\\n#### Call Signature\\n\\n* \`isEnabled\` {boolean} A simple boolean parameter\\n* Returns: {string} \\n\\nSecond overload signature.\\n\\n#### Call Signature\\n\\n* \`id\` {number} A simple string parameter\\n* \`isEnabled\` {boolean} A simple boolean parameter\\n* Returns: {void} \\n\\nThird overload signature.\\n\\n\\n---\\n\\n# Class: \`webpack.js.org.StabilityTest\`\\n\\nClass demonstrating stability for deprecated, experimental, and legacy APIs.\\n\\n## Constructors\\n\\n### \`new StabilityTest()\`\\n\\n* Returns: {StabilityTest}\\n\\n## Methods\\n\\n### \`deprecatedMethod()\`\\n\\n> Stability: 0 - Deprecated: Use the new API instead.\\n\\n* Returns: {void}\\n\\n***\\n\\n### \`experimentalMethod()\`\\n\\n> Stability: 1 - Experimental\\n\\n* Returns: {void}\\n\\n**\`Experimental\`**\\n\\n***\\n\\n### \`legacyMethod()\`\\n\\n> Stability: 3 - Legacy: This is a legacy Webpack v4 API.\\n\\n* Returns: {void}\\n\\n\\n---\\n\\n# Class: \`webpack.js.org.TypedListTest\`\\n\\nClass demonstrating properties and typed lists.\\n\\n* Extends: {WebpackTest}\\n\\n## Constructors\\n\\n### \`new TypedListTest()\`\\n\\n* Returns: {TypedListTest}\\n\\n## Properties\\n\\n* \`typedListProperty\` {string} A sample property for the TypedListTest class.\\n\\n## Methods\\n\\n### \`typedListMethod(name, count)\`\\n\\n* \`name\` {string} The name of the instance\\n* \`count\` {number} The count of items\\n* Returns: {boolean} A boolean indicating success\\n\\nA sample method for the TypedListTest class.\\n\\n\\n---\\n\\n# Class: \`webpack.js.org.WebpackTest\`\\n\\nClass demonstrating Webpack as a parent class.\\n\\n## Constructors\\n\\n### \`new WebpackTest()\`\\n\\n* Returns: {WebpackTest}\\n" `;