MCPcopy Create free account
hub / github.com/jquery/jquery-ui / toolbarModuleFilter

Function toolbarModuleFilter

external/qunit/qunit.js:5384–5564  ·  view source on GitHub ↗
(beginDetails)

Source from the content-addressed store, hash-verified

5382 return html;
5383 }
5384 function toolbarModuleFilter(beginDetails) {
5385 var initialSelected = null;
5386 dropdownData = {
5387 options: beginDetails.modules.slice(),
5388 selectedMap: new StringMap(),
5389 isDirty: function isDirty() {
5390 return _toConsumableArray(dropdownData.selectedMap.keys()).sort().join(',') !== _toConsumableArray(initialSelected.keys()).sort().join(',');
5391 }
5392 };
5393 if (config.moduleId.length) {
5394 // The module dropdown is seeded with the runtime configuration of the last run.
5395 //
5396 // We don't reference `config.moduleId` directly after this and keep our own
5397 // copy because:
5398 // 1. This naturally filters out unknown moduleIds.
5399 // 2. Gives us a place to manage and remember unsubmitted checkbox changes.
5400 // 3. Gives us an efficient way to map a selected moduleId to module name
5401 // during rendering.
5402 for (var i = 0; i < beginDetails.modules.length; i++) {
5403 var mod = beginDetails.modules[i];
5404 if (config.moduleId.indexOf(mod.moduleId) !== -1) {
5405 dropdownData.selectedMap.set(mod.moduleId, mod.name);
5406 }
5407 }
5408 }
5409 initialSelected = new StringMap(dropdownData.selectedMap);
5410 var moduleSearch = document.createElement('input');
5411 moduleSearch.id = 'qunit-modulefilter-search';
5412 moduleSearch.autocomplete = 'off';
5413 addEvent(moduleSearch, 'input', searchInput);
5414 addEvent(moduleSearch, 'input', searchFocus);
5415 addEvent(moduleSearch, 'focus', searchFocus);
5416 addEvent(moduleSearch, 'click', searchFocus);
5417 var label = document.createElement('label');
5418 label.htmlFor = 'qunit-modulefilter-search';
5419 label.textContent = 'Module:';
5420 var searchContainer = document.createElement('span');
5421 searchContainer.id = 'qunit-modulefilter-search-container';
5422 searchContainer.appendChild(moduleSearch);
5423 var applyButton = document.createElement('button');
5424 applyButton.textContent = 'Apply';
5425 applyButton.title = 'Re-run the selected test modules';
5426 addEvent(applyButton, 'click', applyUrlParams);
5427 var resetButton = document.createElement('button');
5428 resetButton.textContent = 'Reset';
5429 resetButton.type = 'reset';
5430 resetButton.title = 'Restore the previous module selection';
5431 var clearButton = document.createElement('button');
5432 clearButton.textContent = 'Select none';
5433 clearButton.type = 'button';
5434 clearButton.title = 'Clear the current module selection';
5435 addEvent(clearButton, 'click', function () {
5436 dropdownData.selectedMap.clear();
5437 selectionChange();
5438 searchInput();
5439 });
5440 var actions = document.createElement('span');
5441 actions.id = 'qunit-modulefilter-actions';

Callers 1

appendToolbarFunction · 0.85

Calls 4

_toConsumableArrayFunction · 0.85
addEventFunction · 0.85
selectionChangeFunction · 0.85
searchInputFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…