mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
@mixes and @mixin tests added
This commit is contained in:
parent
896f1bd909
commit
0e8e1664f7
27
test/fixtures/mixintag.js
vendored
Normal file
27
test/fixtures/mixintag.js
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
/**
|
||||
* This provides methods used for event handling. It's not meant to
|
||||
* be used directly, except as a provider of related methods.
|
||||
*
|
||||
* @mixin
|
||||
*/
|
||||
var Eventful = {
|
||||
/** fires something. */
|
||||
fires: function () {},
|
||||
/** handles a signal. */
|
||||
on: function () {}
|
||||
};
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @mixes Eventful
|
||||
*/
|
||||
var FormButton = function() {
|
||||
};
|
||||
|
||||
/** @mixin AnotherMixin*/
|
||||
|
||||
/** I mix in multiple things
|
||||
* @constructor MyClass
|
||||
* @mixes Eventful
|
||||
* @mixes AnotherMixin */
|
||||
|
||||
19
test/specs/tags/mixestag.js
Normal file
19
test/specs/tags/mixestag.js
Normal file
@ -0,0 +1,19 @@
|
||||
describe("@mixes tag", function() {
|
||||
var docSet = jasmine.getDocSetFromFile('test/fixtures/mixintag.js'),
|
||||
FormButton = docSet.getByLongname('FormButton')[0],
|
||||
MyClass = docSet.getByLongname('MyClass')[0];
|
||||
|
||||
it("When a symbol has a @mixes tag, it gets an array property 'mixes' with the name of the mixin", function() {
|
||||
expect(FormButton.mixes).toBeDefined();
|
||||
expect(Array.isArray(FormButton.mixes)).toBe(true);
|
||||
expect(FormButton.mixes.length).toBe(1);
|
||||
expect(FormButton.mixes[0]).toBe('Eventful');
|
||||
});
|
||||
|
||||
it("A symbol can @mixes multiple mixins and they are all added.", function() {
|
||||
expect(MyClass.mixes).toBeDefined();
|
||||
expect(MyClass.mixes.length).toBe(2);
|
||||
expect(MyClass.mixes).toContain('Eventful');
|
||||
expect(MyClass.mixes).toContain('AnotherMixin');
|
||||
});
|
||||
});
|
||||
13
test/specs/tags/mixintag.js
Normal file
13
test/specs/tags/mixintag.js
Normal file
@ -0,0 +1,13 @@
|
||||
describe("@mixin tag", function() {
|
||||
var docSet = jasmine.getDocSetFromFile('test/fixtures/mixintag.js'),
|
||||
Eventful = docSet.getByLongname('Eventful')[0],
|
||||
Mixin = docSet.getByLongname('AnotherMixin')[0];
|
||||
|
||||
it("When a symbol has a @mixin tag, the doclet's 'kind' property is set to 'mixin'", function() {
|
||||
expect(Eventful.kind).toBe('mixin');
|
||||
});
|
||||
|
||||
it("When a symbol has a @mixin tag, its name is set to the tag's value (if present)", function() {
|
||||
expect(Mixin).toBeDefined();
|
||||
});
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user