@@ -1069,6 +1069,20 @@ describe('Table.tsx', () => {
1069
1069
expect ( container . querySelectorAll ( '.ms-GroupedList-group' ) ) . toHaveLength ( tableProps . rows ! . length )
1070
1070
} )
1071
1071
1072
+ it ( 'Renders grouped list after selection, removes grouping when "No Grouping" chosen' , ( ) => {
1073
+ const { container, getAllByText, getByTestId, getByText } = render ( < XTable model = { tableProps } /> )
1074
+
1075
+ fireEvent . click ( getByTestId ( 'groupby' ) )
1076
+ fireEvent . click ( getAllByText ( 'Col1' ) [ 1 ] ! )
1077
+
1078
+ expect ( container . querySelectorAll ( '.ms-GroupedList-group' ) ) . toHaveLength ( tableProps . rows ! . length )
1079
+
1080
+ fireEvent . click ( getByTestId ( 'groupby' ) )
1081
+ fireEvent . click ( getByText ( '(No Grouping)' ) ! )
1082
+
1083
+ expect ( container . querySelectorAll ( '.ms-GroupedList-group' ) ) . toHaveLength ( 0 )
1084
+ } )
1085
+
1072
1086
it ( 'Checks if grouped list is collapsed after selection' , ( ) => {
1073
1087
const { getAllByRole, getAllByText, getByTestId } = render ( < XTable model = { tableProps } /> )
1074
1088
@@ -1648,6 +1662,18 @@ describe('Table.tsx', () => {
1648
1662
expect ( getAllByRole ( 'gridcell' ) [ 2 ] . textContent ) . toBe ( 'Jumps over a dog.' )
1649
1663
expect ( getAllByRole ( 'gridcell' ) [ 4 ] . textContent ) . toBe ( 'Wooo hooo.' )
1650
1664
} )
1665
+
1666
+ it ( 'Does not keep groups rendered after reset' , ( ) => {
1667
+ const { container, getAllByText, getByTestId, getByText } = render ( < XTable model = { { ...tableProps , groupable : true , resettable : true } } /> )
1668
+
1669
+ fireEvent . click ( getByTestId ( 'groupby' ) )
1670
+ fireEvent . click ( getAllByText ( 'Col1' ) [ 1 ] ! )
1671
+
1672
+ expect ( container . querySelectorAll ( '.ms-GroupedList-group' ) ) . toHaveLength ( 3 )
1673
+ fireEvent . click ( getByText ( 'Reset table' ) )
1674
+ expect ( container . querySelectorAll ( '.ms-GroupedList-group' ) ) . toHaveLength ( 0 )
1675
+ } )
1676
+
1651
1677
} )
1652
1678
1653
1679
describe ( 'Download' , ( ) => {
0 commit comments