1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #34619 -- Associated FilteredSelectMultiple elements to their label and help text.

This commit is contained in:
GappleBee
2024-10-24 19:44:31 +01:00
committed by Sarah Boyce
parent f60d5e46e1
commit 857b1048d5
9 changed files with 168 additions and 108 deletions

View File

@@ -12,13 +12,25 @@ QUnit.test('init', function(assert) {
SelectFilter.init('id', 'things', 0);
assert.equal($('#test').children().first().prop("tagName"), "DIV");
assert.equal($('#test').children().first().attr("class"), "selector");
assert.equal($('.selector-available h2').text().trim(), "Available things");
assert.equal($('.selector-chosen h2').text().trim(), "Chosen things");
assert.equal($('.selector-available label').text().trim(), "Available things");
assert.equal($('.selector-chosen label').text().trim(), "Chosen things");
assert.equal($('.selector-chosen select')[0].getAttribute('multiple'), '');
assert.equal($('.selector-chooseall').text(), "Choose all");
assert.equal($('.selector-add').text(), "Choose");
assert.equal($('.selector-remove').text(), "Remove");
assert.equal($('.selector-clearall').text(), "Remove all");
assert.equal($('.selector-chooseall').text(), "Choose all things");
assert.equal($('.selector-chooseall').prop("tagName"), "BUTTON");
assert.equal($('.selector-add').text(), "Choose selected things");
assert.equal($('.selector-add').prop("tagName"), "BUTTON");
assert.equal($('.selector-remove').text(), "Remove selected chosen things");
assert.equal($('.selector-remove').prop("tagName"), "BUTTON");
assert.equal($('.selector-clearall').text(), "Remove all things");
assert.equal($('.selector-clearall').prop("tagName"), "BUTTON");
assert.equal($('.selector-available .filtered').attr("aria-labelledby"), "id_from_title");
assert.equal($('.selector-available .selector-available-title label').text(), "Available things ");
assert.equal($('.selector-available .selector-available-title .helptext').text(), 'Choose things by selecting them and then select the "Choose" arrow button.');
assert.equal($('.selector-chosen .filtered').attr("aria-labelledby"), "id_to_title");
assert.equal($('.selector-chosen .selector-chosen-title label').text(), "Chosen things ");
assert.equal($('.selector-chosen .selector-chosen-title .helptext').text(), 'Remove things by selecting them and then select the "Remove" arrow button.');
assert.equal($('.selector-filter label .help-tooltip')[0].getAttribute("aria-label"), "Type into this box to filter down the list of available things.");
assert.equal($('.selector-filter label .help-tooltip')[1].getAttribute("aria-label"), "Type into this box to filter down the list of selected things.");
});
QUnit.test('filtering available options', function(assert) {