Caplin Trader 4.7.1

Class: module:br/test/Utils

module:br/test/Utils

Utility class containing static methods that can be useful for tests.

Constructor

new module:br/test/Utils()

Methods

(static) fireDomEvent(element, eventString, characteropt)

Fires a DOM Event in a cross Browser compatible way.
Parameters:
Name Type Attributes Description
element DOMElement The DOM Element the Event is fired from
eventString String The Event to be fired without 'on', e.g. 'click', 'keydown'
character String <optional>
A character associated with typing events

(static) fireKeyEvent(element, eventString, key, options)

Fires a DOM KeyboardEvent in a cross Browser compatible way.
Parameters:
Name Type Description
element DOMElement The DOM Element the Event is fired from
eventString String The Event to be fired without 'on', e.g. 'keydown'
key String This parameter is deprecated. Pass in this value as options.key.
options Map A map of values, passed in to the KeyboardEvent constructor, associated with typing events.

(static) fireMouseEvent(element, eventString, options)

Fires a DOM MouseEvents in a cross Browser compatible way.
Parameters:
Name Type Description
element DOMElement The DOM Element the Event is fired from
eventString String The Event to be fired without 'on', e.g. 'click'
options Map a map of values, passed in to initMouseEvent, associated with mouse events.

(static) fireScrollEvent(element)

Fires a DOM scroll event in a cross Browser compatible way.
Parameters:
Name Type Description
element DOMElement The DOM Element the Event is fired from

(static) getKeyCodeForChar(character) → {Number}

Returns the Keycode of a letter.
Parameters:
Name Type Description
character String a single Character to get the Keycode for
Returns:
keyCode The key code for the specified char.
Type
Number

(static) loadCSSAndAttachToPage(cssFiels)

Attaches CSS files to the test page. Cleaning them up is done via the removeLoadedAndAttachedCSSFromPage method.
Parameters:
Name Type Description
cssFiels Array list of css file URLs to be loaded into the test page.

(static) removeLoadedAndAttachedCSSFromPage(cssFiles)

Attaches CSS files to the test page. Cleaning them up is done via the removeLoadedAndAttachedCSSFromPage method.
Parameters:
Name Type Description
cssFiles Array list of css file URLs to be loaded into the test page.