Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove JSDocs from everywhere in the Repo - source code, GHPages, etc…

…. We're not using them and the stale docs were confusing. Fixes #338 Fixes #99
  • Loading branch information...
commit 6feb12485310595d106268b4a2fc7af491a104de 1 parent 3be247c
Davis W. Frank authored
View
1  jasmine-core.gemspec
@@ -19,7 +19,6 @@ Gem::Specification.new do |s|
s.add_development_dependency "json_pure", ">= 1.4.3"
s.add_development_dependency "sass"
s.add_development_dependency "compass"
- s.add_development_dependency "ragaskar-jsdoc_helper"
s.add_development_dependency "rspec"
s.add_development_dependency "fuubar"
s.add_development_dependency "awesome_print"
View
17 jsdoc-template/allclasses.tmpl
@@ -1,17 +0,0 @@
-<div align="center">{+new Link().toFile("index.html").withText("Class Index")+}
-| {+new Link().toFile("files.html").withText("File Index")+}</div>
-<hr />
-<h2>Classes</h2>
-<ul class="classList">
- <for each="thisClass" in="data">
- <li>{!
- if (thisClass.alias == "_global_") {
- output += "<i>"+new Link().toClass(thisClass.alias)+"</i>";
- }
- else {
- output += new Link().toClass(thisClass.alias);
- }
- !}</li>
- </for>
-</ul>
-<hr />
View
56 jsdoc-template/allfiles.tmpl
@@ -1,56 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
- <head>
- <meta http-equiv="content-type" content="text/html; charset={+IO.encoding+}"" />
- {! Link.base = ""; /* all generated links will be relative to this */ !}
- <title>JsDoc Reference - File Index</title>
- <meta name="generator" content="JsDoc Toolkit" />
-
- <style type="text/css">
- {+include("static/default.css")+}
- </style>
- </head>
-
- <body>
- {+include("static/header.html")+}
-
- <div id="index">
- {+publish.classesIndex+}
- </div>
-
- <div id="content">
- <h1 class="classTitle">File Index</h1>
-
- <for each="item" in="data">
- <div>
- <h2>{+new Link().toSrc(item.alias).withText(item.name)+}</h2>
- <if test="item.desc">{+resolveLinks(summarize(item.desc))+}</if>
- <dl>
- <if test="item.author">
- <dt class="heading">Author:</dt>
- <dd>{+item.author+}</dd>
- </if>
- <if test="item.version">
- <dt class="heading">Version:</dt>
- <dd>{+item.version+}</dd>
- </if>
- {! var locations = item.comment.getTag('location').map(function($){return $.toString().replace(/(^\$ ?| ?\$$)/g, '').replace(/^HeadURL: https:/g, 'http:');}) !}
- <if test="locations.length">
- <dt class="heading">Location:</dt>
- <for each="location" in="locations">
- <dd><a href="{+location+}">{+location+}</a></dd>
- </for>
- </if>
- </dl>
- </div>
- <hr />
- </for>
-
- </div>
- <div class="fineprint" style="clear:both">
- <if test="JSDOC.opt.D.copyright">&copy;{+JSDOC.opt.D.copyright+}<br /></if>
- Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blankt">JsDoc Toolkit</a> {+JSDOC.VERSION+} on {+new Date()+}
- </div>
- </body>
-</html>
View
646 jsdoc-template/class.tmpl
@@ -1,646 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
- <head>
- <meta http-equiv="content-type" content="text/html; charset={+IO.encoding+}" />
- <meta name="generator" content="JsDoc Toolkit" />
- {! Link.base = "../"; /* all generated links will be relative to this */ !}
- <title>JsDoc Reference - {+data.alias+}</title>
-
- <style type="text/css">
- {+include("static/default.css")+}
- </style>
- </head>
-
- <body>
-<!-- ============================== header ================================= -->
- <!-- begin static/header.html -->
- {+include("static/header.html")+}
- <!-- end static/header.html -->
-
-<!-- ============================== classes index ============================ -->
- <div id="index">
- <!-- begin publish.classesIndex -->
- {+publish.classesIndex+}
- <!-- end publish.classesIndex -->
- </div>
-
- <div id="content">
-<!-- ============================== class title ============================ -->
- <h1 class="classTitle">
- {!
- var classType = "";
-
- if (data.isBuiltin()) {
- classType += "Built-In ";
- }
-
- if (data.isNamespace) {
- if (data.is('FUNCTION')) {
- classType += "Function ";
- }
- classType += "Namespace ";
- }
- else {
- classType += "Class ";
- }
- !}
- {+classType+}{+data.alias+}
- </h1>
-
-<!-- ============================== class summary ========================== -->
- <p class="description">
- <if test="data.augments.length"><br />Extends
- {+
- data.augments
- .sort()
- .map(
- function($) { return new Link().toSymbol($); }
- )
- .join(", ")
- +}.<br />
- </if>
-
- {+resolveLinks(data.classDesc)+}
-
- <if test="!data.isBuiltin()">{# isn't defined in any file #}
- <br /><i>Defined in: </i> {+new Link().toSrc(data.srcFile)+}.
- </if>
- </p>
-
-<!-- ============================== constructor summary ==================== -->
- <if test="!data.isBuiltin() && (data.isNamespace || data.is('CONSTRUCTOR'))">
- <table class="summaryTable" cellspacing="0" summary="A summary of the constructor documented in the class {+data.alias+}.">
- <caption>{+classType+}Summary</caption>
- <thead>
- <tr>
- <th scope="col">Constructor Attributes</th>
- <th scope="col">Constructor Name and Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td class="attributes">{!
- if (data.isPrivate) output += "&lt;private&gt; ";
- if (data.isInner) output += "&lt;inner&gt; ";
- !}&nbsp;</td>
- <td class="nameDescription" {!if (data.comment.getTag("hilited").length){output += 'style="color: red"'}!}>
- <div class="fixedFont">
- <b>{+ new Link().toSymbol(data.alias).inner('constructor')+}</b><if test="classType != 'Namespace '">{+ makeSignature(data.params) +}</if>
- </div>
- <div class="description">{+resolveLinks(summarize(data.desc))+}</div>
- </td>
- </tr>
- </tbody>
- </table>
- </if>
-
-<!-- ============================== properties summary ===================== -->
- <if test="data.properties.length">
- {! var ownProperties = data.properties.filter(function($){return $.memberOf == data.alias && !$.isNamespace}).sort(makeSortby("name")); !}
- <if test="ownProperties.length">
- <table class="summaryTable" cellspacing="0" summary="A summary of the fields documented in the class {+data.alias+}.">
- <caption>Field Summary</caption>
- <thead>
- <tr>
- <th scope="col">Field Attributes</th>
- <th scope="col">Field Name and Description</th>
- </tr>
- </thead>
- <tbody>
- <for each="member" in="ownProperties">
- <tr>
- <td class="attributes">{!
- if (member.isPrivate) output += "&lt;private&gt; ";
- if (member.isInner) output += "&lt;inner&gt; ";
- if (member.isStatic) output += "&lt;static&gt; ";
- if (member.isConstant) output += "&lt;constant&gt; ";
- !}&nbsp;</td>
- <td class="nameDescription">
- <div class="fixedFont">
- <if test="member.isStatic && member.memberOf != '_global_'">{+member.memberOf+}.</if><b>{+new Link().toSymbol(member.alias).withText(member.name)+}</b>
- </div>
- <div class="description">{+resolveLinks(summarize(member.desc))+}</div>
- </td>
- </tr>
- </for>
- </tbody>
- </table>
- </if>
-
- <if test="data.inheritsFrom.length">
- <dl class="inheritsList">
- {!
- var borrowedMembers = data.properties.filter(function($) {return $.memberOf != data.alias});
-
- var contributers = [];
- borrowedMembers.map(function($) {if (contributers.indexOf($.memberOf) < 0) contributers.push($.memberOf)});
- for (var i = 0, l = contributers.length; i < l; i++) {
- output +=
- "<dt>Fields borrowed from class "+new Link().toSymbol(contributers[i])+": </dt>"
- +
- "<dd>" +
- borrowedMembers
- .filter(
- function($) { return $.memberOf == contributers[i] }
- )
- .sort(makeSortby("name"))
- .map(
- function($) { return new Link().toSymbol($.alias).withText($.name) }
- )
- .join(", ")
- +
- "</dd>";
- }
- !}
- </dl>
- </if>
- </if>
-
-<!-- ============================== methods summary ======================== -->
- <if test="data.methods.length">
- {! var ownMethods = data.methods.filter(function($){return $.memberOf == data.alias && !$.isNamespace}).sort(makeSortby("name")); !}
- <if test="ownMethods.length">
- <table class="summaryTable" cellspacing="0" summary="A summary of the methods documented in the class {+data.alias+}.">
- <caption>Method Summary</caption>
- <thead>
- <tr>
- <th scope="col">Method Attributes</th>
- <th scope="col">Method Name and Description</th>
- </tr>
- </thead>
- <tbody>
- <for each="member" in="ownMethods">
- <tr>
- <td class="attributes">{!
- if (member.isPrivate) output += "&lt;private&gt; ";
- if (member.isInner) output += "&lt;inner&gt; ";
- if (member.isStatic) output += "&lt;static&gt; ";
- !}&nbsp;</td>
- <td class="nameDescription">
- <div class="fixedFont"><if test="member.isStatic && member.memberOf != '_global_'">{+member.memberOf+}.</if><b>{+new Link().toSymbol(member.alias).withText(member.name)+}</b>{+makeSignature(member.params)+}
- </div>
- <div class="description">{+resolveLinks(summarize(member.desc))+}</div>
- </td>
- </tr>
- </for>
- </tbody>
- </table>
- </if>
-
- <if test="data.inheritsFrom.length">
- <dl class="inheritsList">
- {!
- var borrowedMembers = data.methods.filter(function($) {return $.memberOf != data.alias});
- var contributers = [];
- borrowedMembers.map(function($) {if (contributers.indexOf($.memberOf) < 0) contributers.push($.memberOf)});
- for (var i = 0, l = contributers.length; i < l; i++) {
- output +=
- "<dt>Methods borrowed from class "+new Link().toSymbol(contributers[i])+": </dt>"
- +
- "<dd>" +
- borrowedMembers
- .filter(
- function($) { return $.memberOf == contributers[i] }
- )
- .sort(makeSortby("name"))
- .map(
- function($) { return new Link().toSymbol($.alias).withText($.name) }
- )
- .join(", ")
- +
- "</dd>";
- }
-
- !}
- </dl>
- </if>
- </if>
-<!-- ============================== events summary ======================== -->
- <if test="data.events.length">
- {! var ownEvents = data.events.filter(function($){return $.memberOf == data.alias && !$.isNamespace}).sort(makeSortby("name")); !}
- <if test="ownEvents.length">
- <table class="summaryTable" cellspacing="0" summary="A summary of the events documented in the class {+data.alias+}.">
- <caption>Event Summary</caption>
- <thead>
- <tr>
- <th scope="col">Event Attributes</th>
- <th scope="col">Event Name and Description</th>
- </tr>
- </thead>
- <tbody>
- <for each="member" in="ownEvents">
- <tr>
- <td class="attributes">{!
- if (member.isPrivate) output += "&lt;private&gt; ";
- if (member.isInner) output += "&lt;inner&gt; ";
- if (member.isStatic) output += "&lt;static&gt; ";
- !}&nbsp;</td>
- <td class="nameDescription">
- <div class="fixedFont"><if test="member.isStatic && member.memberOf != '_global_'">{+member.memberOf+}.</if><b>{+new Link().toSymbol(member.alias).withText(member.name)+}</b>{+makeSignature(member.params)+}
- </div>
- <div class="description">{+resolveLinks(summarize(member.desc))+}</div>
- </td>
- </tr>
- </for>
- </tbody>
- </table>
- </if>
-
- <if test="data.inheritsFrom.length">
- <dl class="inheritsList">
- {!
- var borrowedMembers = data.events.filter(function($) {return $.memberOf != data.alias});
- var contributers = [];
- borrowedMembers.map(function($) {if (contributers.indexOf($.memberOf) < 0) contributers.push($.memberOf)});
- for (var i = 0, l = contributers.length; i < l; i++) {
- output +=
- "<dt>Events borrowed from class "+new Link().toSymbol(contributers[i])+": </dt>"
- +
- "<dd>" +
- borrowedMembers
- .filter(
- function($) { return $.memberOf == contributers[i] }
- )
- .sort(makeSortby("name"))
- .map(
- function($) { return new Link().toSymbol($.alias).withText($.name) }
- )
- .join(", ")
- +
- "</dd>";
- }
-
- !}
- </dl>
- </if>
- </if>
-
-<!-- ============================== constructor details ==================== -->
- <if test="!data.isBuiltin() && (data.isNamespace || data.is('CONSTRUCTOR'))">
- <div class="details"><a name="constructor"> </a>
- <div class="sectionTitle">
- {+classType+}Detail
- </div>
-
- <div class="fixedFont">{!
- if (data.isPrivate) output += "&lt;private&gt; ";
- if (data.isInner) output += "&lt;inner&gt; ";
- !}
- <b>{+ data.alias +}</b><if test="classType != 'Namespace '">{+ makeSignature(data.params) +}</if>
- </div>
-
- <div class="description">
- {+resolveLinks(data.desc)+}
- <if test="data.author"><br /><i>Author: </i>{+data.author+}.</if>
- </div>
-
- <if test="data.example.length">
- <for each="example" in="data.example">
- <pre class="code">{+example+}</pre>
- </for>
- </if>
-
-
- <if test="data.params.length">
- <dl class="detailList">
- <dt class="heading">Parameters:</dt>
- <for each="item" in="data.params">
- <dt>
- {+((item.type)?""+("<span class=\"light fixedFont\">{"+(new Link().toSymbol(item.type)+"}</span> ")) : "")+} <b>{+item.name+}</b>
- <if test="item.isOptional"><i>Optional<if test="item.defaultValue">, Default: {+item.defaultValue+}</if></i></if>
- </dt>
- <dd>{+resolveLinks(item.desc)+}</dd>
- </for>
- </dl>
- </if>
- <if test="data.deprecated">
- <dl class="detailList">
- <dt class="heading">Deprecated:</dt>
- <dt>
- {+resolveLinks(data.deprecated)+}
- </dt>
- </dl>
- </if>
- <if test="data.since">
- <dl class="detailList">
- <dt class="heading">Since:</dt>
- <dd>{+ data.since +}</dd>
- </dl>
- </if>
- <if test="data.exceptions.length">
- <dl class="detailList">
- <dt class="heading">Throws:</dt>
- <for each="item" in="data.exceptions">
- <dt>
- {+((item.type)?"<span class=\"light fixedFont\">{"+(new Link().toSymbol(item.type))+"}</span> " : "")+} <b>{+item.name+}</b>
- </dt>
- <dd>{+resolveLinks(item.desc)+}</dd>
- </for>
- </dl>
- </if>
- <if test="data.returns.length">
- <dl class="detailList">
- <dt class="heading">Returns:</dt>
- <for each="item" in="data.returns">
- <dd>{+((item.type)?"<span class=\"light fixedFont\">{"+(new Link().toSymbol(item.type))+"}</span> " : "")+}{+resolveLinks(item.desc)+}</dd>
- </for>
- </dl>
- </if>
- <if test="data.requires.length">
- <dl class="detailList">
- <dt class="heading">Requires:</dt>
- <for each="item" in="data.requires">
- <dd>{+ resolveLinks(item) +}</dd>
- </for>
- </dl>
- </if>
- <if test="data.see.length">
- <dl class="detailList">
- <dt class="heading">See:</dt>
- <for each="item" in="data.see">
- <dd>{+ new Link().toSymbol(item) +}</dd>
- </for>
- </dl>
- </if>
-
- </div>
- </if>
-
-<!-- ============================== field details ========================== -->
- <if test="defined(ownProperties) && ownProperties.length">
- <div class="sectionTitle">
- Field Detail
- </div>
- <for each="member" in="ownProperties">
- <a name="{+Link.symbolNameToLinkName(member)+}"> </a>
- <div class="fixedFont">{!
- if (member.isPrivate) output += "&lt;private&gt; ";
- if (member.isInner) output += "&lt;inner&gt; ";
- if (member.isStatic) output += "&lt;static&gt; ";
- if (member.isConstant) output += "&lt;constant&gt; ";
- !}
-
- <if test="member.type"><span class="light">{{+new Link().toSymbol(member.type)+}}</span></if>
- <if test="member.isStatic && member.memberOf != '_global_'"><span class="light">{+member.memberOf+}.</span></if><b>{+member.name+}</b>
-
- </div>
- <div class="description">
- {+resolveLinks(member.desc)+}
- <if test="member.srcFile != data.srcFile">
- <br />
- <i>Defined in: </i> {+new Link().toSrc(member.srcFile)+}.
- </if>
- <if test="member.author"><br /><i>Author: </i>{+member.author+}.</if>
- </div>
-
- <if test="member.example.length">
- <for each="example" in="member.example">
- <pre class="code">{+example+}</pre>
- </for>
- </if>
-
- <if test="member.deprecated">
- <dl class="detailList">
- <dt class="heading">Deprecated:</dt>
- <dt>
- {+ member.deprecated +}
- </dt>
- </dl>
- </if>
- <if test="member.since">
- <dl class="detailList">
- <dt class="heading">Since:</dt>
- <dd>{+ member.since +}</dd>
- </dl>
- </if>
- <if test="member.see.length">
- <dl class="detailList">
- <dt class="heading">See:</dt>
- <for each="item" in="member.see">
- <dd>{+ new Link().toSymbol(item) +}</dd>
- </for>
- </dl>
- </if>
- <if test="member.defaultValue">
- <dl class="detailList">
- <dt class="heading">Default Value:</dt>
- <dd>
- {+resolveLinks(member.defaultValue)+}
- </dd>
- </dl>
- </if>
-
- <if test="!$member_last"><hr /></if>
- </for>
- </if>
-
-<!-- ============================== method details ========================= -->
- <if test="defined(ownMethods) && ownMethods.length">
- <div class="sectionTitle">
- Method Detail
- </div>
- <for each="member" in="ownMethods">
- <a name="{+Link.symbolNameToLinkName(member)+}"> </a>
- <div class="fixedFont">{!
- if (member.isPrivate) output += "&lt;private&gt; ";
- if (member.isInner) output += "&lt;inner&gt; ";
- if (member.isStatic) output += "&lt;static&gt; ";
- !}
-
- <if test="member.type"><span class="light">{{+new Link().toSymbol(member.type)+}}</span></if>
- <if test="member.isStatic && member.memberOf != '_global_'"><span class="light">{+member.memberOf+}.</span></if><b>{+member.name+}</b>{+makeSignature(member.params)+}
-
- </div>
- <div class="description">
- {+resolveLinks(member.desc)+}
- <if test="member.srcFile != data.srcFile">
- <br />
- <i>Defined in: </i> {+new Link().toSrc(member.srcFile)+}.
- </if>
- <if test="member.author"><br /><i>Author: </i>{+member.author+}.</if>
- </div>
-
- <if test="member.example.length">
- <for each="example" in="member.example">
- <pre class="code">{+example+}</pre>
- </for>
- </if>
-
- <if test="member.params.length">
- <dl class="detailList">
- <dt class="heading">Parameters:</dt>
- <for each="item" in="member.params">
- <dt>
- {+((item.type)?"<span class=\"light fixedFont\">{"+(new Link().toSymbol(item.type))+"}</span> " : "")+}<b>{+item.name+}</b>
- <if test="item.isOptional"><i>Optional<if test="item.defaultValue">, Default: {+item.defaultValue+}</if></i></if>
- </dt>
- <dd>{+resolveLinks(item.desc)+}</dd>
- </for>
- </dl>
- </if>
- <if test="member.deprecated">
- <dl class="detailList">
- <dt class="heading">Deprecated:</dt>
- <dt>
- {+member.deprecated+}
- </dt>
- </dl>
- </if>
- <if test="member.since">
- <dl class="detailList">
- <dt class="heading">Since:</dt>
- <dd>{+ member.since +}</dd>
- </dl>
- </dl>
- </if>
- <if test="member.exceptions.length">
- <dl class="detailList">
- <dt class="heading">Throws:</dt>
- <for each="item" in="member.exceptions">
- <dt>
- {+((item.type)?"<span class=\"light fixedFont\">{"+(new Link().toSymbol(item.type))+"}</span> " : "")+} <b>{+item.name+}</b>
- </dt>
- <dd>{+resolveLinks(item.desc)+}</dd>
- </for>
- </dl>
- </if>
- <if test="member.returns.length">
- <dl class="detailList">
- <dt class="heading">Returns:</dt>
- <for each="item" in="member.returns">
- <dd>{+((item.type)?"<span class=\"light fixedFont\">{"+(new Link().toSymbol(item.type))+"}</span> " : "")+}{+resolveLinks(item.desc)+}</dd>
- </for>
- </dl>
- </if>
- <if test="member.requires.length">
- <dl class="detailList">
- <dt class="heading">Requires:</dt>
- <for each="item" in="member.requires">
- <dd>{+ resolveLinks(item) +}</dd>
- </for>
- </dl>
- </if>
- <if test="member.see.length">
- <dl class="detailList">
- <dt class="heading">See:</dt>
- <for each="item" in="member.see">
- <dd>{+ new Link().toSymbol(item) +}</dd>
- </for>
- </dl>
- </if>
-
- <if test="!$member_last"><hr /></if>
- </for>
- </if>
-
-<!-- ============================== event details ========================= -->
- <if test="defined(ownEvents) && ownEvents.length">
- <div class="sectionTitle">
- Event Detail
- </div>
- <for each="member" in="ownEvents">
- <a name="event:{+Link.symbolNameToLinkName(member)+}"> </a>
- <div class="fixedFont">{!
- if (member.isPrivate) output += "&lt;private&gt; ";
- if (member.isInner) output += "&lt;inner&gt; ";
- if (member.isStatic) output += "&lt;static&gt; ";
- !}
-
- <if test="member.type"><span class="light">{{+new Link().toSymbol(member.type)+}}</span></if>
- <if test="member.isStatic && member.memberOf != '_global_'"><span class="light">{+member.memberOf+}.</span></if><b>{+member.name+}</b>{+makeSignature(member.params)+}
-
- </div>
- <div class="description">
- {+resolveLinks(member.desc)+}
- <if test="member.srcFile != data.srcFile">
- <br />
- <i>Defined in: </i> {+new Link().toSrc(member.srcFile)+}.
- </if>
- <if test="member.author"><br /><i>Author: </i>{+member.author+}.</if>
- </div>
-
- <if test="member.example.length">
- <for each="example" in="member.example">
- <pre class="code">{+example+}</pre>
- </for>
- </if>
-
- <if test="member.params.length">
- <dl class="detailList">
- <dt class="heading">Parameters:</dt>
- <for each="item" in="member.params">
- <dt>
- {+((item.type)?"<span class=\"light fixedFont\">{"+(new Link().toSymbol(item.type))+"}</span> " : "")+}<b>{+item.name+}</b>
- <if test="item.isOptional"><i>Optional<if test="item.defaultValue">, Default: {+item.defaultValue+}</if></i></if>
- </dt>
- <dd>{+resolveLinks(item.desc)+}</dd>
- </for>
- </dl>
- </if>
- <if test="member.deprecated">
- <dl class="detailList">
- <dt class="heading">Deprecated:</dt>
- <dt>
- {+member.deprecated+}
- </dt>
- </dl>
- </if>
- <if test="member.since">
- <dl class="detailList">
- <dt class="heading">Since:</dt>
- <dd>{+ member.since +}</dd>
- </dl>
- </dl>
- </if>
- <if test="member.exceptions.length">
- <dl class="detailList">
- <dt class="heading">Throws:</dt>
- <for each="item" in="member.exceptions">
- <dt>
- {+((item.type)?"<span class=\"light fixedFont\">{"+(new Link().toSymbol(item.type))+"}</span> " : "")+} <b>{+item.name+}</b>
- </dt>
- <dd>{+resolveLinks(item.desc)+}</dd>
- </for>
- </dl>
- </if>
- <if test="member.returns.length">
- <dl class="detailList">
- <dt class="heading">Returns:</dt>
- <for each="item" in="member.returns">
- <dd>{+((item.type)?"<span class=\"light fixedFont\">{"+(new Link().toSymbol(item.type))+"}</span> " : "")+}{+resolveLinks(item.desc)+}</dd>
- </for>
- </dl>
- </if>
- <if test="member.requires.length">
- <dl class="detailList">
- <dt class="heading">Requires:</dt>
- <for each="item" in="member.requires">
- <dd>{+ resolveLinks(item) +}</dd>
- </for>
- </dl>
- </if>
- <if test="member.see.length">
- <dl class="detailList">
- <dt class="heading">See:</dt>
- <for each="item" in="member.see">
- <dd>{+ new Link().toSymbol(item) +}</dd>
- </for>
- </dl>
- </if>
-
- <if test="!$member_last"><hr /></if>
- </for>
- </if>
-
- <hr />
- </div>
-
-
-<!-- ============================== footer ================================= -->
- <div class="fineprint" style="clear:both">
- <if test="JSDOC.opt.D.copyright">&copy;{+JSDOC.opt.D.copyright+}<br /></if>
- Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> {+JSDOC.VERSION+} on {+new Date()+}
- </div>
- </body>
-</html>
View
39 jsdoc-template/index.tmpl
@@ -1,39 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
- <head>
- <meta http-equiv="content-type" content="text/html; charset={+IO.encoding+}"" />
-
- <title>JsDoc Reference - Index</title>
- <meta name="generator" content="JsDoc Toolkit" />
-
- <style type="text/css">
- {+include("static/default.css")+}
- </style>
- </head>
-
- <body>
- {+include("static/header.html")+}
-
- <div id="index">
- {+publish.classesIndex+}
- </div>
-
- <div id="content">
- <h1 class="classTitle">Class Index</h1>
-
- <for each="thisClass" in="data">
- <div>
- <h2>{+(new Link().toSymbol(thisClass.alias))+}</h2>
- {+resolveLinks(summarize(thisClass.classDesc))+}
- </div>
- <hr />
- </for>
-
- </div>
- <div class="fineprint" style="clear:both">
- <if test="JSDOC.opt.D.copyright">&copy;{+JSDOC.opt.D.copyright+}<br /></if>
- Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blankt">JsDoc Toolkit</a> {+JSDOC.VERSION+} on {+new Date()+}
- </div>
- </body>
-</html>
View
184 jsdoc-template/publish.js
@@ -1,184 +0,0 @@
-/** Called automatically by JsDoc Toolkit. */
-function publish(symbolSet) {
- publish.conf = { // trailing slash expected for dirs
- ext: ".html",
- outDir: JSDOC.opt.d || SYS.pwd+"../out/jsdoc/",
- templatesDir: JSDOC.opt.t || SYS.pwd+"../templates/jsdoc/",
- symbolsDir: "symbols/",
- srcDir: "symbols/src/"
- };
-
- // is source output is suppressed, just display the links to the source file
- if (JSDOC.opt.s && defined(Link) && Link.prototype._makeSrcLink) {
- Link.prototype._makeSrcLink = function(srcFilePath) {
- return "&lt;"+srcFilePath+"&gt;";
- }
- }
-
- // create the folders and subfolders to hold the output
- IO.mkPath((publish.conf.outDir+"symbols/src").split("/"));
-
- // used to allow Link to check the details of things being linked to
- Link.symbolSet = symbolSet;
-
- // create the required templates
- try {
- var classTemplate = new JSDOC.JsPlate(publish.conf.templatesDir+"class.tmpl");
- var classesTemplate = new JSDOC.JsPlate(publish.conf.templatesDir+"allclasses.tmpl");
- }
- catch(e) {
- print("Couldn't create the required templates: "+e);
- quit();
- }
-
- // some ustility filters
- function hasNoParent($) {return ($.memberOf == "")}
- function isaFile($) {return ($.is("FILE"))}
- function isaClass($) {return ($.is("CONSTRUCTOR") || $.isNamespace)}
-
- // get an array version of the symbolset, useful for filtering
- var symbols = symbolSet.toArray();
-
- // create the hilited source code files
- var files = JSDOC.opt.srcFiles;
- for (var i = 0, l = files.length; i < l; i++) {
- var file = files[i];
- var srcDir = publish.conf.outDir + "symbols/src/";
- makeSrcFile(file, srcDir);
- }
-
- // get a list of all the classes in the symbolset
- var classes = symbols.filter(isaClass).sort(makeSortby("alias"));
-
- // create a class index, displayed in the left-hand column of every class page
- Link.base = "../";
- publish.classesIndex = classesTemplate.process(classes); // kept in memory
-
- // create each of the class pages
- for (var i = 0, l = classes.length; i < l; i++) {
- var symbol = classes[i];
-
- symbol.events = symbol.getEvents(); // 1 order matters
- symbol.methods = symbol.getMethods(); // 2
-
- var output = "";
- output = classTemplate.process(symbol);
-
- IO.saveFile(publish.conf.outDir+"symbols/", symbol.alias+publish.conf.ext, output);
- }
-
- // regenerate the index with different relative links, used in the index pages
- Link.base = "";
- publish.classesIndex = classesTemplate.process(classes);
-
- // create the class index page
- try {
- var classesindexTemplate = new JSDOC.JsPlate(publish.conf.templatesDir+"index.tmpl");
- }
- catch(e) { print(e.message); quit(); }
-
- var classesIndex = classesindexTemplate.process(classes);
- IO.saveFile(publish.conf.outDir, "index"+publish.conf.ext, classesIndex);
- classesindexTemplate = classesIndex = classes = null;
-
- // create the file index page
- try {
- var fileindexTemplate = new JSDOC.JsPlate(publish.conf.templatesDir+"allfiles.tmpl");
- }
- catch(e) { print(e.message); quit(); }
-
- var documentedFiles = symbols.filter(isaFile); // files that have file-level docs
- var allFiles = []; // not all files have file-level docs, but we need to list every one
-
- for (var i = 0; i < files.length; i++) {
- allFiles.push(new JSDOC.Symbol(files[i], [], "FILE", new JSDOC.DocComment("/** */")));
- }
-
- for (var i = 0; i < documentedFiles.length; i++) {
- var offset = files.indexOf(documentedFiles[i].alias);
- allFiles[offset] = documentedFiles[i];
- }
-
- allFiles = allFiles.sort(makeSortby("name"));
-
- // output the file index page
- var filesIndex = fileindexTemplate.process(allFiles);
- IO.saveFile(publish.conf.outDir, "files"+publish.conf.ext, filesIndex);
- fileindexTemplate = filesIndex = files = null;
-}
-
-
-/** Just the first sentence (up to a full stop). Should not break on dotted variable names. */
-function summarize(desc) {
- if (typeof desc != "undefined")
- return desc.match(/([\w\W]+?\.)[^a-z0-9_$]/i)? RegExp.$1 : desc;
-}
-
-/** Make a symbol sorter by some attribute. */
-function makeSortby(attribute) {
- return function(a, b) {
- if (a[attribute] != undefined && b[attribute] != undefined) {
- a = a[attribute].toLowerCase();
- b = b[attribute].toLowerCase();
- if (a < b) return -1;
- if (a > b) return 1;
- return 0;
- }
- }
-}
-
-/** Pull in the contents of an external file at the given path. */
-function include(path) {
- var path = publish.conf.templatesDir+path;
- return IO.readFile(path);
-}
-
-/** Turn a raw source file into a code-hilited page in the docs. */
-function makeSrcFile(path, srcDir, name) {
- if (JSDOC.opt.s) return;
-
- if (!name) {
- name = path.replace(/\.\.?[\\\/]/g, "").replace(/[\\\/]/g, "_");
- name = name.replace(/\:/g, "_");
- }
-
- var src = {path: path, name:name, charset: IO.encoding, hilited: ""};
-
- if (defined(JSDOC.PluginManager)) {
- JSDOC.PluginManager.run("onPublishSrc", src);
- }
-
- if (src.hilited) {
- IO.saveFile(srcDir, name+publish.conf.ext, src.hilited);
- }
-}
-
-/** Build output for displaying function parameters. */
-function makeSignature(params) {
- if (!params) return "()";
- var signature = "("
- +
- params.filter(
- function($) {
- return $.name.indexOf(".") == -1; // don't show config params in signature
- }
- ).map(
- function($) {
- return $.name;
- }
- ).join(", ")
- +
- ")";
- return signature;
-}
-
-/** Find symbol {@link ...} strings in text and turn into html links */
-function resolveLinks(str, from) {
- str = str.replace(/\{@link ([^} ]+) ?\}/gi,
- function(match, symbolName) {
- return new Link().toSymbol(symbolName);
- }
- );
-
- return str;
-}
View
162 jsdoc-template/static/default.css
@@ -1,162 +0,0 @@
-/* default.css */
-body
-{
- font: 12px "Lucida Grande", Tahoma, Arial, Helvetica, sans-serif;
- width: 800px;
-}
-
-.header
-{
- clear: both;
- background-color: #ccc;
- padding: 8px;
-}
-
-h1
-{
- font-size: 150%;
- font-weight: bold;
- padding: 0;
- margin: 1em 0 0 .3em;
-}
-
-hr
-{
- border: none 0;
- border-top: 1px solid #7F8FB1;
- height: 1px;
-}
-
-pre.code
-{
- display: block;
- padding: 8px;
- border: 1px dashed #ccc;
-}
-
-#index
-{
- margin-top: 24px;
- float: left;
- width: 160px;
- position: absolute;
- left: 8px;
- background-color: #F3F3F3;
- padding: 8px;
-}
-
-#content
-{
- margin-left: 190px;
- width: 600px;
-}
-
-.classList
-{
- list-style-type: none;
- padding: 0;
- margin: 0 0 0 8px;
- font-family: arial, sans-serif;
- font-size: 1em;
- overflow: auto;
-}
-
-.classList li
-{
- padding: 0;
- margin: 0 0 8px 0;
-}
-
-.summaryTable { width: 100%; }
-
-h1.classTitle
-{
- font-size:170%;
- line-height:130%;
-}
-
-h2 { font-size: 110%; }
-caption, div.sectionTitle
-{
- background-color: #7F8FB1;
- color: #fff;
- font-size:130%;
- text-align: left;
- padding: 2px 6px 2px 6px;
- border: 1px #7F8FB1 solid;
-}
-
-div.sectionTitle { margin-bottom: 8px; }
-.summaryTable thead { display: none; }
-
-.summaryTable td
-{
- vertical-align: top;
- padding: 4px;
- border-bottom: 1px #7F8FB1 solid;
- border-right: 1px #7F8FB1 solid;
-}
-
-/*col#summaryAttributes {}*/
-.summaryTable td.attributes
-{
- border-left: 1px #7F8FB1 solid;
- width: 140px;
- text-align: right;
-}
-
-td.attributes, .fixedFont
-{
- line-height: 15px;
- color: #002EBE;
- font-family: "Courier New",Courier,monospace;
- font-size: 13px;
-}
-
-.summaryTable td.nameDescription
-{
- text-align: left;
- font-size: 13px;
- line-height: 15px;
-}
-
-.summaryTable td.nameDescription, .description
-{
- line-height: 15px;
- padding: 4px;
- padding-left: 4px;
-}
-
-.summaryTable { margin-bottom: 8px; }
-
-ul.inheritsList
-{
- list-style: square;
- margin-left: 20px;
- padding-left: 0;
-}
-
-.detailList {
- margin-left: 20px;
- line-height: 15px;
-}
-.detailList dt { margin-left: 20px; }
-
-.detailList .heading
-{
- font-weight: bold;
- padding-bottom: 6px;
- margin-left: 0;
-}
-
-.light, td.attributes, .light a:link, .light a:visited
-{
- color: #777;
- font-style: italic;
-}
-
-.fineprint
-{
- text-align: right;
- font-size: 10px;
-}
View
2  jsdoc-template/static/header.html
@@ -1,2 +0,0 @@
-<div id="header">
-</div>
View
19 jsdoc-template/static/index.html
@@ -1,19 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <meta http-equiv="content-type" content="text/html; charset=utf-8" />
- <title>Generated Javascript Documentation</title>
-</head>
-<frameset cols="20%,80%">
- <frame src="allclasses-frame.html" name="packageFrame" />
- <frame src="splash.html" name="classFrame" />
- <noframes>
- <body>
- <p>
- This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client.
- </p>
- </body>
- </noframes>
-</frameset>
-</html>
View
35 jsdoc-template/symbol.tmpl
@@ -1,35 +0,0 @@
-<symbol alias="{+data.alias+}">
- <name>{+data.name+}</name>
- <memberOf>{+data.memberOf+}</memberOf>
- <isStatic>{+data.isStatic+}</isStatic>
- <isa>{+data.isa+}</isa>
- <desc>{+data.desc+}</desc>
- <classDesc>{+data.classDesc+}</classDesc>
-
- <methods><for each="method" in="data.methods">
- <method>
- <name>{+method.name+}</name>
- <memberOf>{+method.memberOf+}</memberOf>
- <isStatic>{+method.isStatic+}</isStatic>
- <desc>{+method.desc+}</desc>
- <params><for each="param" in="method.params">
- <param>
- <type>{+param.type+}</type>
- <name>{+param.name+}</name>
- <desc>{+param.desc+}</desc>
- <defaultValue>{+param.defaultValue+}</defaultValue>
- </param></for>
- </params>
- </method></for>
- </methods>
-
- <properties><for each="property" in="data.properties">
- <property>
- <name>{+property.name+}</name>
- <memberOf>{+property.memberOf+}</memberOf>
- <isStatic>{+property.isStatic+}</isStatic>
- <desc>{+property.desc+}</desc>
- <type>{+property.type+}</type>
- </property></for>
- </properties>
-</symbol>
View
94 src/core/Matchers.js
@@ -65,85 +65,42 @@ jasmine.Matchers.matcherFn_ = function(matcherName, matcherFunction) {
};
};
-
-/**
- * toBe: compares the actual to the expected using ===
- * @param expected
- */
jasmine.Matchers.prototype.toBe = function(expected) {
return this.actual === expected;
};
-/**
- * toNotBe: compares the actual to the expected using !==
- * @param expected
- * @deprecated as of 1.0. Use not.toBe() instead.
- */
jasmine.Matchers.prototype.toNotBe = function(expected) {
return this.actual !== expected;
};
-/**
- * toEqual: compares the actual to the expected using common sense equality. Handles Objects, Arrays, etc.
- *
- * @param expected
- */
jasmine.Matchers.prototype.toEqual = function(expected) {
return this.env.equals_(this.actual, expected);
};
-/**
- * toNotEqual: compares the actual to the expected using the ! of jasmine.Matchers.toEqual
- * @param expected
- * @deprecated as of 1.0. Use not.toEqual() instead.
- */
jasmine.Matchers.prototype.toNotEqual = function(expected) {
return !this.env.equals_(this.actual, expected);
};
-/**
- * Matcher that compares the actual to the expected using a regular expression. Constructs a RegExp, so takes
- * a pattern or a String.
- *
- * @param expected
- */
jasmine.Matchers.prototype.toMatch = function(expected) {
return new RegExp(expected).test(this.actual);
};
-/**
- * Matcher that compares the actual to the expected using the boolean inverse of jasmine.Matchers.toMatch
- * @param expected
- * @deprecated as of 1.0. Use not.toMatch() instead.
- */
jasmine.Matchers.prototype.toNotMatch = function(expected) {
return !(new RegExp(expected).test(this.actual));
};
-/**
- * Matcher that compares the actual to jasmine.undefined.
- */
jasmine.Matchers.prototype.toBeDefined = function() {
return !jasmine.util.isUndefined(this.actual);
};
-/**
- * Matcher that compares the actual to jasmine.undefined.
- */
jasmine.Matchers.prototype.toBeUndefined = function() {
return jasmine.util.isUndefined(this.actual);
};
-/**
- * Matcher that compares the actual to null.
- */
jasmine.Matchers.prototype.toBeNull = function() {
return (this.actual === null);
};
-/**
- * Matcher that compares the actual to NaN.
- */
jasmine.Matchers.prototype.toBeNaN = function() {
this.message = function() {
return [ "Expected " + jasmine.pp(this.actual) + " to be NaN." ];
@@ -152,25 +109,14 @@ jasmine.Matchers.prototype.toBeNaN = function() {
return (this.actual !== this.actual);
};
-/**
- * Matcher that boolean not-nots the actual.
- */
jasmine.Matchers.prototype.toBeTruthy = function() {
return !!this.actual;
};
-
-/**
- * Matcher that boolean nots the actual.
- */
jasmine.Matchers.prototype.toBeFalsy = function() {
return !this.actual;
};
-
-/**
- * Matcher that checks to see if the actual, a Jasmine spy, was called.
- */
jasmine.Matchers.prototype.toHaveBeenCalled = function() {
if (arguments.length > 0) {
throw new Error('toHaveBeenCalled does not take arguments, use toHaveBeenCalledWith');
@@ -190,14 +136,9 @@ jasmine.Matchers.prototype.toHaveBeenCalled = function() {
return this.actual.wasCalled;
};
-/** @deprecated Use expect(xxx).toHaveBeenCalled() instead */
+// TODO: kill this for 2.0
jasmine.Matchers.prototype.wasCalled = jasmine.Matchers.prototype.toHaveBeenCalled;
-/**
- * Matcher that checks to see if the actual, a Jasmine spy, was not called.
- *
- * @deprecated Use expect(xxx).not.toHaveBeenCalled() instead
- */
jasmine.Matchers.prototype.wasNotCalled = function() {
if (arguments.length > 0) {
throw new Error('wasNotCalled does not take arguments');
@@ -217,12 +158,6 @@ jasmine.Matchers.prototype.wasNotCalled = function() {
return !this.actual.wasCalled;
};
-/**
- * Matcher that checks to see if the actual, a Jasmine spy, was called with a set of parameters.
- *
- * @example
- *
- */
jasmine.Matchers.prototype.toHaveBeenCalledWith = function() {
var expectedArgs = jasmine.util.argsToArray(arguments);
if (!jasmine.isSpy(this.actual)) {
@@ -242,10 +177,10 @@ jasmine.Matchers.prototype.toHaveBeenCalledWith = function() {
return this.env.contains_(this.actual.argsForCall, expectedArgs);
};
-/** @deprecated Use expect(xxx).toHaveBeenCalledWith() instead */
+// TODO: kill for 2.0
jasmine.Matchers.prototype.wasCalledWith = jasmine.Matchers.prototype.toHaveBeenCalledWith;
-/** @deprecated Use expect(xxx).not.toHaveBeenCalledWith() instead */
+// TODO: kill for 2.0
jasmine.Matchers.prototype.wasNotCalledWith = function() {
var expectedArgs = jasmine.util.argsToArray(arguments);
if (!jasmine.isSpy(this.actual)) {
@@ -262,21 +197,10 @@ jasmine.Matchers.prototype.wasNotCalledWith = function() {
return !this.env.contains_(this.actual.argsForCall, expectedArgs);
};
-/**
- * Matcher that checks that the expected item is an element in the actual Array.
- *
- * @param {Object} expected
- */
jasmine.Matchers.prototype.toContain = function(expected) {
return this.env.contains_(this.actual, expected);
};
-/**
- * Matcher that checks that the expected item is NOT an element in the actual Array.
- *
- * @param {Object} expected
- * @deprecated as of 1.0. Use not.toContain() instead.
- */
jasmine.Matchers.prototype.toNotContain = function(expected) {
return !this.env.contains_(this.actual, expected);
};
@@ -289,13 +213,6 @@ jasmine.Matchers.prototype.toBeGreaterThan = function(expected) {
return this.actual > expected;
};
-/**
- * Matcher that checks that the expected item is equal to the actual item
- * up to a given level of decimal precision (default 2).
- *
- * @param {Number} expected
- * @param {Number} precision, as number of decimal places
- */
jasmine.Matchers.prototype.toBeCloseTo = function(expected, precision) {
if (precision !== 0) {
precision = precision || 2;
@@ -303,11 +220,6 @@ jasmine.Matchers.prototype.toBeCloseTo = function(expected, precision) {
return Math.abs(expected - this.actual) < (Math.pow(10, -precision) / 2);
};
-/**
- * Matcher that checks that the expected exception was thrown by the actual.
- *
- * @param {String} [expected]
- */
jasmine.Matchers.prototype.toThrow = function(expected) {
var result = false;
var exception;
View
10 src/core/PrettyPrinter.js
@@ -1,15 +1,7 @@
-/**
- * Base class for pretty printing for expectation results.
- */
jasmine.PrettyPrinter = function() {
this.ppNestLevel_ = 0;
};
-/**
- * Formats a value in a nice, human-readable string.
- *
- * @param value
- */
jasmine.PrettyPrinter.prototype.format = function(value) {
this.ppNestLevel_++;
try {
@@ -127,4 +119,4 @@ jasmine.StringPrettyPrinter.prototype.emitObject = function(obj) {
jasmine.StringPrettyPrinter.prototype.append = function(value) {
this.string += value;
-};
+};
View
229 src/core/base.js
@@ -1,9 +1,3 @@
-
-/**
- * Top level namespace for Jasmine, a lightweight JavaScript BDD/spec/testing framework.
- *
- * @namespace
- */
var jasmine = {};
// TODO: do we need this now that we have boot.js?
@@ -11,27 +5,12 @@ if (typeof window == "undefined" && typeof exports == "object") {
exports.jasmine = jasmine;
}
-/**
- * @private
- */
jasmine.unimplementedMethod_ = function() {
throw new Error("unimplemented method");
};
-/**
- * Default interval in milliseconds for event loop yields (e.g. to allow network activity or to refresh the screen with the HTML-based runner). Small values here may result in slow test running. Zero means no updates until all tests have completed.
- *
- */
jasmine.DEFAULT_UPDATE_INTERVAL = 250;
-
-/**
- * Maximum levels of nesting that will be included when an object is pretty-printed
- */
jasmine.MAX_PRETTY_PRINT_DEPTH = 40;
-
-/**
- * Default timeout interval in milliseconds for waitsFor() blocks.
- */
jasmine.DEFAULT_TIMEOUT_INTERVAL = 5000;
jasmine.getGlobal = function() {
@@ -42,216 +21,62 @@ jasmine.getGlobal = function() {
return getGlobal();
};
-/**
- * Getter for the Jasmine environment. Ensures one gets created
- */
jasmine.getEnv = function(options) {
var env = jasmine.currentEnv_ = jasmine.currentEnv_ || new jasmine.Env(options);
//jasmine. singletons in here (setTimeout blah blah).
return env;
};
-/**
- * @ignore
- * @private
- * @param value
- * @returns {Boolean}
- */
jasmine.isArray_ = function(value) {
return jasmine.isA_("Array", value);
};
-/**
- * @ignore
- * @private
- * @param value
- * @returns {Boolean}
- */
jasmine.isString_ = function(value) {
return jasmine.isA_("String", value);
};
-/**
- * @ignore
- * @private
- * @param value
- * @returns {Boolean}
- */
jasmine.isNumber_ = function(value) {
return jasmine.isA_("Number", value);
};
-/**
- * @ignore
- * @private
- * @param {String} typeName
- * @param value
- * @returns {Boolean}
- */
jasmine.isA_ = function(typeName, value) {
return Object.prototype.toString.apply(value) === '[object ' + typeName + ']';
};
-/**
- * Pretty printer for expecations. Takes any object and turns it into a human-readable string.
- *
- * @param value {Object} an object to be outputted
- * @returns {String}
- */
jasmine.pp = function(value) {
var stringPrettyPrinter = new jasmine.StringPrettyPrinter();
stringPrettyPrinter.format(value);
return stringPrettyPrinter.string;
};
-/**
- * Returns true if the object is a DOM Node.
- *
- * @param {Object} obj object to check
- * @returns {Boolean}
- */
jasmine.isDomNode = function(obj) {
return obj.nodeType > 0;
};
-/**
- * Returns a matchable 'generic' object of the class type. For use in expecations of type when values don't matter.
- *
- * @example
- * // don't care about which function is passed in, as long as it's a function
- * expect(mySpy).toHaveBeenCalledWith(jasmine.any(Function));
- *
- * @param {Class} clazz
- * @returns matchable object of the type clazz
- */
jasmine.any = function(clazz) {
return new jasmine.Matchers.Any(clazz);
};
-/**
- * Returns a matchable subset of a JSON object. For use in expectations when you don't care about all of the
- * attributes on the object.
- *
- * @example
- * // don't care about any other attributes than foo.
- * expect(mySpy).toHaveBeenCalledWith(jasmine.objectContaining({foo: "bar"});
- *
- * @param sample {Object} sample
- * @returns matchable object for the sample
- */
jasmine.objectContaining = function (sample) {
return new jasmine.Matchers.ObjectContaining(sample);
};
-/**
- * Jasmine Spies are test doubles that can act as stubs, spies, fakes or when used in an expecation, mocks.
- *
- * Spies should be created in test setup, before expectations. They can then be checked, using the standard Jasmine
- * expectation syntax. Spies can be checked if they were called or not and what the calling params were.
- *
- * A Spy has the following fields: wasCalled, callCount, mostRecentCall, and argsForCall (see docs).
- *
- * Spies are torn down at the end of every spec.
- *
- * Note: Do <b>not</b> call new jasmine.Spy() directly - a spy must be created using spyOn, jasmine.createSpy or jasmine.createSpyObj.
- *
- * @example
- * // a stub
- * var myStub = jasmine.createSpy('myStub'); // can be used anywhere
- *
- * // spy example
- * var foo = {
- * not: function(bool) { return !bool; }
- * }
- *
- * // actual foo.not will not be called, execution stops
- * spyOn(foo, 'not');
-
- // foo.not spied upon, execution will continue to implementation
- * spyOn(foo, 'not').andCallThrough();
- *
- * // fake example
- * var foo = {
- * not: function(bool) { return !bool; }
- * }
- *
- * // foo.not(val) will return val
- * spyOn(foo, 'not').andCallFake(function(value) {return value;});
- *
- * // mock example
- * foo.not(7 == 7);
- * expect(foo.not).toHaveBeenCalled();
- * expect(foo.not).toHaveBeenCalledWith(true);
- *
- * @constructor
- * @see spyOn, jasmine.createSpy, jasmine.createSpyObj
- * @param {String} name
- */
jasmine.Spy = function(name) {
- /**
- * The name of the spy, if provided.
- */
this.identity = name || 'unknown';
- /**
- * Is this Object a spy?
- */
this.isSpy = true;
- /**
- * The actual function this spy stubs.
- */
this.plan = function() {
};
- /**
- * Tracking of the most recent call to the spy.
- * @example
- * var mySpy = jasmine.createSpy('foo');
- * mySpy(1, 2);
- * mySpy.mostRecentCall.args = [1, 2];
- */
this.mostRecentCall = {};
- /**
- * Holds arguments for each call to the spy, indexed by call count
- * @example
- * var mySpy = jasmine.createSpy('foo');
- * mySpy(1, 2);
- * mySpy(7, 8);
- * mySpy.mostRecentCall.args = [7, 8];
- * mySpy.argsForCall[0] = [1, 2];
- * mySpy.argsForCall[1] = [7, 8];
- */
this.argsForCall = [];
this.calls = [];
};
-/**
- * Tells a spy to call through to the actual implemenatation.
- *
- * @example
- * var foo = {
- * bar: function() { // do some stuff }
- * }
- *
- * // defining a spy on an existing property: foo.bar
- * spyOn(foo, 'bar').andCallThrough();
- */
jasmine.Spy.prototype.andCallThrough = function() {
this.plan = this.originalValue;
return this;
};
-/**
- * For setting the return value of a spy.
- *
- * @example
- * // defining a spy from scratch: foo() returns 'baz'
- * var foo = jasmine.createSpy('spy on foo').andReturn('baz');
- *
- * // defining a spy on an existing property: foo.bar() returns 'baz'
- * spyOn(foo, 'bar').andReturn('baz');
- *
- * @param {Object} value
- */
jasmine.Spy.prototype.andReturn = function(value) {
this.plan = function() {
return value;
@@ -259,18 +84,6 @@ jasmine.Spy.prototype.andReturn = function(value) {
return this;
};
-/**
- * For throwing an exception when a spy is called.
- *
- * @example
- * // defining a spy from scratch: foo() throws an exception w/ message 'ouch'
- * var foo = jasmine.createSpy('spy on foo').andThrow('baz');
- *
- * // defining a spy on an existing property: foo.bar() throws an exception w/ message 'ouch'
- * spyOn(foo, 'bar').andThrow('baz');
- *
- * @param {String} exceptionMsg
- */
jasmine.Spy.prototype.andThrow = function(exceptionMsg) {
this.plan = function() {
throw exceptionMsg;
@@ -278,40 +91,11 @@ jasmine.Spy.prototype.andThrow = function(exceptionMsg) {
return this;
};
-/**
- * Calls an alternate implementation when a spy is called.
- *
- * @example
- * var baz = function() {
- * // do some stuff, return something
- * }
- * // defining a spy from scratch: foo() calls the function baz
- * var foo = jasmine.createSpy('spy on foo').andCall(baz);
- *
- * // defining a spy on an existing property: foo.bar() calls an anonymnous function
- * spyOn(foo, 'bar').andCall(function() { return 'baz';} );
- *
- * @param {Function} fakeFunc
- */
jasmine.Spy.prototype.andCallFake = function(fakeFunc) {
this.plan = fakeFunc;
return this;
};
-/**
- * Resets all of a spy's the tracking variables so that it can be used again.
- *
- * @example
- * spyOn(foo, 'bar');
- *
- * foo.bar();
- *
- * expect(foo.bar.callCount).toEqual(1);
- *
- * foo.bar.reset();
- *
- * expect(foo.bar.callCount).toEqual(0);
- */
jasmine.Spy.prototype.reset = function() {
this.wasCalled = false;
this.callCount = 0;
@@ -344,23 +128,10 @@ jasmine.createSpy = function(name) {
return spyObj;
};
-/**
- * Determines whether an object is a spy.
- *
- * @param {jasmine.Spy|Object} putativeSpy
- * @returns {Boolean}
- */
jasmine.isSpy = function(putativeSpy) {
return putativeSpy && putativeSpy.isSpy;
};
-/**
- * Creates a more complicated spy: an Object that has every property a function that is a spy. Used for stubbing something
- * large in one call.
- *
- * @param {String} baseName name of spy class
- * @param {Array} methodNames array of names of methods to make spies
- */
jasmine.createSpyObj = function(baseName, methodNames) {
if (!jasmine.isArray_(methodNames) || methodNames.length === 0) {
throw new Error('createSpyObj requires a non-empty array of method names to create spies for');

1 comment on commit 6feb124

Please sign in to comment.
Something went wrong with that request. Please try again.