Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 86655ee

Browse files
committed
fix(app): typealiases coverage
closes #1517
1 parent 4ba7d66 commit 86655ee

File tree

5 files changed

+23
-2
lines changed

5 files changed

+23
-2
lines changed

src/app/application.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -2038,7 +2038,7 @@ at least one config for the 'info' or 'source' tab in --navTabConfig.`);
20382038
linksubtype: el.subtype,
20392039
name: el.name
20402040
};
2041-
if (type === 'variable' || type === 'function') {
2041+
if (type === 'variable' || type === 'function' || type === 'type alias') {
20422042
cl.linktype = 'miscellaneous';
20432043
}
20442044
let totalStatementDocumented = 0;
@@ -2185,6 +2185,10 @@ at least one config for the 'info' or 'source' tab in --navTabConfig.`);
21852185
Configuration.mainData.miscellaneous.variables,
21862186
'variable'
21872187
);
2188+
processFunctionsAndVariables(
2189+
Configuration.mainData.miscellaneous.typealiases,
2190+
'type alias'
2191+
);
21882192

21892193
files = _.sortBy(files, ['filePath']);
21902194

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { IHtmlEngineHelper, IHandlebarsOptions } from './html-engine-helper.interface';
2+
3+
export class IfEqualStringHelper implements IHtmlEngineHelper {
4+
public helperFunc(context: any, a: any, b: any, options: IHandlebarsOptions): string {
5+
if (a == b) {
6+
return options.fn(context);
7+
}
8+
return options.inverse(context);
9+
}
10+
}

src/app/engines/html.engine.helpers.ts

+2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import { ParsePropertyHelper } from './html-engine-helpers/parse-property.helper
3939
import { RelativeURLHelper } from './html-engine-helpers/relative-url.helper';
4040
import { ShortURLHelper } from './html-engine-helpers/short-url.helper';
4141
import { StripURLHelper } from './html-engine-helpers/strip-url.helper';
42+
import { IfEqualStringHelper } from './html-engine-helpers/if-equal-string.helper';
4243

4344
export class HtmlEngineHelpers {
4445
public registerHelpers(bars): void {
@@ -49,6 +50,7 @@ export class HtmlEngineHelpers {
4950
this.registerHelper(bars, 'isInitialTab', new IsInitialTabHelper());
5051
this.registerHelper(bars, 'isTabEnabled', new IsTabEnabledHelper());
5152
this.registerHelper(bars, 'ifString', new IfStringHelper());
53+
this.registerHelper(bars, 'ifEqualString', new IfEqualStringHelper());
5254
this.registerHelper(bars, 'orLength', new OrLengthHelper());
5355
this.registerHelper(bars, 'filterAngular2Modules', new FilterAngular2ModulesHelper());
5456
this.registerHelper(bars, 'debug', new DebugHelper());

src/templates/partials/coverage-report.hbs

+5-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@
2121
<td>
2222
<!-- miscellaneous -->
2323
{{#if linksubtype}}
24-
<a href="./{{linktype}}/{{linksubtype}}s.html#{{name}}">{{filePath}}</a>
24+
{{#ifEqualString type 'type alias'}}
25+
<a href="./{{linktype}}/{{linksubtype}}es.html#{{name}}">{{filePath}}</a>
26+
{{else}}
27+
<a href="./{{linktype}}/{{linksubtype}}s.html#{{name}}">{{filePath}}</a>
28+
{{/ifEqualString}}
2529
{{else}}
2630
<a href="./{{linktype}}s/{{name}}.html">{{filePath}}</a>
2731
{{/if}}

test/src/cli/cli-coverage.spec.ts

+1
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,7 @@ describe('CLI coverage report', () => {
413413
expect(coverageFile).to.contain('components/CompodocComponent.html');
414414
expect(coverageFile).to.contain('interfaces/ClockInterface.html');
415415
expect(coverageFile).to.contain('miscellaneous/functions.html#foo');
416+
expect(coverageFile).to.contain('miscellaneous/typealiases.html#ChartChange');
416417
expect(coverageFile).to.contain('variables.html#PI');
417418
expect(coverageFile).to.contain('pipes/FirstUpperPipe.html');
418419
expect(coverageFile).to.contain('directives/DoNothingDirective2.html');

0 commit comments

Comments
 (0)