Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions cypress/e2e/disabled-fieldset.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
describe('A select inside a disabled fieldset', () => {
it('preserves the value when the fieldset becomes disabled with the menu open', () => {
cy.visit('/tests/index.html');
cy.window().then(({ $ }) => {
$('body').append(`
<fieldset id="project-fieldset">
<select id="project">
<option>Alpha</option>
<option>Beta</option>
</select>
</fieldset>
`);
$('#project').selectpicker({ container: 'body' });
});

cy.get('button[data-id="project"]').click();
cy.get('#project-fieldset').invoke('prop', 'disabled', true);
cy.contains('.bs-container .dropdown-item', 'Beta').click();

cy.get('#project').should('have.value', 'Alpha');
});
});
2 changes: 1 addition & 1 deletion js/bootstrap-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -2656,7 +2656,7 @@
},

isDisabled: function () {
return this.$element[0].disabled;
return this.$element.is(':disabled');
},

checkDisabled: function () {
Expand Down