Commit eba71302 authored by Kyle Needham's avatar Kyle Needham

Created test for issue #405

parent 7375e5ee
......@@ -573,4 +573,37 @@ describe('Bootstrap Multiselect Specific Issues', function() {
$('#multiselect').multiselect('destroy');
$('#multiselect').remove();
});
});
\ No newline at end of file
it('#405', function() {
var selection = document.getSelection();
var range = document.createRange();
var $selection = $('<span>Some text to select</span>');
var $select = $('<select id="multiselect" multiple="multiple"></select>');
for (var i = 1; i < 5; i++) {
$select.append('<option value="' + i + '">select option</option>');
}
$('body').append($selection).append($select);
$select.multiselect({
buttonContainer: '<div id="multiselect-container"></div>',
});
range.selectNodeContents($selection.get(0));
selection.removeAllRanges();
selection.addRange(range);
expect(document.getSelection().type).toBe('Range');
expect($('#multiselect-container').find('input:first').prop('checked')).toBe(false);
$('#multiselect-container').find('a:first').trigger('click');
expect($('#multiselect-container').find('input:first').prop('checked')).toBe(true);
$('#multiselect').multiselect('destroy');
$('#multiselect').remove();
$selection.remove();
});
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment