+
External state - expanded rows: [{Object.keys(expandedRows).join()}]
+
+
+ );
+ },
+};
diff --git a/packages/comet-extras/src/components/data-table/data-table.test.tsx b/packages/comet-extras/src/components/data-table/data-table.test.tsx
index 5c418e5a..93fe93a7 100644
--- a/packages/comet-extras/src/components/data-table/data-table.test.tsx
+++ b/packages/comet-extras/src/components/data-table/data-table.test.tsx
@@ -1,5 +1,6 @@
-import React from 'react';
-import { act, render } from '@testing-library/react';
+import React, { useState } from 'react';
+import { act, render, screen } from '@testing-library/react';
+import { userEvent } from '@testing-library/user-event';
import DataTable from './data-table';
import { createColumnHelper } from '@tanstack/react-table';
@@ -355,6 +356,140 @@ describe('DataTable', () => {
expect(pageButtons.length).toBeGreaterThan(0); // Should have page buttons
});
+ test('should display all rows initially expanded', () => {
+ const dataWithChildren: Person[] = [
+ {
+ firstName: 'John',
+ lastName: 'Doe',
+ children: [
+ {
+ firstName: 'Johnny',
+ lastName: 'Doe Jr',
+ },
+ ],
+ },
+ {
+ firstName: 'Jane',
+ lastName: 'Smith',
+ children: [
+ {
+ firstName: 'Janie',
+ lastName: 'Smith Jr',
+ },
+ ],
+ },
+ {
+ firstName: 'Bob',
+ lastName: 'Wilson',
+ children: [
+ {
+ firstName: 'Bobby',
+ lastName: 'Wilson Jr',
+ },
+ ],
+ },
+ ];
+
+ const { baseElement } = render(
+