Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed problem with uncaught TypeError exception for some CollapsibleColumns plugin configurations #10693

Merged
merged 3 commits into from Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changelogs/10693.json
@@ -0,0 +1,8 @@
{
"issuesOrigin": "private",
"title": "Fixed problem with uncaught TypeError exception for some CollapsibleColumns plugin configurations",
"type": "fixed",
"issueOrPR": 10693,
"breaking": false,
"framework": "none"
}
Expand Up @@ -2788,4 +2788,22 @@ describe('CollapsibleColumns', () => {
});
});
});

it('should not throw an error for configuration with columns beyond the table boundaries', () => {
expect(() => {
handsontable({
data: Handsontable.helper.createSpreadsheetData(5, 5),
colHeaders: true,
nestedHeaders: [
['A', { label: 'B', colspan: 8 }, 'C'],
['N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W'],
],
collapsibleColumns: [
{ row: -2, col: 1, collapsible: true },
{ row: -1, col: 1, collapsible: true },
{ row: -3, col: 1, collapsible: true },
],
});
}).not.toThrow();
});
});
Expand Up @@ -122,7 +122,7 @@ export default class SourceSettings {

const headersSettings = this.#data[headerLevel];

if (columnIndex >= headersSettings.length) {
if (Array.isArray(headersSettings) === false || columnIndex >= headersSettings.length) {
return null;
}

Expand Down