Skip to content

Commit

Permalink
select2#4530 Add tooltip (title) to the 'remove all' 'X' icon.
Browse files Browse the repository at this point in the history
  • Loading branch information
nishakaushikNK committed May 14, 2018
1 parent 3fb9e4f commit e4515bc
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/js/select2/selection/allowClear.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ define([
}

var $remove = $(
'<span class="select2-selection__clear">' +
'<span class="select2-selection__clear" title="Remove all items">' +
'&times;' +
'</span>'
);
Expand Down
20 changes: 20 additions & 0 deletions tests/selection/allowClear-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,26 @@ test('clear is displayed for placeholder', function (assert) {
);
});

test('clear icon should have title displayed', function (assert) {
var selection = new AllowClearPlaceholder(
$('#qunit-fixture .single-with-placeholder'),
allowClearOptions
);

var $selection = selection.render();

selection.update([{
id: 'one',
test: 'one'
}]);

assert.equal(
$selection.find('.select2-selection__clear').attr('title'),
'Remove all items',
'The clear icon should have title displayed'
);
});

test('clicking clear will set the placeholder value', function (assert) {
var $element = $('#qunit-fixture .single-with-placeholder');

Expand Down

0 comments on commit e4515bc

Please sign in to comment.