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

SAP / ui5-webcomponents-react / 13287547337

12 Feb 2025 02:23PM CUT coverage: 86.925%. First build
13287547337

Pull #6929

github

web-flow
Merge 67c43dea0 into 65b203ac2
Pull Request #6929: chore(coverage): ignore `dist` folders

2254 of 2778 branches covered (81.14%)

3836 of 4413 relevant lines covered (86.92%)

57673.51 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) => {
245✔
4
  const { payload } = action;
77,892✔
5

6
  if (state.isRtl && action.type === actions.columnResizing) {
77,892!
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) {
77,892!
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]) {
774✔
34
        instance.dispatch({
45✔
35
          type: 'ROW_COLLAPSED_FLAG',
36
          payload: true
37
        });
38
      }
39
      return state;
774✔
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 };
10,338✔
43
    case 'VISIBLE_ROWS':
44
      return { ...state, visibleRows: payload.visibleRows };
1,300✔
45
    case 'TABLE_SCROLLING_ENABLED':
46
      return { ...state, isScrollable: payload.isScrollable };
6,388✔
47
    case 'SET_SELECTED_ROW_IDS':
48
      return { ...state, selectedRowIds: payload.selectedRowIds };
115✔
49
    case 'SET_POPIN_COLUMNS':
50
      return { ...state, popInColumns: payload };
15,516✔
51
    case 'INTERACTIVE_ROWS_HAVE_POPIN':
52
      return { ...state, interactiveRowsHavePopIn: payload };
×
53
    case 'IS_RTL':
54
      return { ...state, isRtl: payload.isRtl };
3,543✔
55
    case 'SUB_COMPONENTS_HEIGHT':
56
      return { ...state, subComponentsHeight: payload };
4,212✔
57
    case 'TABLE_COL_RESIZED':
58
      return { ...state, tableColResized: payload };
×
59
    case 'SELECT_ROW_CB':
60
      return { ...state, selectedRowPayload: payload };
3,352✔
61
    case 'ROW_COLLAPSED_FLAG':
62
      return { ...state, rowCollapsed: payload };
60✔
63
    case 'COLUMN_DND_START':
64
      return { ...state, dndColumn: payload };
×
65
    case 'COLUMN_DND_END':
66
      return { ...state, dndColumn: '' };
60✔
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 };
32✔
70
    case 'AUTO_RESIZE':
71
      return {
343✔
72
        ...state,
73
        columnResizing: {
74
          ...state.columnResizing,
75
          columnWidths: {
76
            ...state.columnResizing.columnWidths,
77
            ...payload
78
          }
79
        }
80
      };
81
    default:
82
      return state;
31,859✔
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