[OLINGO-408] add comment for test code
diff --git a/datajs/src/lib/cache.js b/datajs/src/lib/cache.js
index b6a07eb..68c571c 100644
--- a/datajs/src/lib/cache.js
+++ b/datajs/src/lib/cache.js
@@ -43,16 +43,12 @@
var sliceJsonValueArray = utils.sliceJsonValueArray;
var concatJsonValueArray = utils.concatJsonValueArray;
-// EXPORTS
-
/** estimateSize (see {@link estimateSize}) */
exports.estimateSize = estimateSize;
/** createDataCache */
exports.createDataCache = createDataCache;
-
-
/** Appends a page's data to the operation data.
* @param {Object} operation - Operation with (i)ndex, (c)ount and (d)ata.
* @param {Object} page - Page with (i)ndex, (c)ount and (d)ata.
@@ -382,7 +378,7 @@
}
/** Fires a resolved notification as necessary.
- * @method DataCacheOperation.fireResolved
+ * @method DataCacheOperation#fireResolved
*/
DataCacheOperation.prototype.fireResolved = function () {
@@ -395,7 +391,7 @@
};
/** Fires a rejected notification as necessary.
- * @method DataCacheOperation.fireRejected
+ * @method DataCacheOperation#fireRejected
*/
DataCacheOperation.prototype.fireRejected = function (reason) {
@@ -408,7 +404,7 @@
};
/** Fires a canceled notification as necessary.
- * @method DataCacheOperation.fireCanceled
+ * @method DataCacheOperation#fireCanceled
*/
DataCacheOperation.prototype.fireCanceled = function () {
@@ -1440,25 +1436,3 @@
};
-
-
-
-/** @class */
-function Data() {
- /**
- * @type {object}
- * @property {number} y This will show up as a property of `Data#point`,
- * but you cannot link to the property as {@link Data#point.y}.
- */
- this.point = {
- /**
- * The @alias and @memberof! tags force JSDoc to document the
- * property as `point.x` (rather than `x`) and to be a member of
- * `Data#`. You can link to the property as {@link Data#point.x}.
- * @alias point.x
- * @memberof! Data#
- */
- x: 0,
- y: 1
- };
-}
\ No newline at end of file
diff --git a/datajs/src/lib/cache/source.js b/datajs/src/lib/cache/source.js
index 96c6d9e..34780ff 100644
--- a/datajs/src/lib/cache/source.js
+++ b/datajs/src/lib/cache/source.js
@@ -17,7 +17,7 @@
* under the License.
*/
- /** @module cache_source */
+ /** @module cache/source */
var utils = require("./../datajs.js").utils;
var odataRequest = require("./../odata.js");
@@ -25,24 +25,25 @@
var parseInt10 = utils.parseInt10;
var normalizeURICase = utils.normalizeURICase;
+/** ODataCacheSource (see {@link ODataCacheSource}) */
+exports.ODataCacheSource = ODataCacheSource;
+
/** Appends the specified escaped query option to the specified URI.
* @param {String} uri - URI to append option to.
* @param {String} queryOption - Escaped query option to append.
*/
-var appendQueryOption = function (uri, queryOption) {
+function appendQueryOption(uri, queryOption) {
var separator = (uri.indexOf("?") >= 0) ? "&" : "?";
return uri + separator + queryOption;
-};
+}
/** Appends the specified segment to the given URI.
* @param {String} uri - URI to append a segment to.
* @param {String} segment - Segment to append.
* @returns {String} The original URI with a new segment appended.
*/
-var appendSegment = function (uri, segment) {
-
-
+function appendSegment(uri, segment) {
var index = uri.indexOf("?");
var queryPortion = "";
if (index >= 0) {
@@ -54,14 +55,13 @@
uri += "/";
}
return uri + segment + queryPortion;
-};
+}
/** Builds a request object to GET the specified URI.
* @param {String} uri - URI for request.
* @param {Object} options - Additional options.
*/
-var buildODataRequest = function (uri, options) {
-
+function buildODataRequest(uri, options) {
return {
method: "GET",
requestUri: uri,
@@ -71,14 +71,14 @@
callbackParameterName: options.callbackParameterName,
formatQueryString: options.formatQueryString
};
-};
+}
/** Finds the index where the value of a query option starts.
* @param {String} uri - URI to search in.
* @param {String} name - Name to look for.
* @returns {Number} The index where the query option starts.
*/
-var findQueryOptionStart = function (uri, name) {
+function findQueryOptionStart(uri, name) {
var result = -1;
var queryIndex = uri.indexOf("?");
if (queryIndex !== -1) {
@@ -91,7 +91,7 @@
}
}
return result;
-};
+}
/** Gets data from an OData service.
* @param {String} uri - URI to the OData service.
@@ -100,10 +100,10 @@
* @param {Function} error - Error callback.
* @returns {Object} Object with an abort method.
*/
-var queryForData = function (uri, options, success, error) {
+function queryForData (uri, options, success, error) {
var request = queryForDataInternal(uri, options, {}, success, error);
return request;
-};
+}
/** Gets data from an OData service taking into consideration server side paging.
* @param {String} uri - URI to the OData service.
@@ -113,7 +113,7 @@
* @param {Function} error - Error callback.
* @returns {Object} Object with an abort method.
*/
-var queryForDataInternal = function (uri, options, data, success, error) {
+function queryForDataInternal(uri, options, data, success, error) {
var request = buildODataRequest(uri, options);
var currentRequest = odataRequest.request(request, function (newData) {
@@ -149,13 +149,14 @@
currentRequest.abort();
}
};
-};
+}
/** Creates a data cache source object for requesting data from an OData service.
+ * @class ODataCacheSource
* @param options - Options for the cache data source.
* @returns {ODataCacheSource} A new data cache source instance.
*/
-var ODataCacheSource = function (options) {
+function ODataCacheSource (options) {
var that = this;
var uri = options.source;
@@ -163,6 +164,7 @@
that.options = options;
/** Gets the number of items in the collection.
+ * @method ODataCacheSource#count
* @param {Function} success - Success callback with the item count.
* @param {Function} error - Error callback.
* @returns {Object} Request object with an abort method.
@@ -183,11 +185,12 @@
};
/** Gets a number of consecutive items from the collection.
+ * @method ODataCacheSource#read
* @param {Number} index - Zero-based index of the items to retrieve.
* @param {Number} count - Number of items to retrieve.
* @param {Function} success - Success callback with the requested items.
* @param {Function} error - Error callback.
- * @returns {Object} Request object with an abort method./<param>
+ * @returns {Object} Request object with an abort method.
*/
that.read = function (index, count, success, error) {
@@ -196,6 +199,6 @@
};
return that;
-};
+}
-exports.ODataCacheSource = ODataCacheSource;
+
diff --git a/datajs/src/lib/datajs/deferred.js b/datajs/src/lib/datajs/deferred.js
index 513958d..3b74b94 100644
--- a/datajs/src/lib/datajs/deferred.js
+++ b/datajs/src/lib/datajs/deferred.js
@@ -17,21 +17,29 @@
* under the License.
*/
+/** @module datajs/deferred */
+
+/** createDeferred (see {@link createDeferred}) */
+exports.createDeferred = createDeferred;
+/** DjsDeferred (see {@link DjsDeferred}) */
+exports.DjsDeferred = DjsDeferred;
+
/** Creates a new function to forward a call.
* @param {Object} thisValue - Value to use as the 'this' object.
* @param {String} name - Name of function to forward to.
* @param {Object} returnValue - Return value for the forward call (helps keep identity when chaining calls).
* @returns {Function} A new function that will forward a call.
*/
-var forwardCall = function (thisValue, name, returnValue) {
+function forwardCall(thisValue, name, returnValue) {
return function () {
thisValue[name].apply(thisValue, arguments);
return returnValue;
};
-};
+}
/** Initializes a new DjsDeferred object.
- * Compability Note A - Ordering of callbacks through chained 'then' invocations
+ * <ul>
+ * <li> Compability Note A - Ordering of callbacks through chained 'then' invocations <br>
*
* The Wiki entry at http://wiki.commonjs.org/wiki/Promises/A
* implies that .then() returns a distinct object.
@@ -41,8 +49,8 @@
* the jQuery version will fire callbacks in registration
* order regardless of whether they occur on the result
* or the original object.
- *
- * Compability Note B - Fulfillment value
+ * </li>
+ * <li>Compability Note B - Fulfillment value <br>
*
* The Wiki entry at http://wiki.commonjs.org/wiki/Promises/A
* implies that the result of a success callback is the
@@ -51,6 +59,8 @@
*
* For compatibility with http://api.jquery.com/category/deferred-object/
* we disregard this value instead.
+ * </li></ul>
+ * @class DjsDeferred
*/
var DjsDeferred = function () {
this._arguments = undefined;
@@ -64,9 +74,10 @@
DjsDeferred.prototype = {
/** Adds success and error callbacks for this deferred object.
+ * See Compatibility Note A.
+ * @method DjsDeferred#then
* @param {function} [fulfilledHandler] - Success callback ( may be null)
* @param {function} [errorHandler] - Error callback ( may be null)
- * See Compatibility Note A.
*/
then: function (fulfilledHandler, errorHandler) {
@@ -101,8 +112,9 @@
return this;
},
- /** Invokes success callbacks for this deferred object.
- *All arguments are forwarded to success callbacks.
+ /** Invokes success callbacks for this deferred object.
+ * All arguments are forwarded to success callbacks.
+ * @method DjsDeferred#resolve
*/
resolve: function (/* args */) {
if (this._done) {
@@ -128,6 +140,7 @@
/** Invokes error callbacks for this deferred object.
* All arguments are forwarded to error callbacks.
+ * @method DjsDeferred#reject
*/
reject: function (/* args */) {
@@ -147,8 +160,10 @@
},
/** Returns a version of this object that has only the read-only methods available.
+ * @method DjsDeferred#promise
* @returns An object with only the promise object.
*/
+
promise: function () {
var result = {};
result.then = forwardCall(this, "then", result);
@@ -159,9 +174,7 @@
/** Creates a deferred object.
* @returns {DjsDeferred} A new deferred object. If jQuery is installed, then a jQueryDeferred object is returned, which provides a superset of features.
*/
-var createDeferred = function () {
-
-
+function createDeferred() {
if (window.jQuery && window.jQuery.Deferred) {
return new window.jQuery.Deferred();
} else {
@@ -169,6 +182,5 @@
}
};
-exports.createDeferred = createDeferred;
-exports.DjsDeferred = DjsDeferred;
+
diff --git a/datajs/tests/cache-tests.js b/datajs/tests/cache-tests.js
index d4c345c..dc9fa4e 100644
--- a/datajs/tests/cache-tests.js
+++ b/datajs/tests/cache-tests.js
@@ -619,9 +619,10 @@
};
var removeSafariExceptionProperties = function (err) {
- /// <summary>Removes Safari-specific properties from an exception object</summary>
- /// <params name="err" type="Exception">The exception object to operate on</param>
- /// <returns type="Exception">The original exception object with the Safari-specific properties removed</returns>
+ /** Removes Safari-specific properties from an exception object
+ * @param {Exception} err -The exception object to operate on
+ * @returns {Exception} The original exception object with the Safari-specific properties removed
+ */
var safariProperties = ["line", "expressionBeginOffset", "expressionEndOffset", "sourceId", "sourceURL"];
var result = {};
diff --git a/datajs/tests/common/CacheOracle.js b/datajs/tests/common/CacheOracle.js
index b7286d0..d34d79f 100644
--- a/datajs/tests/common/CacheOracle.js
+++ b/datajs/tests/common/CacheOracle.js
@@ -24,11 +24,12 @@
(function (window, undefined) {
var CacheOracle = function (baseUri, pageSize, total, cacheSize) {
- /// <summary>Creates a new CacheOracle</summary>
- /// <param name="baseUri" type="String">The base URI of the collection</param>
- /// <param name="pageSize" type="Integer">The page size used in the cache</param>
- /// <param name="total" type="Integer">The total number of items in the collection</param>
- /// <param name="cacheSize" type="Integer">Cache size in bytes</param>
+ /** Creates a new CacheOracle
+ * @param {String} baseUri - The base URI of the collection
+ * @param {Integer} pageSize - The page size used in the cache
+ * @param {Integer} total - The total number of items in the collection
+ * @param {Integer} cacheSize - Cache size in bytes
+ */
this.baseUri = baseUri;
this.pageSize = pageSize;
this.total = total;
@@ -49,9 +50,10 @@
};
CacheOracle.isMechanismAvailable = function (mechanism) {
- /// <summary>Determines if the specified local storage mechanism is available</summary>
- /// <param name="mechanism">The name of the mechanism</param>
- /// <returns>Whether the mechanism is available</returns>
+ /** Determines if the specified local storage mechanism is available
+ * @param mechanism - The name of the mechanism
+ * @returns Whether the mechanism is available
+ */
switch (mechanism) {
case CacheOracle.mechanisms.indexeddb:
if (window.msIndexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.indexedDB) {
@@ -79,7 +81,8 @@
}
CacheOracle.prototype.clear = function () {
- /// <summary>Clears the cache in the oracle</summary>
+ /** Clears the cache in the oracle
+ */
this.cachedPages = [];
this.actualSize = 0;
this.actualCount = 0;
@@ -87,28 +90,31 @@
}
CacheOracle.prototype.verifyRequests = function (requests, responses, index, count, description, backwards, isPrefetch) {
- /// <summary>Verifies the HTTP requests for a single data request, and updates the oracle with cached pages</summary>
- /// <param name="requests" type="Array">The sequence of request objects (from OData.defaultHttpClient)</param>
- /// <param name="responses" type="Array">The sequence of response objects (from OData.defaultHttpClient)</param>
- /// <param name="index" type="Integer">The starting index of the read</param>
- /// <param name="count" type="Integer">The count of items in the read</param>
- /// <param name="description" type="String">The description of the requests being verified</param>
- /// <param name="backwards" type="Boolean">Whether or not filterBack is being verified</param>
- /// <param name="isPrefetch" type="Boolean">Whether the requests being verified come from the prefetcher</param>
+ /** Verifies the HTTP requests for a single data request, and updates the oracle with cached pages
+ * @param {Array} requests - The sequence of request objects (from OData.defaultHttpClient)
+ * @param {Array} responses - The sequence of response objects (from OData.defaultHttpClient)
+ * @param {Integer} index - The starting index of the read
+ * @param {Integer} count - The count of items in the read
+ * @param {String} description - The description of the requests being verified
+ * @param {Boolean} backwards - Whether or not filterBack is being verified
+ * @param {Boolean} isPrefetch - Whether the requests being verified come from the prefetcher
+ */
var that = this;
index = (index < 0 ? 0 : index);
var pageIndex = function (index) {
- /// <summary>Returns the page index that the given item index belongs to</summary>
- /// <param name="index" type="Integer">The item index</param>
- /// <returns>The page index</returns>
+ /** Returns the page index that the given item index belongs to
+ * @param {Integer} index - The item index
+ * @returns The page index
+ */
return Math.floor(index / that.pageSize);
};
var estimateSize = function (obj) {
- /// <summary>Estimates the size of an object in bytes.</summary>
- /// <param name="obj" type="Object">Object to determine the size of.</param>
- /// <returns type="Number">Estimated size of the object in bytes.</returns>
+ /** Estimates the size of an object in bytes.
+ * @param {Object} obj - Object to determine the size of.
+ * @returns {Number} Estimated size of the object in bytes.
+ */
var size = 0;
var type = typeof obj;
@@ -186,12 +192,13 @@
};
CacheOracle.getExpectedFilterResults = function (data, filterIndex, filterCount, predicate, backwards) {
- /// <summary>Verifies the cache filter returns the correct data</summary>
- /// <param name="collection" type="Array">Array of items in the collection</param>
- /// <param name="filterIndex" type="Integer">The index value</param>
- /// <param name="filterCount" type="Integer">The count value</param>
- /// <param name="predicate" type="Function">Predicate to be applied in filter, takes an item</param>
- /// <param name="backwards" type="Boolean">Whether or not filterBackwards is being verified</param>
+ /** Verifies the cache filter returns the correct data
+ * @param {Array} collection - Array of items in the collection
+ * @param {Integer} filterIndex - The index value
+ * @param {Integer} filterCount - The count value
+ * @param {Function} predicate - Predicate to be applied in filter, takes an item
+ * @param {Boolean} backwards - Whether or not filterBackwards is being verified
+ */
if (!data || !data.value) {
return data;
}
diff --git a/datajs/tests/common/Instrument.js b/datajs/tests/common/Instrument.js
index 84ab4b5..fab583a 100644
--- a/datajs/tests/common/Instrument.js
+++ b/datajs/tests/common/Instrument.js
@@ -24,8 +24,9 @@
var warmedUp = false;
var getBrowserMemorySize = function (success) {
- /// <summary>Gets the memory size (in bytes) of the browser process</summary>
- /// <param name="success" type="Function">The success callback</param>
+ /** Gets the memory size (in bytes) of the browser process
+ * @param {Function} success - The success callback
+ */
var makeRequest = function (success) {
$.get("./common/Instrument.svc/GetBrowserMemorySize", function (data) {
success(parseInt(data));
diff --git a/datajs/tests/common/ODataReadOracle.js b/datajs/tests/common/ODataReadOracle.js
index 450b089..83967ce 100644
--- a/datajs/tests/common/ODataReadOracle.js
+++ b/datajs/tests/common/ODataReadOracle.js
@@ -25,10 +25,11 @@
var universalMime = "*/*";
var readFeed = function (url, success, mimeType, recognizeDates) {
- /// <summary>Calls the ReadFeed endpoint with the specified URL</summary>
- /// <param name="url" type="String">The URL to read the feed from</param>
- /// <param name="success" type="Function">The success callback function</param>
- /// <param name="mimeType" type="String">The MIME media type in the Accept header</param>
+ /** Calls the ReadFeed endpoint with the specified URL
+ * @param {String} url - The URL to read the feed from
+ * @param {Function} success - The success callback function
+ * @param {String} mimeType - The MIME media type in the Accept header
+ */
var readMethod = getReadMethod(mimeType);
oracleRequest("GET", readMethod, typeof url === "string" ? { url: url} : url, mimeType, recognizeDates, function (data) {
success(data);
@@ -36,18 +37,20 @@
};
var readEntry = function (url, success, mimeType, recognizeDates) {
- /// <summary>Calls the ReadEntry endpoint with the specified URL</summary>
- /// <param name="url" type="String">The URL to read the entry from</param>
- /// <param name="success" type="Function">The success callback function</param>
- /// <param name="mimeType" type="String">The MIME media type in the Accept header</param>
+ /** Calls the ReadEntry endpoint with the specified URL
+ * @param {String} url - The URL to read the entry from
+ * @param {Function} success - The success callback function
+ * @param {String} mimeType - The MIME media type in the Accept header
+ */
var readMethod = getReadMethod(mimeType);
oracleRequest("GET", readMethod, typeof url === "string" ? { url: url} : url, mimeType, recognizeDates, success);
};
var readLinksEntry = function (url, success) {
- /// <summary>Calls the ReadMetadata endpoint with the specified URL</summary>
- /// <param name="url" type="String">The URL to read the metadata from</param>
- /// <param name="success" type="Function">The success callback function</param>
+ /** Calls the ReadMetadata endpoint with the specified URL
+ * @param {String} url - The URL to read the metadata from
+ * @param {Function} success - The success callback function
+ */
readJson(
url,
success
@@ -55,9 +58,10 @@
};
var readLinksFeed = function (url, success) {
- /// <summary>Calls the ReadMetadata endpoint with the specified URL</summary>
- /// <param name="url" type="String">The URL to read the metadata from</param>
- /// <param name="success" type="Function">The success callback function</param>
+ /** Calls the ReadMetadata endpoint with the specified URL
+ * @param {String} url - The URL to read the metadata from
+ * @param {Function} success - The success callback function
+ */
readJson(
url,
function (data) {
@@ -67,17 +71,19 @@
};
var readMetadata = function (url, success) {
- /// <summary>Calls the ReadMetadata endpoint with the specified URL</summary>
- /// <param name="url" type="String">The URL to read the metadata from</param>
- /// <param name="success" type="Function">The success callback function</param>
+ /** Calls the ReadMetadata endpoint with the specified URL
+ * @param {String} url - The URL to read the metadata from
+ * @param {Function} success - The success callback function
+ */
oracleRequest("GET", "ReadMetadata", typeof url === "string" ? { url: url} : url, null, null, success);
};
var readServiceDocument = function (url, success, mimeType) {
- /// <summary>Calls the ReadServiceDocument endpoint with the specified URL</summary>
- /// <param name="url" type="String">The URL to the service</param>
- /// <param name="success" type="Function">The success callback function</param>
- /// <param name="mimeType" type="String">The MIME type being tested</param>
+ /** Calls the ReadServiceDocument endpoint with the specified URL
+ * @param {String} url - The URL to the service
+ * @param {Function} success - The success callback function
+ * @param {String} mimeType - The MIME type being tested
+ */
var readMethod = getReadMethod(mimeType);
oracleRequest("GET", readMethod, typeof url === "string" ? { url: url} : url, mimeType, null, success);
};
@@ -142,12 +148,13 @@
};
var oracleRequest = function (method, endpoint, data, mimeType, recognizeDates, success) {
- /// <summary>Requests a JSON object from the oracle service, removing WCF-specific artifacts</summary>
- /// <param name="method" type="String">The HTTP method (GET or POST)</param>
- /// <param name="endpoint" type="String">The oracle endpoint</param>
- /// <param name="data" type="Object">The data to send with the request</param>
- /// <param name="reviver" type="Function">The reviver function to run on each deserialized object</param>
- /// <param name="success" type="Function">Success callback</param>
+ /** Requests a JSON object from the oracle service, removing WCF-specific artifacts
+ * @param {String} method - The HTTP method (GET or POST)
+ * @param {String} endpoint - The oracle endpoint
+ * @param {Object} data - The data to send with the request
+ * @param {Function} reviver - The reviver function to run on each deserialized object
+ * @param {Function} success - Success callback
+ */
var url = "./common/ODataReadOracle.svc/" + endpoint;
if (mimeType) {
data.mimeType = mimeType;
@@ -166,9 +173,10 @@
};
var removeProperty = function (data, property) {
- /// <summary>Removes the specified property recursively from the given object</summary>
- /// <param name="data" type="Object">The object to operate on</param>
- /// <param name="property" type="String">The name of the property to remove</param>
+ /** Removes the specified property recursively from the given object
+ * @param {Object} data - The object to operate on
+ * @param {String} property - The name of the property to remove
+ */
if (typeof data === "object" && data !== null) {
if (data[property]) {
delete data[property];
diff --git a/datajs/tests/common/TestSynchronizerClient.js b/datajs/tests/common/TestSynchronizerClient.js
index 4b0f218..157654e 100644
--- a/datajs/tests/common/TestSynchronizerClient.js
+++ b/datajs/tests/common/TestSynchronizerClient.js
@@ -29,13 +29,14 @@
var maxPostLength = 2097152;
var callTestSynchronizer = function (methodName, parameterUrl) {
- /// <summary>Invokes a function on the test synchronizer.</summary>
- /// <param name="partialUrl" type="String" optional="true">URL to work with.</param>
- /// <returns type="String">A response from the server, possibly null.</returns>
- /// <remarks>
- /// If the recording variable is assigned, then the call is logged
- /// but nothing is invoked.
- /// </remarks>
+ /** Invokes a function on the test synchronizer.
+ * @param {String} [partialUrl] -
+ * @returns {String} A response from the server, possibly null.
+
+ * If the recording variable is assigned, then the call is logged
+ * but nothing is invoked.
+ */
+
var partialUrl;
if (testRunId) {
@@ -76,13 +77,14 @@
};
var getLogPrefix = function (result) {
- /// <summary>Returns the log prefix for a given result</summary>
- /// <param name="result" type="Boolean">Whether the result is pass or fail. If null, the log line is assumed to be diagnostic</param>
+ /** Returns the log prefix for a given result
+ * @param {Boolean} result - Whether the result is pass or fail. If null, the log line is assumed to be diagnostic
+ */
return "[" + getShortDate() + "] " + (result === true ? "[PASS] " : (result === false ? "[FAIL] " : ""));
};
var getShortDate = function () {
- /// <summary>Returns the current date and time formatted as "yyyy-mm-dd hh:mm:ss.nnn".</summary>
+ /** Returns the current date and time formatted as "yyyy-mm-dd hh:mm:ss.nnn".*/
var padToLength = function (number, length) {
var result = number + "";
var lengthDiff = length - result.length;
@@ -112,7 +114,8 @@
};
var postToUrl = function (methodName, body) {
- /// <summary>POSTs body to the designated methodName.</summary>
+ /** POSTs body to the designated methodName.
+ */
var xhr;
if (window.XMLHttpRequest) {
xhr = new window.XMLHttpRequest();
@@ -154,8 +157,9 @@
}
var extractTestRunId = function () {
- /// <summary>Extracts the testRunId value from the window query string.</summary>
- /// <returns type="String">testRunId, possibly empty.</returns>
+ /** Extracts the testRunId value from the window query string.
+ * @returns {String} testRunId, possibly empty.
+ */
var i, len;
var uri = window.location.search;
if (uri) {
@@ -172,9 +176,10 @@
};
var init = function (qunit) {
- /// <summary>Initializes the test logger synchronizer.</summary>
- /// <param name="qunit">Unit testing to hook into.</param>
- /// <remarks>If there is no testRunId present, the QUnit functions are left as they are.</remarks>
+ /** Initializes the test logger synchronizer.
+ * @param qunit - Unit testing to hook into.
+ * If there is no testRunId present, the QUnit functions are left as they are.</remarks>
+ */
var logToConsole = function (context) {
if (window.console && window.console.log) {
window.console.log(context.result + ' :: ' + context.message);
diff --git a/datajs/tests/common/djstest.js b/datajs/tests/common/djstest.js
index 50b180a..90af598 100644
--- a/datajs/tests/common/djstest.js
+++ b/datajs/tests/common/djstest.js
@@ -24,9 +24,10 @@
djstest.indexedDB = window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB || window.indexedDB;
djstest.cleanStoreOnIndexedDb = function (storeObjects, done) {
- /// <summary>Cleans all the test data saved in the IndexedDb database.</summary>
- /// <param name="storeNames" type="Array">Array of store objects with a property that is the name of the store</param>
- /// <param name="done" type="Function">Callback function</param>
+ /** Cleans all the test data saved in the IndexedDb database.
+ * @param {Array} storeNames - Array of store objects with a property that is the name of the store
+ * @param {Function} done - Callback function
+ */
var IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction || {};
@@ -99,22 +100,25 @@
};
djstest.Job = function () {
- /// <summary>Constructs a Job object that allows for enqueuing and synchronizing the execution of functions.</summary>
- /// <returns type="Object">Job object</returns>
+ /** Constructs a Job object that allows for enqueuing and synchronizing the execution of functions.
+ * @returns {Object} Job object
+ */
var currentTask = -1;
var tasks = [];
var failedTasks = 0;
this.queue = function (fn) {
- /// <summary>Adds a function to the job queue regardless if the queue is already executing or not.</summary>
- /// <param name="fn" type="Function">Function to execute.</param>
+ /** Adds a function to the job queue regardless if the queue is already executing or not.
+ * @param {Function} fn - Function to execute.
+ */
tasks.push(fn);
};
this.queueNext = function (fn) {
- /// <summary>Adds a function to the front of the job queue regardless if the queue is already executing or not.</summary>
- /// <param name="fn" type="Function">Function to execute.</param>
+ /** Adds a function to the front of the job queue regardless if the queue is already executing or not.
+ * @param {Function} fn - Function to execute.
+ */
if (currentTask < 0) {
tasks.unshift(fn);
} else {
@@ -123,11 +127,11 @@
};
this.run = function (done) {
- /// <summary>Starts the execution of this job.</summary>
- /// <param name="done" type="Function">Callback invoked when the job has finished executing all of its enqueued tasks.</param>
- /// <remarks>
+ /** Starts the execution of this job.
+ * @param {Function} done - Callback invoked when the job has finished executing all of its enqueued tasks.
+ */
/// This method does nothing if called on a unit of work that is already executing.
- /// </remarks>
+
if (currentTask >= 0) {
return;
@@ -154,7 +158,8 @@
};
var runNextTask = function () {
- /// <summary>Executes the next function in the queue.</summary>
+ /** Executes the next function in the queue.
+ */
defer(function () {
try {
tasks[currentTask](makeTaskDoneCallBack(false), makeTaskDoneCallBack(true));
@@ -170,14 +175,16 @@
};
var defer = function (fn) {
- /// <summary>Defers the execution of an arbitrary function that takes no parameters.</summary>
- /// <param name="fn" type="Function">Function to schedule for later execution.</param>
+ /** Defers the execution of an arbitrary function that takes no parameters.
+ * @param {Function} fn - Function to schedule for later execution.
+ */
setTimeout(fn, 0);
}
var exposeDateValues = function (data) {
- /// <summary>Exposes date values for Date objects to facilitate debugging</summary>
- /// <param name="data" type="Object">The object to operate on</param>
+ /** Exposes date values for Date objects to facilitate debugging
+ * @param {Object} data - The object to operate on
+ */
if (typeof data === "object") {
if (data instanceof Date) {
data["__date__"] = data.toUTCString();
@@ -193,10 +200,10 @@
}
var extractFunctionName = function (text) {
- /// <summary>Determines the name of a function.</summary>
- /// <param name="text" type="String">Function text.</param>
- /// <returns type="String">The name of the function from text if found; the original text otherwise.</returns>
-
+ /** Determines the name of a function.
+ * @param {String} text - Function text.
+ * @returns {String} The name of the function from text if found; the original text otherwise.
+ */
var index = text.indexOf("function ");
if (index < 0) {
return text;
@@ -217,9 +224,9 @@
};
var removeMetadata = function (data) {
- /// <summary>Removes metadata annotations from the specified object.</summary>
- /// <param name="data">Object to remove metadata from; possibly null.</param>
-
+ /** Removes metadata annotations from the specified object.
+ * @param data - Object to remove metadata from; possibly null.
+ */
if (typeof data === "object" && data !== null) {
delete data["__metadata"];
for (prop in data) {
@@ -229,8 +236,9 @@
};
djstest.addFullTest = function (disable, fn, name, arg, timeout) {
- /// <summary>Add the unit test cases</summary>
- /// <param name="disable">Indicate whether this test case should be disabled</param>
+ /** Add the unit test cases
+ * @param disable - Indicate whether this test case should be disabled
+ */
if (disable != true) {
djstest.addTest(fn, name, arg, timeout);
}
@@ -254,19 +262,22 @@
};
djstest.assert = function (test, message) {
- /// <summary>Asserts that a condition is true.</summary>
- /// <param name="test" type="Boolean">Condition to test.</param>
- /// <param name="message" type="String">Text message for condition being tested.</param>
+ /** Asserts that a condition is true.
+ * @param {Boolean} test - Condition to test.
+ * @param {String} message - Text message for condition being tested.
+ */
QUnit.ok(test, message);
};
djstest.assertAreEqual = function (actual, expected, message) {
- /// <summary>Asserts that the values of the expected and actualobjects are equal.</summary>
+ /** Asserts that the values of the expected and actualobjects are equal.
+ */
QUnit.equal(actual, expected, message);
};
djstest.assertAreEqualDeep = function (actual, expected, message) {
- /// <summary>Asserts that the actual and expected objects are the same.</summary>
+ /** Asserts that the actual and expected objects are the same.
+ */
QUnit.deepEqual(exposeDateValues(actual), exposeDateValues(expected), message);
};
@@ -277,11 +288,12 @@
};
djstest.asyncDo = function (asyncActions, done) {
- /// <summary>Calls each async action in asyncActions, passing each action a function which keeps a count and
- /// calls the passed done function when all async actions complete.</summary>
- /// <param name="asyncActions" type="Array">Array of asynchronous actions to be executed,
- /// each taking a single parameter - the callback function to call when the action is done.</param>
- /// <param name="done" type="Function">Function to be executed in the last async action to complete.</param>
+ /** Calls each async action in asyncActions, passing each action a function which keeps a count and
+ * calls the passed done function when all async actions complete
+ * @param {Array} asyncActions -Array of asynchronous actions to be executed,
+ * each taking a single parameter - the callback function to call when the action is done.</param>
+ * @param {Function} done - Function to be executed in the last async action to complete.
+ */
var count = 0;
var doneOne = function () {
count++;
@@ -300,13 +312,15 @@
}
djstest.clone = function (object) {
- /// <summary>Makes a deep copy of an object.</summary>
+ /** Makes a deep copy of an object.
+ */
return $.extend(true, {}, object);
};
djstest.destroyCacheAndDone = function (cache) {
- /// <summary>Destroys the cache and then completes the test</summary>
- /// <param name="cache">The cache to destroy</param>
+ /** Destroys the cache and then completes the test
+ * @param cache - The cache to destroy
+ */
cache.clear().then(function () {
djstest.done();
}, function (err) {
@@ -316,12 +330,14 @@
};
djstest.done = function () {
- /// <summary>Indicates that the currently running test has finished.</summary>
+ /** Indicates that the currently running test has finished.
+ */
QUnit.start();
};
djstest.expectException = function (testFunction, message) {
- /// <summary>Test passes if and only if an exception is thrown.</summary>
+ /** Test passes if and only if an exception is thrown.
+ */
try {
testFunction();
djstest.fail("Expected exception but function succeeded: " + " " + message);
@@ -333,23 +349,25 @@
};
djstest.assertsExpected = function (asserts) {
- /// <summary>Indicates the expected number of asserts, fails test if number is not met.</summary>
- /// <param name="asserts" type="Number">Number of asserts expected in test.</param>
+ /** Indicates the expected number of asserts, fails test if number is not met.
+ * @param {Number} asserts - Number of asserts expected in test.
+ */
expect(asserts);
}
djstest.fail = function (message) {
- /// <summary>Marks the current test as failed.</summary>
- /// <param name="message" type="String">Failure message.</param>
+ /** Marks the current test as failed.
+ * @param {String} message - Failure message.
+ */
QUnit.ok(false, message);
};
djstest.failAndDoneCallback = function (message, cleanupCallback) {
- /// <summary>Returns a function that when invoked will fail this test and be done with it.</summary>
- /// <param name="message" type="String">Failure message.</param>
- /// <param name="cleanupCallback" type="Function" optional="true">Optional cleanup function in case of failure.</param>
- /// <returns type="Function">A new function.</returns>
-
+ /** Returns a function that when invoked will fail this test and be done with it.
+ * @param {String} message - Failure message.
+ * @param {Function} [cleanupCallback] -
+ * @returns {Function} A new function.
+ */
return function (err) {
message = "" + message + (err) ? window.JSON.stringify(err) : "";
djstest.fail(message);
@@ -366,28 +384,32 @@
};
djstest.log = function (message) {
- /// <summary>Logs a test message.</summary>
- /// <param name="message" type="String">Test message.</param>
+ /** Logs a test message.
+ * @param {String} message - Test message.
+ */
var context = { result: true, actual: true, expected: true, message: message };
QUnit.log(context);
};
djstest.pass = function (message) {
- /// <summary>Marks the current test as failed.</summary>
- /// <param name="message" type="String">Failure message.</param>
+ /** Marks the current test as failed.
+ * @param {String} message - Failure message.
+ */
QUnit.ok(true, message);
};
djstest.toString = function (obj) {
- /// <summary>Dumps the object as a string</summary>
- /// <param name="obj" type="Object">Object to dump</param>
+ /** Dumps the object as a string
+ * @param {Object} obj - Object to dump
+ */
return QUnit.jsDump.parse(obj);
};
djstest.wait = function (fn) {
- /// <summary>Executes the function, pausing test execution until the callback is called</summary>
- /// <param name="fn" type="Function">Function to execute; takes one parameter which is the callback</param>
- /// <remarks>This function is typically used in asynchronous setup/teardown methods</remarks>
+ /** Executes the function, pausing test execution until the callback is called
+ * @param {Function} fn - Function to execute; takes one parameter which is the callback
+ * This function is typically used in asynchronous setup/teardown methods</remarks>
+ */
QUnit.stop();
fn(function () {
QUnit.start();
diff --git a/datajs/tests/common/mockHttpClient.js b/datajs/tests/common/mockHttpClient.js
index d1380f6..20396e4 100644
--- a/datajs/tests/common/mockHttpClient.js
+++ b/datajs/tests/common/mockHttpClient.js
@@ -64,8 +64,9 @@
httpClient.async = false;
httpClient.clear = function () {
- /// <summary>Clears all registered responses and verifiers.</summary>
- /// <returns>this client.</returns>
+ /** Clears all registered responses and verifiers.
+ * @returns this client
+ */
responses = {};
requestVerifiers = {};
this.async = false;
diff --git a/datajs/tests/common/mockXMLHttpRequest.js b/datajs/tests/common/mockXMLHttpRequest.js
index 60497d7..fdd6026 100644
--- a/datajs/tests/common/mockXMLHttpRequest.js
+++ b/datajs/tests/common/mockXMLHttpRequest.js
@@ -41,9 +41,10 @@
var verifiers = {};
mockXMLHttpRequest.addResponse = function (uri, response) {
- /// <summary>Adds a new response to be returned for the specified uri (* for 'anything').</summary>
- /// <param name="uri" type="String">URI to match (* to match anything not otherwise specified).</param>
- /// <param name="response" type="Object">Response object.</param>
+ /** Adds a new response to be returned for the specified uri (* for 'anything').
+ * @param {String} uri - URI to match (* to match anything not otherwise specified).
+ * @param {Object} response - Response object.
+ */
responses = responses || {};
responses[uri] = response;
@@ -51,10 +52,10 @@
};
mockXMLHttpRequest.addRequestVerifier = function (uri, verifier) {
- /// <summary>Adds a new request verifier to be invoked for the specified uri (* for 'anything').</summary>
- /// <param name="uri" type="String">URI to match (* to match anything not otherwise specified).</param>
- /// <param name="response" type="Function">Verifier callback that takes the request.</param>
-
+ /** Adds a new request verifier to be invoked for the specified uri (* for 'anything').
+ * @param {String} uri - URI to match (* to match anything not otherwise specified).
+ * @param {Function} response - Verifier callback that takes the request.
+ */
verifiers = verifiers || {};
verifiers[uri] = verifier;
@@ -62,7 +63,8 @@
};
mockXMLHttpRequest.reset = function () {
- /// <summary>Resets all configuration from the mock XHR object.</summary>
+ /** Resets all configuration from the mock XHR object.
+ */
responses = {};
verifiers = {};
diff --git a/datajs/tests/datajs-cache-large-collection-functional-tests.js b/datajs/tests/datajs-cache-large-collection-functional-tests.js
index 2788974..d3c9a87 100644
--- a/datajs/tests/datajs-cache-large-collection-functional-tests.js
+++ b/datajs/tests/datajs-cache-large-collection-functional-tests.js
@@ -23,9 +23,10 @@
var itemsInCollection = 2 * 1024 * 1024;
var cleanDomStorage = function (done) {
- /// <summary>Cleans all the data saved in the browser's DOM Storage. Needs to be called asynchronously in the
- /// setup and teardown methods to be consistent with indexedDb's cleanup method.</summary>
- /// <param name="done" type="Function">Function to be called after DOM storage is cleared.</param>
+ /* Cleans all the data saved in the browser's DOM Storage. Needs to be called asynchronously in the
+ * setup and teardown methods to be consistent with indexedDb's cleanup method.
+ * @param {Function} done - Function to be called after DOM storage is cleared.
+ */
if (window.localStorage) {
window.localStorage.clear();
}
@@ -33,8 +34,9 @@
};
var cleanIndexedDb = function (done) {
- /// <summary>Cleans all the data saved in the browser's IndexedDb Storage.</summary>
- /// <param name="done" type="Function">Function to be called after DOM storage is cleared.</param>
+ /** Cleans all the data saved in the browser's IndexedDb Storage.
+ * @param {Function} done - Function to be called after DOM storage is cleared.
+ */
var caches = this.caches;
djstest.cleanStoreOnIndexedDb(caches, done);
@@ -52,8 +54,9 @@
};
var cleanupAllStorage = function(done) {
- /// <summary>Cleans up all available storage mechanisms in the browser.</summary>
- /// <param name="done" type="Function">Function to be called by each cleanup function after storage is cleared.</param>
+ /** Cleans up all available storage mechanisms in the browser.
+ * @param {Function} done - Function to be called by each cleanup function after storage is cleared.
+ */
var that = this;
var storeCleanup = [];
diff --git a/datajs/tests/datajs-cache-long-haul-tests.html b/datajs/tests/datajs-cache-long-haul-tests.html
index 5455a89..46b50be 100644
--- a/datajs/tests/datajs-cache-long-haul-tests.html
+++ b/datajs/tests/datajs-cache-long-haul-tests.html
@@ -89,10 +89,10 @@
};
var callReadRangeRepeatedly = function (index, count, done) {
- /// <summary>Calls readRange over the whole collection and done when all items have been read.</summary>
- /// <param name="index" type="Integer">Index to start the read.</param>
- /// <param name="count" type="String">The count of each readRange.</param>
- /// <param name="done" type="Function">Function to be called when all items in collection have been read.</param>
+ /** Calls readRange over the whole collection and done when all items have been read.
+ * @param {Integer} index - Index to start the read.
+ * @param {String} count - The count of each readRange.
+ * @param {Function} done - Function to be called when all items in collection have been read.
var cacheRead = function () {
cache.readRange(index, count).then(function () {
if (index < itemsInCollection) {
diff --git a/datajs/tests/odata-cache-filter-functional-tests.js b/datajs/tests/odata-cache-filter-functional-tests.js
index 4e2f950..c1775cf 100644
--- a/datajs/tests/odata-cache-filter-functional-tests.js
+++ b/datajs/tests/odata-cache-filter-functional-tests.js
@@ -143,15 +143,16 @@
};
var validateFilterResultsAndRequests = function (feed, cache, index, count, predicate, finished, backwards, session, cacheOracle) {
- /// <summary>Runs filter and validates the results and network requests</summary>
- /// <param name="feed" type="Object">The feed being read from</param>
- /// <param name="cache" type="Object">The cache to perform the filter on</param>
- /// <param name="index" type="Integer">The index value</param>
- /// <param name="count" type="Integer">The count value</param>
- /// <param name="predicate" type="Object">Filter string to append to the feed to validate the predicate</param>
- /// <param name="finished" type="Function">Callback function called after data is verified</param>
- /// <param name="session" type="Object">Session object to validate the network requests</param>
- /// <param name="cacheOracle" type="Object">cacheOracle object to validate the network requests</param>
+ /** Runs filter and validates the results and network requests
+ * @param {Object} feed - The feed being read from
+ * @param {Object} cache - The cache to perform the filter on
+ * @param {Integer} index - The index value
+ * @param {Integer} count - The count value
+ * @param {Object} predicate - Filter string to append to the feed to validate the predicate
+ * @param {Function} finished - Callback function called after data is verified
+ * @param {Object} session - Session object to validate the network requests
+ * @param {Object} cacheOracle - cacheOracle object to validate the network requests
+ */
if (count < 0) {
count = itemsInCollection;
diff --git a/datajs/tests/odata-cache-fperf-tests.js b/datajs/tests/odata-cache-fperf-tests.js
index cfb0943..47abbca 100644
--- a/datajs/tests/odata-cache-fperf-tests.js
+++ b/datajs/tests/odata-cache-fperf-tests.js
@@ -43,19 +43,18 @@
});
var cacheReadRangeWallClockTest = function (totalReads, interval, mechanism, source, pageSize, prefetchSize, generateRange, threshold) {
- /// <summary>Cache readRange wall-clock test</summary>
- /// <remarks>
- /// The average time computed by the wall-clock test does *not* include the initial readRange
- /// </remarks>
- /// <param name="totalReads">Number of reads to collect data from</param>
- /// <param name="interval">Interval (milliseconds) between reads</param>
- /// <param name="mechanism">The cache store mechanism</param>
- /// <param name="source">The feed source</param>
- /// <param name="pageSize">The page size</param>
- /// <param name="prefetchSize">The prefetch size</param>
- /// <param name="generateRange">The range generator function: given the read index, returns the readRange index and count</param>
- /// <param name="threshold">The average read time threshold for test to pass; if not specified, defaults to the slowHttpClient latency</param>
- /// <returns>The test function</param>
+ /** Cache readRange wall-clock test
+ * The average time computed by the wall-clock test does *not* include the initial readRange
+ * @param totalReads - Number of reads to collect data from
+ * @param interval - Interval (milliseconds) between reads
+ * @param mechanism - The cache store mechanism
+ * @param source - The feed source
+ * @param pageSize - The page size
+ * @param prefetchSize - The prefetch size
+ * @param generateRange - The range generator function: given the read index, returns the readRange index and count
+ * @param threshold - The average read time threshold for test to pass; if not specified, defaults to the slowHttpClient latency
+ * @returns The test function
+ */
return function () {
var cache = datajs.cache.createDataCache({ name: "cache" + new Date().valueOf(), source: source, pageSize: pageSize, prefetchSize: prefetchSize });
var totalTime = 0;
diff --git a/datajs/tests/odata-cache-functional-tests.js b/datajs/tests/odata-cache-functional-tests.js
index 9cc8747..331da08 100644
--- a/datajs/tests/odata-cache-functional-tests.js
+++ b/datajs/tests/odata-cache-functional-tests.js
@@ -139,13 +139,14 @@
};
var validateExpectedRange = function (cache, data, source, skipValue, takeValue, finished) {
- /// <summary>Validates the data returned by readRange</summary>
- /// <param name="cache" type="Object">The cache object</param>
- /// <param name="data" type="Object">The data returned by the cache</param>
- /// <param name="source" type="Object">The base URI of the feed, or the custom data source</param>
- /// <param name="skipValue type="Integer">The skip value</param>
- /// <param name="takeValue" type="Integer">The take value</param>
- /// <param name="finished" type="Function">Callback function called after data is verified</param>
+ /** Validates the data returned by readRange
+ * @param {Object} cache - The cache object
+ * @param {Object} data - The data returned by the cache
+ * @param {Object} source - The base URI of the feed, or the custom data source
+ * @param {Integer} skipValue - The skip value
+ * @param {Integer} takeValue - The take value
+ * @param {Function} finished - Callback function called after data is verified
+ */
var assertData = function (expectedData) {
djstest.assertAreEqualDeep(data, expectedData, "Verify response data");
finished();
@@ -280,26 +281,29 @@
};
var cleanDomStorage = function (done) {
- /// <summary>Cleans all the data saved in the browser's DOM Storage. Needs to be called asynchronously in the
- /// setup and teardown methods to be consistent with indexedDb's cleanup method.</summary>
- /// <param name="done" type="Function">Function to be called after DOM storage is cleared.</param>
- if (window.localStorage) {
+ /** Cleans all the data saved in the browser's DOM Storage. Needs to be called asynchronously in the
+ * setup and teardown methods to be consistent with indexedDb's cleanup method.
+ * @param {Function} done - Function to be called after DOM storage is cleared.
+ */
+ if (window.localStorage) {
window.localStorage.clear();
}
done();
};
var cleanIndexedDb = function (done) {
- /// <summary>Cleans all the data saved in the browser's IndexedDb Storage.</summary>
- /// <param name="done" type="Function">Function to be called after indexedDb is cleared.</param>
+ /** Cleans all the data saved in the browser's IndexedDb Storage.
+ * @param {Function} done - Function to be called after indexedDb is cleared.
+ */
var caches = this.caches;
djstest.cleanStoreOnIndexedDb(caches, done);
};
var cleanupAllStorage = function (done) {
- /// <summary>Cleans up all available storage mechanisms in the browser.</summary>
- /// <param name="done" type="Function">Function to be called by each cleanup function after storage is cleared.</param>
+ /** Cleans up all available storage mechanisms in the browser.
+ * @param {Function} done - Function to be called by each cleanup function after storage is cleared.
+ */
var that = this;
var storeCleanup = [];
@@ -328,8 +332,9 @@
module("Functional", {
setup: function () {
this.createAndAddCache = function (options) {
- /// <summary>Returns a cache created from the options object and </summary>
- /// <param name="options" type="Object">Object to create a cache from.</param>
+ /** Returns a cache created from the options object and
+ * @param {Object} options - Object to create a cache from.
+ */
var cache = datajs.cache.createDataCache(options);
this.caches.push({ name: options.name, cache: cache });
return cache;
@@ -430,10 +435,11 @@
});
var getInvalidValueErrorMessage = function (invalidValue, parameterName) {
- /// <summary>Returns the expected error message for the specified invalid value.</summary>
- /// <param name="invalidValue type="Object">invalid value (anything other than zero or positive integer) to determine the error message from.</param>
- /// <param name="parameterName" type="String">The name of the parameter being verified.</param>
- /// <returns type="String">Error message expected.</returns>
+ /** Returns the expected error message for the specified invalid value.
+ * @param {Object} invalidValue - invalid value (anything other than zero or positive integer) to determine the error message from.
+ * @param {String} parameterName - The name of the parameter being verified.
+ * @returns {String} Error message expected.
+ */
return (invalidValue === undefined || typeof invalidValue !== "number") ?
"'" + parameterName + "' must be a number." :
"'" + parameterName + "' must be greater than or equal to zero.";
diff --git a/datajs/tests/odata-cache-rx-functional-tests.js b/datajs/tests/odata-cache-rx-functional-tests.js
index 423f94c..9261dfe 100644
--- a/datajs/tests/odata-cache-rx-functional-tests.js
+++ b/datajs/tests/odata-cache-rx-functional-tests.js
@@ -44,10 +44,11 @@
];
var assertObservables = function (actual, expected, done) {
- /// <summary>Asserts two finite observables generate the same sequence</summary>
- /// <param name="actual" type="IObservable">The actual observable</param>
- /// <param name="expected" type="IObservable">The expected observable</param>
- /// <param name="done" type="Function">The callback function when asserts are done</param>
+ /** Asserts two finite observables generate the same sequence
+ * @param {IObservable} actual - The actual observable
+ * @param {IObservable} expected - The expected observable
+ * @param {Function} done - The callback function when asserts are done
+ */
var toArray = function (observable, callback) {
var arr = [];
observable.Subscribe(
diff --git a/datajs/tests/odata-fuzz.html b/datajs/tests/odata-fuzz.html
index 0a02ef5..0887c9f 100644
--- a/datajs/tests/odata-fuzz.html
+++ b/datajs/tests/odata-fuzz.html
@@ -320,9 +320,9 @@
];
var fuzzText = function (text) {
- /// <summary>Fuzzes the specified string.</summary>
- /// <param name="text" type="String">Text to fuzz.</param>
- /// <returns type="String">The fuzzes text.</returns>
+ /** Fuzzes the specified string.
+ * @param {String} text - Text to fuzz.
+ * @returns {String} The fuzzes text.
var location = Math.round(Math.random() * text.length - 1);
var content = randomFromWeighted(fuzzingTextTable);
@@ -477,10 +477,10 @@
var fakeHttpClient = {
request: function (request, success, error) {
- /// <summary>Performs a network request.</summary>
- /// <param name="success" type="Function">Success callback with the response object.</param>
- /// <param name="error" type="Function">Error callback with an error object.</param>
- /// <returns type="Object">Object with an 'abort' method for the operation.</returns>
+ /** Performs a network request.
+ * @param {Function} success - Success callback with the response object.
+ * @param {Function} error - Error callback with an error object.
+ * @returns {Object} Object with an 'abort' method for the operation.
var shouldError = rarely(true, false);
var format = randomFromWeighted(formatTable);
diff --git a/datajs/tests/odata-links-functional-tests.js b/datajs/tests/odata-links-functional-tests.js
index e14616c..9f52357 100644
--- a/datajs/tests/odata-links-functional-tests.js
+++ b/datajs/tests/odata-links-functional-tests.js
@@ -27,11 +27,11 @@
var uriPartNames = ["scheme", "authority", "path", "query", "fragment"];
var getURIInfo = function (uri) {
- /// <summary>Gets information about the components of the specified URI.</summary>
- /// <param name="uri" type="String">URI to get information from.</param>
- /// <returns type="Object">
- /// An object with an isAbsolute flag and part names (scheme, authority, etc.) if available.
- /// </returns>
+ /** Gets information about the components of the specified URI.
+ * @param {String} uri - URI to get information from.
+ * @returns {Object}
+ * An object with an isAbsolute flag and part names (scheme, authority, etc.) if available.
+ */
var result = { isAbsolute: false };
@@ -54,10 +54,11 @@
};
var normalizeURI = function (uri, base) {
- /// <summary>Normalizes a possibly relative URI with a base URI.</summary>
- /// <param name="uri" type="String">URI to normalize, absolute or relative.</param>
- /// <param name="base" type="String" mayBeNull="true">Base URI to compose with.</param>
- /// <returns type="String">The composed URI if relative; the original one if absolute.</returns>
+ /** Normalizes a possibly relative URI with a base URI.
+ * @param {String} uri - URI to normalize, absolute or relative.
+ * @param {String} base - Base URI to compose with (may be null)
+ * @returns {String} The composed URI if relative; the original one if absolute.
+ */
if (!base) {
return uri;
@@ -104,10 +105,11 @@
};
var mergeUriPathWithBase = function (uriInfo, baseInfo) {
- /// <summary>Merges the path of a relative URI and a base URI.</summary>
- /// <param name="uriInfo">URI component information for the relative URI.</param>
- /// <param name="baseInfo">URI component information for the base URI.</param>
- /// <returns type="String">A string with the merged path.</returns>
+ /** Merges the path of a relative URI and a base URI.
+ * @param uriInfo - URI component information for the relative URI.
+ * @param baseInfo - URI component information for the base URI.
+ * @returns {String} A string with the merged path.
+ */
var basePath = "/";
if (baseInfo.path) {
diff --git a/datajs/tests/odata-metadata-awareness-functional-tests.js b/datajs/tests/odata-metadata-awareness-functional-tests.js
index 22ce235..c342271 100644
--- a/datajs/tests/odata-metadata-awareness-functional-tests.js
+++ b/datajs/tests/odata-metadata-awareness-functional-tests.js
@@ -103,7 +103,8 @@
var serviceMetadata;
var getMetadata = function (callback) {
- /// <summary>Common function for tests to get and cache metadata, to reduce network calls made by tests</summary>
+ /** Common function for tests to get and cache metadata, to reduce network calls made by tests
+ */
if (!serviceMetadata) {
OData.read(metadataUri, function (metadata) {
serviceMetadata = metadata;
diff --git a/datajs/tests/odata-read-crossdomain-functional-tests.js b/datajs/tests/odata-read-crossdomain-functional-tests.js
index efd4076..fb90658 100644
--- a/datajs/tests/odata-read-crossdomain-functional-tests.js
+++ b/datajs/tests/odata-read-crossdomain-functional-tests.js
@@ -25,12 +25,13 @@
};
var fixConstructors = function (obj) {
- /// <summary>Fix the constructors of the supplied object graph.</summary>
- /// <remarks>
+ /** Fix the constructors of the supplied object graph.
+ */
+
/// When using IE9 or a non-IE browser, the JSONP support in the library creates objects in a separate IFRAME,
/// causing the constructor property to be different to that of objects created by the oracle. This function
/// stringifies and then re-parses the object, which fixes the constructors.
- /// </remarks>
+
if (!window.ActiveXObject || window.DOMParser) {
return window.JSON.parse(window.JSON.stringify(obj));
} else {
diff --git a/datajs/tests/odata-tests.js b/datajs/tests/odata-tests.js
index 40567e9..689d6c5 100644
--- a/datajs/tests/odata-tests.js
+++ b/datajs/tests/odata-tests.js
@@ -24,8 +24,9 @@
var northwindFeed = northwindService + "Suppliers";
var countIFrames = function () {
- /// <summary>Count the number of IFRAMES in the page</summary>
- /// <returns type="Integer">The number of IFRAMES</returns>
+ /** Count the number of IFRAMES in the page
+ * @returns {Integer} The number of IFRAMES
+ */
return document.getElementsByTagName("IFRAME").length;
}
@@ -34,7 +35,8 @@
var originalEnableJsonpCallback = OData.defaultHttpClient.enableJsonpCallback;
var restoreJsonpCallback = function () {
- /// <summary>Restores OData.defaultHttpClient.enableJsonpCallback to the library default.</summary>
+ /** Restores OData.defaultHttpClient.enableJsonpCallback to the library default.
+ */
OData.defaultHttpClient.enableJsonpCallback = originalEnableJsonpCallback;
};
diff --git a/datajs/tests/store-tests.js b/datajs/tests/store-tests.js
index 4b21ba9..8148ead 100644
--- a/datajs/tests/store-tests.js
+++ b/datajs/tests/store-tests.js
@@ -21,14 +21,16 @@
(function (window, undefined) {
var cleanDomStorage = function () {
- /// <summary>Cleans all the data saved in the browser's DOM Storage.</summary>
+ /** Cleans all the data saved in the browser's DOM Storage.
+ */
if (window.localStorage) {
window.localStorage.clear();
}
};
var cleanMemoryStorage = function () {
- /// <summary>Clean memory storage is a no op.</summary>
+ /** Clean memory storage is a no op.
+ */
};
var cleanIndexedDbStorage = function () {
@@ -43,27 +45,31 @@
};
var canCreateMemoryStore = function () {
- /// <summary>Checks whether memory storage is supported by the browser.</summary>
- /// <returns type="Boolean">True.</summary>
+ /** Checks whether memory storage is supported by the browser.
+ * @returns {boolean} True
+ */
return true;
};
var canCreateDomStore = function () {
- /// <summary>Checks whether Web Storage (DOM Storage) is supported by the browser.</summary>
- /// <returns type="Boolean">True if DOM Storage is supported by the browser; false otherwise.</summary>
+ /** Checks whether Web Storage (DOM Storage) is supported by the browser.
+ * @returns {boolean} True if DOM Storage is supported by the browser; false otherwise.
+ */
return !!window.localStorage;
};
var canCreateIndexedDb = function () {
- /// <summary>Checks whether Web Storage (DOM Storage) is supported by the browser.</summary>
- /// <returns type="Boolean">True if IndexedDB is supported by the browser, false otherwise.</returns>
+ /** Checks whether Web Storage (DOM Storage) is supported by the browser.
+ * @returns {Boolean} True if IndexedDB is supported by the browser, false otherwise.
+ */
return !!djstest.indexedDB;
};
var canCreateStore = function (mechanism) {
- /// <summary>Determines whether a particular mechanism is supported by the browser.</summary>
- /// <param name="mechanism" type="String">Mechanism name.</param>
- /// <returns type="Boolean">True if the mechanism is supported by the browser; otherwise false.</summary>
+ /** Determines whether a particular mechanism is supported by the browser.
+ * @param {String} mechanism - Mechanism name.
+ * @returns {Boolean} True if the mechanism is supported by the browser; otherwise false.
+ */
var implementation = mechanismImplementations[mechanism];
return implementation && implementation.canCreate();
}