Module: alfresco/testing/NodesMockXhr

alfresco/testing/NodesMockXhr

Generic mock XHR that can be configured to support multiple tests' requirements for mock data. This is provided for testing purposes
Since:
  • 1.0.50
Author:
  • Martin Doyle
License:
Source:

Members

_docListRegex :RegExp

Regular expression used to match doclist requests. Currently only works for share clients (i.e. not standalone ones).

NOTE: Uses RegExp object rather than a literal to make it easier to read without lots of escaped slashes!

Type:
  • RegExp
Source:

_nodeRegex :RegExp

Regular expression used to match node requests. Currently only works for share clients (i.e. not standalone ones).

NOTE: Uses RegExp object rather than a literal to make it easier to read without lots of escaped slashes!

Type:
  • RegExp
Source:

folderRatio :int|Array.<int>

How many folders to display in a list, as a percentage of the total number of items. This can be supplied either as a fixed number, or as an array that will correspond to the folder depth (i.e. root level would take the first array item as the ratio). If the current folder depth is greater than the length of the array, then the ratio used will be 0%.

Calculated ratios are always Math.ceil'd, so only a zero will ever provide no folders at all.

The number of folders is determined before filters are applied, so filters may alter the ratio of folders to files

Type:
  • int | Array.<int>
Default Value:
  • [80, 20]
Source:

<inner> totalItems :number

The total number of items in the dataset. The maximum allowed is 1000.

Type:
  • number
Default Value:
  • 15
Source:

Methods

respondToListRequest(request, queryString)

Respond to the supplied request
Parameters:
Name Type Description
request Object The request object
queryString string The query string from the request URL
Source:

respondToNodeRequest(request, nodeGuid)

Respond to a request for a specific node
Parameters:
Name Type Description
request Object The request object
nodeGuid string The GUID of the node's nodeRef
Source:

setupServer()

This sets up the fake server with all the responses it should provide.
Source: