How to use ariatemplates - 10 common examples

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 / form / multiautocomplete / navigation / Task.js View on Github external
return function (task) {
                // -------------------------------------------------- processing

                // tracing -----------------------------------------------------

                if (self.trace.enable) {
                    var console = Aria.$window.console;

                    // message -------------------------------------------------

                    var message;
                    if (ariaCoreBrowser.isWebkit) {
                        message = ['%c' + self.name, 'color: ' + self.trace.color];
                    } else {
                        message = [self.name];
                    }

                    // log method ----------------------------------------------

                    var logMethod;
                    if (!self.hasChildren) {
                        logMethod = console.log;
                    } else {
github ariatemplates / ariatemplates / test / aria / widgets / wai / input / label / MultiSelectJawsTestCase.js View on Github external
* Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

var Aria = require("ariatemplates/Aria");

module.exports = Aria.classDefinition({
    $classpath : "test.aria.widgets.wai.input.label.MultiSelectJawsTestCase",
    $extends : require("./LabelJawsBase"),
    $prototype : {
        elementsToTest : "msWaiEnabledStart",

        // The Multiselect needs extra tabs now that the icon is focusable:
        nbTabs: 4
    }
});
github ariatemplates / ariatemplates / test / aria / widgets / wai / popup / dialog / modal / RobotBase.js View on Github external
var ariaCoreBrowser = require('ariatemplates/core/Browser');
var ariaUtilsString = require('ariatemplates/utils/String');
var subst = ariaUtilsString.substitute;
var ariaUtilsDom = require('ariatemplates/utils/Dom');

var ariaPopupsPopupManager = require('ariatemplates/popups/PopupManager');

var Model = require('./Model');



////////////////////////////////////////////////////////////////////////////////
// Model: Test
////////////////////////////////////////////////////////////////////////////////

module.exports = Aria.classDefinition({
    $classpath : 'test.aria.widgets.wai.popup.dialog.modal.RobotBase',
    $extends : require('test/EnhancedRobotBase'),

    $constructor : function () {
        this.$EnhancedRobotBase.constructor.call(this);

        this.setTestEnv({
            data: Model.buildData(this.indexOfWidgetToTest),
            template: 'test.aria.widgets.wai.popup.dialog.modal.Tpl'
        });
    },

    $prototype : {
        ////////////////////////////////////////////////////////////////////////
        // Tests
        ////////////////////////////////////////////////////////////////////////
github ariatemplates / ariatemplates / test / aria / widgets / container / dialog / resize / dontSelectOnResize / DialogResizeDontSelectRobotTestCase.js View on Github external
* limitations under the License.
 */

var Aria = require('ariatemplates/Aria');

var ariaUtilsString = require('ariatemplates/utils/String');
var subst = ariaUtilsString.substitute;
var Dom = require('ariatemplates/utils/Dom');
var Browser = require('ariatemplates/core/Browser');
var Caret = require('ariatemplates/utils/Caret');

var EnhancedRobotBase = require('test/EnhancedRobotBase');



module.exports = Aria.classDefinition({
    $classpath: 'test.aria.widgets.container.dialog.resize.dontSelectOnResize.DialogResizeDontSelectRobotTestCase',
    $extends: EnhancedRobotBase,

    $prototype: {
        ////////////////////////////////////////////////////////////////////////
        // Tests
        ////////////////////////////////////////////////////////////////////////

        _getCommonData: function () {
            return this.templateCtxt._tpl.getCommonData();
        },

        runTemplateTest: function () {
            // --------------------------------------------------- destructuring

            var commonData = this._getCommonData();
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();
        },