mirror of
https://github.com/konvajs/konva.git
synced 2026-03-03 16:58:33 +08:00
checking in jsdoc dir so people can generate docs themselves
This commit is contained in:
50
jsdoc-master/plugins/test/fixtures/overloadHelper.js
vendored
Normal file
50
jsdoc-master/plugins/test/fixtures/overloadHelper.js
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* A bowl of non-spicy soup.
|
||||
* @class
|
||||
*//**
|
||||
* A bowl of spicy soup.
|
||||
* @class
|
||||
* @param {number} spiciness - The spiciness of the soup, in Scoville heat units (SHU).
|
||||
*/
|
||||
function Soup(spiciness) {}
|
||||
|
||||
/**
|
||||
* Slurp the soup.
|
||||
*//**
|
||||
* Slurp the soup loudly.
|
||||
* @param {number} dBA - The slurping volume, in A-weighted decibels.
|
||||
*/
|
||||
Soup.prototype.slurp = function(dBA) {};
|
||||
|
||||
/**
|
||||
* Salt the soup as needed, using a highly optimized soup-salting heuristic.
|
||||
*//**
|
||||
* Salt the soup, specifying the amount of salt to add.
|
||||
* @variation mg
|
||||
* @param {number} amount - The amount of salt to add, in milligrams.
|
||||
*/
|
||||
Soup.prototype.salt = function(amount) {};
|
||||
|
||||
/**
|
||||
* Heat the soup by the specified number of degrees.
|
||||
* @param {number} degrees - The number of degrees, in Fahrenheit, by which to heat the soup.
|
||||
*//**
|
||||
* Heat the soup by the specified number of degrees.
|
||||
* @variation 1
|
||||
* @param {string} degrees - The number of degrees, in Fahrenheit, by which to heat the soup, but
|
||||
* as a string for some reason.
|
||||
*//**
|
||||
* Heat the soup by the specified number of degrees.
|
||||
* @param {boolean} degrees - The number of degrees, as a boolean. Wait, what?
|
||||
*/
|
||||
Soup.prototype.heat = function(degrees) {};
|
||||
|
||||
/**
|
||||
* Discard the soup.
|
||||
* @variation discardSoup
|
||||
*//**
|
||||
* Discard the soup by pouring it into the specified container.
|
||||
* @variation discardSoup
|
||||
* @param {Object} container - The container in which to discard the soup.
|
||||
*/
|
||||
Soup.prototype.discard = function(container) {};
|
||||
20
jsdoc-master/plugins/test/fixtures/railsTemplate.js.erb
vendored
Normal file
20
jsdoc-master/plugins/test/fixtures/railsTemplate.js.erb
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
@overview Strips the rails template tags from a js.erb file
|
||||
@module plugins/railsTemplate
|
||||
@author Jannon Frank <jannon@jannon.net>
|
||||
*/
|
||||
|
||||
|
||||
exports.handlers = {
|
||||
/**
|
||||
* Remove rails tags from the source input (e.g. <% foo bar %>)
|
||||
* @param e
|
||||
* @param e.filename
|
||||
* @param e.source
|
||||
*/
|
||||
beforeParse: function(e) {
|
||||
if (e.filename.match(/\.erb$/)) {
|
||||
e.source = e.source.replace(/<%.*%> /g, "");
|
||||
}
|
||||
}
|
||||
};
|
||||
12
jsdoc-master/plugins/test/fixtures/seetag-markdown.js
vendored
Normal file
12
jsdoc-master/plugins/test/fixtures/seetag-markdown.js
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* @see [Nowhere](http://nowhere.com)
|
||||
*/
|
||||
function foo() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see AnObject#myProperty
|
||||
*/
|
||||
function bar() {
|
||||
}
|
||||
|
||||
14
jsdoc-master/plugins/test/specs/commentConvert.js
Normal file
14
jsdoc-master/plugins/test/specs/commentConvert.js
Normal file
@@ -0,0 +1,14 @@
|
||||
/*global describe: true, expect: true, it: true, jasmine: true */
|
||||
describe("commentConvert plugin", function() {
|
||||
var parser = new (require("jsdoc/src/parser")).Parser(),
|
||||
plugin = require('plugins/commentConvert'),
|
||||
docSet;
|
||||
|
||||
require('jsdoc/plugins').installPlugins(['plugins/commentConvert'], parser);
|
||||
docSet = jasmine.getDocSetFromFile("plugins/commentConvert.js", parser);
|
||||
|
||||
it("should convert '///-style comments into jsdoc comments", function() {
|
||||
var doclet = docSet.getByLongname("module:plugins/commentConvert.handlers.beforeParse");
|
||||
expect(doclet.length).toEqual(1);
|
||||
});
|
||||
});
|
||||
14
jsdoc-master/plugins/test/specs/escapeHtml.js
Normal file
14
jsdoc-master/plugins/test/specs/escapeHtml.js
Normal file
@@ -0,0 +1,14 @@
|
||||
/*global describe: true, expect: true, it: true, jasmine: true */
|
||||
describe("escapeHtml plugin", function() {
|
||||
var parser = new (require("jsdoc/src/parser")).Parser(),
|
||||
plugin = require('plugins/escapeHtml'),
|
||||
docSet;
|
||||
|
||||
require('jsdoc/plugins').installPlugins(['plugins/escapeHtml'], parser);
|
||||
docSet = jasmine.getDocSetFromFile("plugins/escapeHtml.js", parser);
|
||||
|
||||
it("should escape '&', '<' and newlines in doclet descriptions", function() {
|
||||
var doclet = docSet.getByLongname("module:plugins/escapeHtml.handlers.newDoclet");
|
||||
expect(doclet[0].description).toEqual("Translate HTML tags in descriptions into safe entities.<br> Replaces <, & and newlines");
|
||||
});
|
||||
});
|
||||
22
jsdoc-master/plugins/test/specs/markdown.js
Normal file
22
jsdoc-master/plugins/test/specs/markdown.js
Normal file
@@ -0,0 +1,22 @@
|
||||
describe("markdown plugin", function() {
|
||||
//TODO
|
||||
});
|
||||
|
||||
describe("markdown see tag support", function() {
|
||||
var plugin = require('plugins/markdown'),
|
||||
docSet = jasmine.getDocSetFromFile('plugins/test/fixtures/seetag-markdown.js'),
|
||||
foo = docSet.getByLongname('foo')[0],
|
||||
bar = docSet.getByLongname('bar')[0];
|
||||
|
||||
it ('should parse @see tags containing links', function() {
|
||||
plugin.handlers.newDoclet({doclet:foo});
|
||||
expect(typeof foo).toEqual('object');
|
||||
expect(foo.see[0]).toEqual('<p><a href="http://nowhere.com">Nowhere</a></p>');
|
||||
})
|
||||
|
||||
it ('should not parse @see tags that do not contain links', function() {
|
||||
plugin.handlers.newDoclet({doclet:bar});
|
||||
expect(typeof bar).toEqual('object');
|
||||
expect(bar.see[0]).toEqual('AnObject#myProperty');
|
||||
})
|
||||
});
|
||||
96
jsdoc-master/plugins/test/specs/overloadHelper.js
Normal file
96
jsdoc-master/plugins/test/specs/overloadHelper.js
Normal file
@@ -0,0 +1,96 @@
|
||||
/*global describe: true, expect: true, it: true, jasmine: true, xit: true */
|
||||
describe('plugins/overloadHelper', function() {
|
||||
var parser = new (require('jsdoc/src/parser')).Parser();
|
||||
var plugin = require('plugins/overloadHelper');
|
||||
var docSet;
|
||||
|
||||
require('jsdoc/plugins').installPlugins(['plugins/overloadHelper'], parser);
|
||||
docSet = jasmine.getDocSetFromFile('plugins/test/fixtures/overloadHelper.js', parser);
|
||||
|
||||
it('should exist', function() {
|
||||
expect(plugin).toBeDefined();
|
||||
expect(typeof plugin).toBe('object');
|
||||
});
|
||||
|
||||
it('should export handlers', function() {
|
||||
expect(plugin.handlers).toBeDefined();
|
||||
expect(typeof plugin.handlers).toBe('object');
|
||||
});
|
||||
|
||||
it('should export a "newDoclet" handler', function() {
|
||||
expect(plugin.handlers.newDoclet).toBeDefined();
|
||||
expect(typeof plugin.handlers.newDoclet).toBe('function');
|
||||
});
|
||||
|
||||
it('should export a "parseComplete" handler', function() {
|
||||
expect(plugin.handlers.parseComplete).toBeDefined();
|
||||
expect(typeof plugin.handlers.parseComplete).toBe('function');
|
||||
});
|
||||
|
||||
describe('newDoclet handler', function() {
|
||||
it('should not add unique longnames to constructors', function() {
|
||||
var soup = docSet.getByLongname('Soup');
|
||||
var soup1 = docSet.getByLongname('Soup()');
|
||||
var soup2 = docSet.getByLongname('Soup(spiciness)');
|
||||
|
||||
expect(soup.length).toBe(2);
|
||||
expect(soup1.length).toBe(0);
|
||||
expect(soup2.length).toBe(0);
|
||||
});
|
||||
|
||||
it('should add unique longnames to methods', function() {
|
||||
var slurp = docSet.getByLongname('Soup#slurp');
|
||||
var slurp1 = docSet.getByLongname('Soup#slurp()');
|
||||
var slurp2 = docSet.getByLongname('Soup#slurp(dBA)');
|
||||
|
||||
expect(slurp.length).toBe(0);
|
||||
expect(slurp1.length).toBe(1);
|
||||
expect(slurp2.length).toBe(1);
|
||||
});
|
||||
|
||||
it('should update the "variation" property of the method', function() {
|
||||
var slurp1 = docSet.getByLongname('Soup#slurp()')[0];
|
||||
var slurp2 = docSet.getByLongname('Soup#slurp(dBA)')[0];
|
||||
|
||||
expect(slurp1.variation).toBe('');
|
||||
expect(slurp2.variation).toBe('dBA');
|
||||
});
|
||||
|
||||
it('should not add to or change existing variations that are unique', function() {
|
||||
var salt1 = docSet.getByLongname('Soup#salt');
|
||||
var salt2 = docSet.getByLongname('Soup#salt(mg)');
|
||||
|
||||
expect(salt1.length).toBe(1);
|
||||
expect(salt2.length).toBe(1);
|
||||
});
|
||||
|
||||
it('should not duplicate the names of existing numeric variations', function() {
|
||||
var heat1 = docSet.getByLongname('Soup#heat(1)');
|
||||
var heat2 = docSet.getByLongname('Soup#heat(2)');
|
||||
var heat3 = docSet.getByLongname('Soup#heat(3)');
|
||||
|
||||
expect(heat1.length).toBe(1);
|
||||
expect(heat2.length).toBe(1);
|
||||
expect(heat3.length).toBe(1);
|
||||
});
|
||||
|
||||
it('should replace identical variations with new, unique variations', function() {
|
||||
var discard1 = docSet.getByLongname('Soup#discard()');
|
||||
var discard2 = docSet.getByLongname('Soup#discard(container)');
|
||||
|
||||
expect(discard1.length).toBe(1);
|
||||
expect(discard2.length).toBe(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe('parseComplete handler', function() {
|
||||
// disabled because on the second run, each comment is being parsed twice; who knows why...
|
||||
xit('should not retain parse results between parser runs', function() {
|
||||
parser.clear();
|
||||
docSet = jasmine.getDocSetFromFile('plugins/test/fixtures/overloadHelper.js', parser);
|
||||
var heat = docSet.getByLongname('Soup#heat(4)');
|
||||
|
||||
expect(heat.length).toBe(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
16
jsdoc-master/plugins/test/specs/railsTemplate.js
Normal file
16
jsdoc-master/plugins/test/specs/railsTemplate.js
Normal file
@@ -0,0 +1,16 @@
|
||||
/*global describe: true, expect: true, it: true */
|
||||
describe("railsTemplate plugin", function() {
|
||||
var parser = new (require("jsdoc/src/parser")).Parser(),
|
||||
plugin = require('plugins/railsTemplate');
|
||||
|
||||
|
||||
require('jsdoc/plugins').installPlugins(['plugins/railsTemplate'], parser);
|
||||
require('jsdoc/src/handlers').attachTo(parser);
|
||||
|
||||
it("should remove <% %> rails template tags from the source of *.erb files", function() {
|
||||
var path = require("path"),
|
||||
docSet = parser.parse([path.join(__dirname, "plugins/test/fixtures/railsTemplate.js.erb")]);
|
||||
|
||||
expect(docSet[2].description).toEqual("Remove rails tags from the source input (e.g. )");
|
||||
});
|
||||
});
|
||||
14
jsdoc-master/plugins/test/specs/shout.js
Normal file
14
jsdoc-master/plugins/test/specs/shout.js
Normal file
@@ -0,0 +1,14 @@
|
||||
/*global describe: true, expect: true, it: true, jasmine: true */
|
||||
describe("shout plugin", function() {
|
||||
var parser = new (require("jsdoc/src/parser")).Parser(),
|
||||
plugin = require('plugins/shout'),
|
||||
docSet;
|
||||
|
||||
require('jsdoc/plugins').installPlugins(['plugins/shout'], parser);
|
||||
docSet = jasmine.getDocSetFromFile("plugins/shout.js", parser);
|
||||
|
||||
it("should make the description uppercase", function() {
|
||||
var doclet = docSet.getByLongname("module:plugins/shout.handlers.newDoclet");
|
||||
expect(doclet[0].description).toEqual("MAKE YOUR DESCRIPTIONS MORE SHOUTIER.");
|
||||
});
|
||||
});
|
||||
16
jsdoc-master/plugins/test/specs/sourcetag.js
Normal file
16
jsdoc-master/plugins/test/specs/sourcetag.js
Normal file
@@ -0,0 +1,16 @@
|
||||
/*global describe: true, expect: true, it: true, jasmine: true */
|
||||
describe("sourcetag plugin", function() {
|
||||
var parser = new (require("jsdoc/src/parser")).Parser(),
|
||||
plugin = require('plugins/sourcetag'),
|
||||
docSet;
|
||||
|
||||
require('jsdoc/plugins').installPlugins(['plugins/sourcetag'], parser);
|
||||
docSet = jasmine.getDocSetFromFile("plugins/sourcetag.js", parser);
|
||||
|
||||
it("should set the lineno and filename of the doclet's meta property", function() {
|
||||
var doclet = docSet.getByLongname("module:plugins/sourcetag.handlers.newDoclet");
|
||||
expect(doclet[0].meta).toBeDefined();
|
||||
expect(doclet[0].meta.filename).toEqual("sourcetag.js");
|
||||
expect(doclet[0].meta.lineno).toEqual(13);
|
||||
});
|
||||
});
|
||||
19
jsdoc-master/plugins/test/specs/verboseOutput.js
Normal file
19
jsdoc-master/plugins/test/specs/verboseOutput.js
Normal file
@@ -0,0 +1,19 @@
|
||||
/*global describe: true, expect: true, it: true, jasmine: true, xit: true */
|
||||
/**
|
||||
* @author Rob Taylor [manix84@gmail.com]
|
||||
*/
|
||||
|
||||
describe("verbose output plugin", function () {
|
||||
var parser = new (require("jsdoc/src/parser")).Parser(),
|
||||
plugin = require('plugins/verboseOutput'),
|
||||
docSet;
|
||||
|
||||
//require('jsdoc/plugins').installPlugins(['plugins/verboseOutput'], parser);
|
||||
docSet = jasmine.getDocSetFromFile("plugins/verboseOutput.js", parser);
|
||||
|
||||
xit("should log file names to console", function() {
|
||||
// TODO: this doesn't actually test the plugin...
|
||||
var fileBegin = docSet.getByLongname("module:plugins/verboseOutput.handlers.fileBegin");
|
||||
expect(fileBegin[0].description).toEqual("Logging the file name to the console.");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user