mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
43 lines
1.8 KiB
JavaScript
43 lines
1.8 KiB
JavaScript
/*global app: true, describe: true, expect: true, it: true, jasmine: true */
|
|
|
|
describe("plugins", function() {
|
|
require('jsdoc/plugins').installPlugins(['test/fixtures/testPlugin1',
|
|
'test/fixtures/testPlugin2'], app.jsdoc.parser);
|
|
|
|
var plugin1 = require('test/fixtures/testPlugin1'),
|
|
plugin2 = require('test/fixtures/testPlugin2'),
|
|
docSet;
|
|
|
|
docSet = jasmine.getDocSetFromFile("test/fixtures/plugins.js", app.jsdoc.parser);
|
|
|
|
it("should fire the plugin's event handlers", function() {
|
|
expect(plugin1.handlers.fileBegin).toHaveBeenCalled();
|
|
expect(plugin1.handlers.beforeParse).toHaveBeenCalled();
|
|
expect(plugin1.handlers.jsdocCommentFound).toHaveBeenCalled();
|
|
expect(plugin1.handlers.symbolFound).toHaveBeenCalled();
|
|
expect(plugin1.handlers.newDoclet).toHaveBeenCalled();
|
|
expect(plugin1.handlers.fileComplete).toHaveBeenCalled();
|
|
|
|
expect(plugin2.handlers.fileBegin).toHaveBeenCalled();
|
|
expect(plugin2.handlers.beforeParse).toHaveBeenCalled();
|
|
expect(plugin2.handlers.jsdocCommentFound).toHaveBeenCalled();
|
|
expect(plugin2.handlers.symbolFound).toHaveBeenCalled();
|
|
expect(plugin2.handlers.newDoclet).toHaveBeenCalled();
|
|
expect(plugin2.handlers.fileComplete).toHaveBeenCalled();
|
|
});
|
|
|
|
it("should add the plugin's tag definitions to the dictionary", function() {
|
|
var test = docSet.getByLongname("test");
|
|
|
|
expect(test[0].longname).toEqual("test");
|
|
expect(test[0].foo).toEqual(true);
|
|
});
|
|
|
|
it("should call the plugin's visitNode function", function() {
|
|
expect(plugin1.nodeVisitor.visitNode).toHaveBeenCalled();
|
|
});
|
|
|
|
it("should not call a second plugin's visitNode function if the first stopped propagation", function() {
|
|
expect(plugin2.nodeVisitor.visitNode).not.toHaveBeenCalled();
|
|
});
|
|
}); |