FIX: dictionary.defineTag should store tags under the normalised name.

This commit is contained in:
mathematicalcoffee 2013-02-08 10:02:58 +10:00
parent f0b9776f43
commit 5fadd37fb5
2 changed files with 8 additions and 11 deletions

View File

@ -33,13 +33,15 @@ TagDefinition.prototype.synonym = function(synonymName) {
dictionary = {
/** @function */
defineTag: function(title, opts) {
_definitions[title] = new TagDefinition(title, opts);
var def = new TagDefinition(title, opts);
// all the other dictionary functions use normalised names; we should too.
_definitions[def.title] = def;
if (opts.isNamespace) {
_namespaces.push(title);
_namespaces.push(def.title);
}
return _definitions[title];
return _definitions[def.title];
},
/** @function */

View File

@ -56,12 +56,7 @@ describe('jsdoc/tag/dictionary', function() {
});
});
xdescribe("lookUp", function() {
// TODO: BUG: tags are stored in the dictionary with their un-normalised name,
// so if your tag had capital letters then it would be stored as
// _definitions[with capital letters]. However, we *look tags up*
// under their *normalised* names, i.e. will be lower case.
// We should store in the _definitions table under the normalised name.
describe("lookUp", function() {
it("retrieves definition when using the tag's canonical name", function() {
expect(dictionary.lookUp(tagTitle)).toEqual(def);
});
@ -76,11 +71,11 @@ describe('jsdoc/tag/dictionary', function() {
});
describe("isNamespace", function() {
it("returns whether a tag is a namespace when using its canonical name", function() {
// TODO: BUG: isNamespace should use a normalised title.
xit("returns whether a tag is a namespace when using its canonical name", function() {
expect(dictionary.isNamespace(tagTitle)).toEqual(true);
});
// TODO: BUG: isNamespace should use a normalised title.
xit("returns whether a tag is a namespace when using its synonym", function() {
expect(dictionary.isNamespace(tagSynonym)).toEqual(true);
});