• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

SAP / ui5-webcomponents-react / 14592827068

22 Apr 2025 10:41AM CUT coverage: 88.179% (+0.02%) from 88.163%
14592827068

Pull #7260

github

web-flow
Merge 7593a5e0a into e733f3629
Pull Request #7260: feat(AnalyticalCardHeader): allow customizing the `aria-level` of `titleText`

3013 of 3966 branches covered (75.97%)

5289 of 5998 relevant lines covered (88.18%)

95214.36 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

64.52
/packages/main/src/components/AnalyticalTable/tableReducer/stateReducer.ts
1
import { actions } from 'react-table';
2

3
export const stateReducer = (state, action, _prevState, instance) => {
444✔
4
  const { payload } = action;
251,229✔
5

6
  if (state.isRtl && action.type === actions.columnResizing) {
251,229!
7
    const { clientX } = action;
×
8
    const { startX, columnWidth, headerIdWidths } = state.columnResizing;
×
9

10
    const deltaX = startX - clientX;
×
11
    const percentageDeltaX = deltaX / columnWidth;
×
12

13
    const newColumnWidths = {};
×
14

15
    headerIdWidths.forEach(([headerId, headerWidth]) => {
×
16
      newColumnWidths[headerId] = Math.max(headerWidth + headerWidth * percentageDeltaX, 0);
×
17
    });
18

19
    return {
×
20
      ...state,
21
      columnResizing: {
22
        ...state.columnResizing,
23
        columnWidths: {
24
          ...state.columnResizing.columnWidths,
25
          ...newColumnWidths
26
        }
27
      }
28
    };
29
  }
30
  switch (action.type) {
251,229!
31
    case 'toggleRowExpanded':
32
      // this flag disables scrolling to the top of the table if a table is collapsed
33
      if (!state.expanded[action.id]) {
1,672✔
34
        instance.dispatch({
102✔
35
          type: 'ROW_COLLAPSED_FLAG',
36
          payload: true
37
        });
38
      }
39
      return state;
1,672✔
40
    case 'TABLE_RESIZE':
41
      // tableClientWidth is misleading, as only when scaled the `clientWidth` is used. In all other cases `getBoundingClientRect` is measuring the width.
42
      return { ...state, tableClientWidth: payload.tableClientWidth };
28,840✔
43
    case 'VISIBLE_ROWS':
44
      return { ...state, visibleRows: payload.visibleRows };
3,536✔
45
    case 'TABLE_SCROLLING_ENABLED':
46
      return { ...state, isScrollable: payload.isScrollable };
20,828✔
47
    case 'SET_SELECTED_ROW_IDS':
48
      return { ...state, selectedRowIds: payload.selectedRowIds };
392✔
49
    case 'SET_POPIN_COLUMNS':
50
      return { ...state, popInColumns: payload };
28,555✔
51
    case 'INTERACTIVE_ROWS_HAVE_POPIN':
52
      return { ...state, interactiveRowsHavePopIn: payload };
×
53
    case 'IS_RTL':
54
      return { ...state, isRtl: payload.isRtl };
14,946✔
55
    case 'SUB_COMPONENTS_HEIGHT':
56
      return { ...state, subComponentsHeight: payload };
10,308✔
57
    case 'TABLE_COL_RESIZED':
58
      return { ...state, tableColResized: payload };
×
59
    case 'SELECT_ROW_CB':
60
      return { ...state, selectedRowPayload: payload };
7,088✔
61
    case 'ROW_COLLAPSED_FLAG':
62
      return { ...state, rowCollapsed: payload };
136✔
63
    case 'COLUMN_DND_START':
64
      return { ...state, dndColumn: payload };
×
65
    case 'COLUMN_DND_END':
66
      return { ...state, dndColumn: '' };
128✔
67
    // fallback if the component wasn't ready yet for scrolling (elements are not initialized), e.g. when calling `.scrollToItem` on mount
68
    case 'TRIGGER_PROG_SCROLL':
69
      return { ...state, triggerScroll: payload };
160✔
70
    case 'AUTO_RESIZE':
71
      return {
714✔
72
        ...state,
73
        columnResizing: {
74
          ...state.columnResizing,
75
          columnWidths: {
76
            ...state.columnResizing.columnWidths,
77
            ...payload
78
          }
79
        }
80
      };
81
    default:
82
      return state;
133,926✔
83
  }
84
};
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc