Skip to content

Commit b36ae4c

Browse files
committed
add another test case for reportUnsupportedHtmlElements extension
1 parent 6c792bc commit b36ae4c

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

tsdoc-config/src/TSDocConfigFile.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,9 @@ export class TSDocConfigFile {
774774
}
775775

776776
if (this._reportUnsupportedHtmlElements === false) {
777-
configuration.setReportUnsupportedHtmlElements(false);
777+
configuration.validation.reportUnsupportedHtmlElements = false;
778+
} else if (this._reportUnsupportedHtmlElements === true) {
779+
configuration.validation.reportUnsupportedHtmlElements = true;
778780
}
779781
}
780782

tsdoc-config/src/__tests__/TSDocConfigFile.test.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,7 @@ test('p9 supportedHtmlElements are inherited', () => {
719719
expect(flattened.supportedHtmlElements).toEqual(['span', 'p']);
720720
});
721721

722-
test('p9 reportUnsupportedHtmlElements is overridden', () => {
722+
test('p9 reportUnsupportedHtmlElements is overridden by "true"', () => {
723723
const configFile: TSDocConfigFile = TSDocConfigFile.loadForFolder(path.join(__dirname, 'assets/p9'));
724724
const flattened = new TSDocConfiguration();
725725
configFile.updateParser(flattened);
@@ -736,6 +736,13 @@ test('Test re-serialize p9', () => {
736736
`);
737737
});
738738

739+
test('p10 reportUnsupportedHtmlElements is overridden by "false"', () => {
740+
const configFile: TSDocConfigFile = TSDocConfigFile.loadForFolder(path.join(__dirname, 'assets/p10'));
741+
const flattened = new TSDocConfiguration();
742+
configFile.updateParser(flattened);
743+
expect(flattened.validation.reportUnsupportedHtmlElements).toEqual(true);
744+
});
745+
739746
test('Test loadFromObject()', () => {
740747
const configuration: TSDocConfiguration = new TSDocConfiguration();
741748
configuration.clear(true);

tsdoc/src/configuration/TSDocConfiguration.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -204,13 +204,6 @@ export class TSDocConfiguration {
204204
}
205205
}
206206

207-
/**
208-
* Overwrite the validator's existing value for `reportUnsupportedHtmlElements`.
209-
*/
210-
public setReportUnsupportedHtmlElements(reportUnsupportedHtmlElements: boolean): void {
211-
this.validation.reportUnsupportedHtmlElements = reportUnsupportedHtmlElements;
212-
}
213-
214207
/**
215208
* Returns true if the html element is supported in this configuration.
216209
*/

0 commit comments

Comments
 (0)