Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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'));
});
});
}
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) {
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,
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'));
});
});
}
// --------------------------------------- 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);
_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();
},
// 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',
$destructor : function () {
this.$RobotTestCase.$destructor.call(this);
ariaUtilsArray.forEach(this._disposableObjects, function (object) {
object.$dispose();
});
},
function autoBindAndAlias(container, spec) {
var method = ariaUtilsFunction.bind(container[spec.name], container);
ariaUtilsArray.forEach(spec.aliases, function(alias) {
container[alias] = method;
});
return method;
}
$destructor : function () {
this.sequencer.$dispose();
ariaUtilsArray.forEach(this._toDispose, function (instance) {
instance.$dispose();
});
this.$MultiAutoCompleteRobotBase.$destructor.call(this);
},