-
Notifications
You must be signed in to change notification settings - Fork 710
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
49 changed files
with
113 additions
and
1,564 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,57 @@ | ||
import Assert = require('assert'); | ||
import { deepStrictEqual as equal } from 'assert'; | ||
import { LegendBuilder } from '../lib/output/plugins/LegendPlugin'; | ||
|
||
describe('LegendBuilder', function () { | ||
it('returns empty items when no css classes are registered', function () { | ||
const builder = new LegendBuilder(); | ||
const results = builder.build().map(items => items.map(item => item.name)); | ||
|
||
Assert.deepEqual(results, []); | ||
equal(results, []); | ||
}); | ||
|
||
it('returns single item list when common css classes are registered', function () { | ||
const builder = new LegendBuilder(); | ||
builder.registerCssClasses(['tsd-kind-module']); | ||
builder.registerCssClasses(['tsd-kind-namespace']); | ||
const results = builder.build().map(items => items.map(item => item.name)); | ||
|
||
Assert.deepEqual(results, [['Module']]); | ||
equal(results, [['Namespace']]); | ||
}); | ||
|
||
it('returns single item list with multiple items when common css classes are registered', function () { | ||
const builder = new LegendBuilder(); | ||
builder.registerCssClasses(['tsd-kind-module']); | ||
builder.registerCssClasses(['tsd-kind-namespace']); | ||
builder.registerCssClasses(['tsd-kind-function']); | ||
const results = builder.build().map(items => items.map(item => item.name)); | ||
|
||
Assert.deepEqual(results, [['Module', 'Function']]); | ||
equal(results, [['Namespace', 'Function']]); | ||
}); | ||
|
||
it('returns single item list with multiple items when multiple css classes are registered', function () { | ||
const builder = new LegendBuilder(); | ||
builder.registerCssClasses(['tsd-kind-module']); | ||
builder.registerCssClasses(['tsd-kind-namespace']); | ||
builder.registerCssClasses(['tsd-kind-function']); | ||
builder.registerCssClasses(['tsd-kind-function', 'tsd-has-type-parameter']); | ||
const results = builder.build().map(items => items.map(item => item.name)); | ||
|
||
Assert.deepEqual(results, [['Module', 'Function', 'Function with type parameter']]); | ||
equal(results, [['Namespace', 'Function', 'Function with type parameter']]); | ||
}); | ||
|
||
it('returns multiple item list when common css classes are registered from different groups', function () { | ||
const builder = new LegendBuilder(); | ||
builder.registerCssClasses(['tsd-kind-module']); | ||
builder.registerCssClasses(['tsd-kind-namespace']); | ||
builder.registerCssClasses(['tsd-kind-accessor', 'tsd-parent-kind-class', 'tsd-is-inherited']); | ||
builder.registerCssClasses(['tsd-kind-property', 'tsd-parent-kind-class', 'tsd-is-private']); | ||
builder.registerCssClasses(['tsd-kind-accessor', 'tsd-parent-kind-class', 'tsd-is-private']); | ||
const results = builder.build().map(items => items.map(item => item.name)); | ||
|
||
Assert.deepEqual(results, [['Module'], ['Inherited accessor'], ['Private property', 'Private accessor']]); | ||
equal(results, [['Namespace'], ['Inherited accessor'], ['Private property', 'Private accessor']]); | ||
}); | ||
|
||
it('returns single item when includes ignored classes', function () { | ||
const builder = new LegendBuilder(); | ||
builder.registerCssClasses(['tsd-kind-class', 'tsd-parent-kind-external-module']); | ||
const results = builder.build().map(items => items.map(item => item.name)); | ||
|
||
Assert.deepEqual(results, [['Class']]); | ||
equal(results, [['Class']]); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.