diff --git a/src/plugin-hooks/tests/__snapshots__/useRowSelect.test.js.snap b/src/plugin-hooks/tests/__snapshots__/useRowSelect.test.js.snap index 721aea5..20eb419 100644 --- a/src/plugin-hooks/tests/__snapshots__/useRowSelect.test.js.snap +++ b/src/plugin-hooks/tests/__snapshots__/useRowSelect.test.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`renders a table with seletable rows 1`] = ` +exports[`renders a table with selectable rows 1`] = ` Snapshot Diff: - First value + Second value @@ -57,7 +57,227 @@ Snapshot Diff:
+- Selected Rows: 0 ++ Selected Rows: 6 +
+
+
+ {
+- "selectedRows": []
++ "selectedRows": [
++ "0",
++ "1",
++ "2",
++ "2.0",
++ "2.1",
++ "3"
++ ]
+ }
+
+
+
+`;
+
+exports[`renders a table with selectable rows 2`] = `
+Snapshot Diff:
+- First value
++ Second value
+
+@@ -109,11 +109,11 @@
+
+ +- Selected Rows: 6 ++ Selected Rows: 0 +
+
+
+ {
+- "selectedRows": [
+- "0",
+- "1",
+- "2",
+- "2.0",
+- "2.1",
+- "3"
+- ]
++ "selectedRows": []
+ }
+
+
+
+`;
+
+exports[`renders a table with selectable rows 3`] = `
+Snapshot Diff:
+- First value
++ Second value
+
+@@ -109,11 +109,11 @@
+
+ - Selected Rows: 4 -+ Selected Rows: 0 ++ Selected Rows: 1
{
-- "selectedRows": [
+ "selectedRows": [
- "0",
-- "1",
- "2",
-- "3"
-- ]
-+ "selectedRows": []
+- "2.0",
+- "2.1"
++ "0"
+ ]
}
`;
-exports[`renders a table with seletable rows 3`] = `
+exports[`renders a table with selectable rows 5`] = `
Snapshot Diff:
- First value
+ Second value
-@@ -109,11 +109,11 @@
+@@ -277,11 +277,11 @@
+- Selected Rows: 1 ++ Selected Rows: 2 +
+
+
+ {
+ "selectedRows": [
+- "0"
++ "0",
++ "2.0"
+ ]
+ }
+
+
+
+`;
+
+exports[`renders a table with selectable rows 6`] = `
+Snapshot Diff:
+- First value
++ Second value
+
@@ -221,11 +221,11 @@
-- Selected Rows: 0 -+ Selected Rows: 2 +- Selected Rows: 2 ++ Selected Rows: 4
{
-- "selectedRows": []
-+ "selectedRows": [
-+ "0",
+ "selectedRows": [
+ "0",
+- "2.0"
++ "2.0",
++ "2.1",
+ "2"
-+ ]
+ ]
+ }
+
+
+
+`;
+
+exports[`renders a table with selectable rows 7`] = `
+Snapshot Diff:
+- First value
++ Second value
+
+@@ -221,11 +221,11 @@
+
+ +- Selected Rows: 4 ++ Selected Rows: 2 +
+
+
+ {
+ "selectedRows": [
+ "0",
+- "2.0",
+- "2.1",
+- "2"
++ "2.0"
+ ]
}
diff --git a/src/plugin-hooks/tests/useRowSelect.test.js b/src/plugin-hooks/tests/useRowSelect.test.js
index 4e8ce39..d4e8de0 100644
--- a/src/plugin-hooks/tests/useRowSelect.test.js
+++ b/src/plugin-hooks/tests/useRowSelect.test.js
@@ -2,6 +2,7 @@ import React from 'react'
import { render, fireEvent } from '@testing-library/react'
import { useTable } from '../../hooks/useTable'
import { useRowSelect } from '../useRowSelect'
+import { useExpanded } from '../useExpanded'
const data = [
{
@@ -27,6 +28,25 @@ const data = [
visits: 20,
status: 'Complicated',
progress: 10,
+ expanded: true,
+ subRows: [
+ {
+ firstName: 'bob',
+ lastName: 'ross',
+ age: 52,
+ visits: 40,
+ status: 'In Relationship',
+ progress: 30,
+ },
+ {
+ firstName: 'john',
+ lastName: 'smith',
+ age: 21,
+ visits: 30,
+ status: 'Single',
+ progress: 60,
+ },
+ ],
},
{
firstName: 'jaylen',
@@ -51,7 +71,8 @@ function Table({ columns, data }) {
columns,
data,
},
- useRowSelect
+ useRowSelect,
+ useExpanded
)
// Render the UI for your table
@@ -164,7 +185,7 @@ function App() {
return