How to use the ariatemplates/utils/Array.forEach function in ariatemplates

To help you get started, we’ve selected a few ariatemplates examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ariatemplates / ariatemplates / test / aria / widgets / wai / input / actionWidget / JawsBase.js View on Github external
function selectStartPoint() {
                    step(['click', document.getElementById(elements.before.id)]);
                }

                // function isFinalElementFocused() {
                //     return document.activeElement === finalElement;
                // }

                // -------------------------------------------------- processing

                // TODO It would be more robust to stop navigating when reaching the final element
                // However this prevents us from building a predefined set of steps
                // while (!isFinalElementFocused()) {
                    // navigateForward();
                // }
                ariaUtilsArray.forEach(traversals, function(traversal) {
                    var key = traversal.key;
                    var name = traversal.name;

                    var traversalTestData = testData[traversal.name];
                    var actionsCount = traversalTestData.actionsCount;
                    var expectedOutput = traversalTestData.expectedOutput;

                    selectStartPoint();
                    ariaUtilsAlgo.times(actionsCount, ariaUtilsFunction.bind(specialKey, null, key));
                    says(expectedOutput.join('\n'));
                });
            });
        }
github ariatemplates / ariatemplates / test / aria / widgets / form / multiautocomplete / navigation / Sequence.js View on Github external
onEnd = Aria.empty;
            }

            if (scope == null) {
                scope = this;
            }

            // ------------------------------------------------------ processing

            // actual sequence creation ----------------------------------------

            var sequence = new ariaCoreSequencer();
            this._toDispose.push(sequence);
            this.__sequence = sequence;

            ariaUtilsArray.forEach(this.__tasks, function (task) {
                sequence.addTask({
                    name : task.name,
                    fn : task.getFn(),
                    scope : task.scope,
                    asynchronous : task.asynchronous
                });
            }, this);

            // on end callback registration ------------------------------------

            var cb = {
                fn : onEnd,
                scope : scope
            };

            if (arg != null) {
github ariatemplates / ariatemplates / test / aria / widgets / form / multiautocomplete / navigation / RobotBase.js View on Github external
if (ariaUtilsType.isString(textSequence)) {
                textSequence = [textSequence];
            } else if (!ariaUtilsType.isArray(textSequence)) {
                throw new Error('Invalid given textSequence. Should be an array or a string, got: ' + textSequence);
            }

            // delay -----------------------------------------------------------

            if (delay == null) {
                delay = this.defaultDelay;
            }

            // ------------------------------------------------------ processing

            var tasks = [];
            ariaUtilsArray.forEach(textSequence, function (text) {
                tasks.push({
                    name : 'Type...',
                    method : 'type',
                    args : [text]
                });
                tasks.push({
                    name : 'Wait...',
                    method : 'wait',
                    args : [delay]
                });
            });

            var sequencer = new Sequencer({
                scope : this,

                asynchronous : true,
github ariatemplates / ariatemplates / test / aria / widgets / wai / input / actionWidget / Base.js View on Github external
function selectStartPoint() {
                    step(['click', document.getElementById(elements.before.id)]);
                }

                // function isFinalElementFocused() {
                //     return document.activeElement === finalElement;
                // }

                // -------------------------------------------------- processing

                // TODO It would be more robust to stop navigating when reaching the final element
                // However this prevents us from building a predefined set of steps
                // while (!isFinalElementFocused()) {
                    // navigateForward();
                // }
                ariaUtilsArray.forEach(traversals, function(traversal) {
                    var key = traversal.key;
                    var name = traversal.name;

                    var traversalTestData = testData[traversal.name];
                    var actionsCount = traversalTestData.actionsCount;
                    var expectedOutput = traversalTestData.expectedOutput;

                    selectStartPoint();
                    while (actionsCount > 0) {
                        specialKey(key);
                        actionsCount--;
                    }
                    says(expectedOutput.join('\n'));
                });
            });
        }
github ariatemplates / ariatemplates / test / aria / widgets / wai / tabs / Base.js View on Github external
// --------------------------------------- early termination

                    if (tab.disabled) {
                        return;
                    }

                    // ---------------------------------------------- processing

                    add('_focusElementBefore', group.id);

                    if (group.tabsUnder) {
                        add('_navigateForward');
                        add('_navigateForward');
                    }

                    ariaUtilsArray.forEach(tabs.slice(0, index + 1), function (tab) {
                        if (!tab.disabled) {
                            add('_navigateForward');
                        }
                    });


                    var selectionMethod = index === 0 ? '_pressEnter' : '_pressSpace';
                    add(selectionMethod);

                    var predicate = this._createTabSelectedPredicate(group, tab);
                    add(predicate.waitForTrue);

                    if (tab.waiAria) {
                        add('_checkWidgetIsFocused', tabPanelId);
                        // Specifications often change (2016-07-22T16:54:42+02:00), what should precisely be focused might change
                        // add('_checkElementIsFocused', 'inside_' + tabPanelId);
github ariatemplates / ariatemplates / test / aria / templates / keyboardNavigation / actionWidgets / ActionWidgetsRobotTestCase.js View on Github external
_checkCounters : function (callback, expectedCounts) {
            // --------------------------------------------------- destructuring

            var data = this._getData();
            var countersIds = data.countersIds;

            // ------------------------------------------------------ processing

            ariaUtilsArray.forEach(countersIds, function (id) {
                var expectedCount = expectedCounts[id];

                this._checkCounter(id, expectedCount);
            }, this);

            this._resetCounters();

            // ---------------------------------------------------------- return

            callback();
        },
github ariatemplates / ariatemplates / test / aria / widgets / form / multiautocomplete / navigation / RobotBase.js View on Github external
// insert options --------------------------------------------------

            if (restore) {
                field.value = "";
            }

            var text = [];

            var tasks = [{
                        name : 'Ensures input field is focused first',
                        method : 'focusInputField',
                        asynchronous : true
                    }];

            ariaUtilsArray.forEach(inputs, function (input) {
                tasks.push({
                    name : 'Type sequence',
                    method : 'typeSequence',
                    args : [[input]],
                    asynchronous : true
                });

                tasks.push({
                    name : 'Wait for dropdown',
                    method : 'waitForDropdownState',
                    args : [true],
                    asynchronous : true
                });

                tasks.push({
                    name : 'Type sequence',
github ariatemplates / ariatemplates / test / EnhancedRobotBase.js View on Github external
$destructor : function () {
        this.$RobotTestCase.$destructor.call(this);

        ariaUtilsArray.forEach(this._disposableObjects, function (object) {
            object.$dispose();
        });
    },
github ariatemplates / ariatemplates / test / EnhancedJawsBase.js View on Github external
function autoBindAndAlias(container, spec) {
    var method = ariaUtilsFunction.bind(container[spec.name], container);

    ariaUtilsArray.forEach(spec.aliases, function(alias) {
        container[alias] = method;
    });

    return method;
}
github ariatemplates / ariatemplates / test / aria / widgets / form / multiautocomplete / navigation / RobotBase.js View on Github external
$destructor : function () {
        this.sequencer.$dispose();

        ariaUtilsArray.forEach(this._toDispose, function (instance) {
            instance.$dispose();
        });

        this.$MultiAutoCompleteRobotBase.$destructor.call(this);
    },