Caplin Trader 5.1.0

Class: module:ct-services/testing/UserPromptServiceStub

module:ct-services/testing/UserPromptServiceStub()

The UserPromptServiceStub serves to create a stub for a UserPromptService to enable tests to simulate a user prompt service.

Constructor

new module:ct-services/testing/UserPromptServiceStub()

Constructs a UserPromptServiceStub.

Implements:

Methods

alert(message, options)

Displays an alert dialog box to the user.

Since this is a non-blocking method, the fCallBack parameter should be used to provide any code that must be executed once the dialog has been closed.

The fCallBack function will always be passed true as its first parameter.

The previous api (message,callback,caption) should still be supported by UserPromptServices.

Parameters:
Name Type Description
message String

The alert message template to be displayed to the user.

options Map

Parameters that affect the alert and can be referenced by the message.

Properties
Name Type Attributes Description
callback function <optional>

A call back function that will be executed once the user has closed the dialog.

caption String <optional>

The text displayed as a dialog caption. Default is 'Alert' or equivalent as per alert dispatcher.

code String <optional>

The code used to identify the type of alert. This will be used to translate/customise the message.

ok String <optional>

The text on the ok button.

detail String <optional>

Further details about the issue.

Implements:

confirm(message, options)

Displays a confirmation dialog box to the user.

Since this is a non-blocking method, the fCallBack parameter should be used to provide any code that must be executed once the dialog has been closed. The fCallBack function will be passed true as its first parameter if the user clicks the 'Ok' button, and false otherwise.

The previous api (message,callback,ok,cancel,caption) should still be supported by UserPromptServices.

Parameters:
Name Type Description
message String

The alert message template to be displayed to the user.

options Map

Parameters that affect the alert and can be referenced by the message.

Properties
Name Type Attributes Description
callback function <optional>

A call back function that will be executed once the user has closed the dialog.

caption String <optional>

The text displayed as a dialog caption. Default is 'Alert' or equivalent as per alert dispatcher.

code String <optional>

The code used to identify the type of alert. This will be used to translate/customise the message.

ok String <optional>

The text on the ok button.

cancel String <optional>

The text on the cancel button.

detail String <optional>

Further details about the issue.

Implements:

isAlertShowing() → {boolean}

Used to query if an alert or confirm alert dialog is currently displayed.

Does not cover confirm dialogs only alerts.

Implements:
Returns:

true if an alert/confirm alert is currently displayed, otherwise false.

Type
boolean

optionalAlert(message, options)

Displays an alert dialog box to the user, with an option to never see the alert again.

Since this is a non-blocking method, the fCallBack parameter should be used to provide any code that must be executed once the dialog has been closed.

The fCallBack function will always be passed true as its first parameter.

The previous api (message,code,callback,caption) should still be supported by UserPromptServices.

Parameters:
Name Type Description
message String

The alert message template to be displayed to the user.

options Map

Parameters that affect the alert and can be referenced by the message.

Properties
Name Type Attributes Description
callback function <optional>

A call back function that will be executed once the user has closed the dialog.

caption String <optional>

The text displayed as a dialog caption. Default is 'Alert' or equivalent as per alert dispatcher.

code String <optional>

The code used to identify the type of alert. This will be used to translate/customise the message.

ok String <optional>

The text on the ok button.

detail String <optional>

Further details about the issue.

Implements:

optionalConfirm(message, options)

Displays a confirmation dialog box to the user, with an option to never see the confirmation again.

Since this is a non-blocking method, the fCallBack parameter should be used to provide any code that must be executed once the dialog has been closed. The fCallBack function will be passed true as its first parameter if the user clicks the 'Ok' button, and false otherwise.

The previous api (message,code,callback,ok,cancel,caption) should still be supported by UserPromptServices.

Parameters:
Name Type Description
message String

The alert message template to be displayed to the user.

options Map

Parameters that affect the alert and can be referenced by the message.

Properties
Name Type Attributes Description
callback function <optional>

A call back function that will be executed once the user has closed the dialog.

caption String <optional>

The text displayed as a dialog caption. Default is 'Alert' or equivalent as per alert dispatcher.

code String <optional>

The code used to identify the type of alert. This will be used to translate/customise the message.

ok String <optional>

The text on the ok button.

cancel String <optional>

The text on the cancel button.

detail String <optional>

Further details about the issue.

Implements: