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

CBIIT / INS-WebPortal / 25866236099

14 May 2026 02:37PM UTC coverage: 12.908% (+3.9%) from 9.056%
25866236099

Pull #535

github

web-flow
Merge b05d0edf8 into 0713c18d4
Pull Request #535: INS-1610 Add Tools & Resources content

403 of 2305 branches covered (17.48%)

Branch coverage included in aggregate %.

156 of 625 new or added lines in 29 files covered. (24.96%)

4 existing lines in 3 files now uncovered.

392 of 3854 relevant lines covered (10.17%)

35.28 hits per line

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

37.29
/src/pages/Resources/Sorting/Sorting.jsx
1
import React from 'react';
2
import {
3
  useLocation,
4
  useHistory,
5
} from 'react-router-dom';
6
import styled from 'styled-components';
7
import ascActiveImage from '../../../assets/img/Ascending.Active.svg';
8
import ascInActiveImage from '../../../assets/img/Ascending.Inactive.svg';
9
import descActiveImage from '../../../assets/img/Descending.Active.svg';
10
import descInActiveImage from '../../../assets/img/Descending.Inactive.svg';
11

12
const SortingContainer = styled.div`
2✔
13
  display: flex;
14
  float: left;
15
`;
16

17
const SortingLabel = styled.div`
2✔
18
  line-height: 37.5px;
19
  padding-right: 10px;
20
  padding-left: 20px;
21
  color: #000;
22
    font-weight: 400;
23
    font-family: Lato;
24
    font-size: 14px;
25
`;
26

27
const SortingOrderASC = styled.div`
2✔
28
  width: 25px;
29
  background-repeat: no-repeat;
30
  background-position: center;
31
  background-image: url(${ascActiveImage});
32
  margin-left: 13px;
33
  cursor: pointer;
34
`;
35

36
const SortingOrderASCInactive = styled.div`
2✔
37
  width: 25px;
38
  background-repeat: no-repeat;
39
  background-position: center;
40
  background-image: url(${ascInActiveImage});
41
  margin-left: 13px;
42
  cursor: pointer;
43
`;
44

45
const SortingOrderDESC = styled.div`
2✔
46
  width: 25px;
47
  background-repeat: no-repeat;
48
  background-position: center;
49
  background-image: url(${descActiveImage});
50
  margin-left: 7px;
51
  cursor: pointer;
52
`;
53

54
const SortingOrderDESCInactive = styled.div`
2✔
55
  width: 25px;
56
  background-repeat: no-repeat;
57
  background-position: center;
58
  background-image: url(${descInActiveImage});
59
  margin-left: 7px;
60
  cursor: pointer;
61
`;
62

63
const useQuery = () => new URLSearchParams(useLocation().search);
72✔
64

65
const replaceQueryStr = (query, sortOrder) => {
2✔
NEW
66
  let str = '';
×
NEW
67
  if (query.get('search_text')) {
×
NEW
68
    str += `&search_text=${query.get('search_text')}`;
×
69
  }
NEW
70
  if (query.get('filterByResearchArea')) {
×
NEW
71
    str += `&filterByResearchArea=${query.get('filterByResearchArea')}`;
×
72
  }
NEW
73
  if (query.get('filterByToolType')) {
×
NEW
74
    str += `&filterByToolType=${query.get('filterByToolType')}`;
×
75
  }
NEW
76
  if (query.get('page')) {
×
NEW
77
    str += `&page=${query.get('page')}`;
×
78
  }
NEW
79
  if (query.get('pageSize')) {
×
NEW
80
    str += `&pageSize=${query.get('pageSize')}`;
×
81
  }
NEW
82
  if (query.get('sortBy')) {
×
NEW
83
    str += `&sortBy=${query.get('sortBy')}`;
×
84
  }
NEW
85
  str += `&sortOrder=${sortOrder}`;
×
NEW
86
  return str.substring(1);
×
87
};
88

89
const Sorting = ({
2✔
90
  sort = {},
1✔
91
}) => {
92
  const sortV = sort && sort.v ? sort.v : 'desc';
72✔
93
  const query = useQuery();
72✔
94
  const history = useHistory();
72✔
95

96
  const handleASCSorting = () => {
72✔
NEW
97
    const queryStr = replaceQueryStr(query, 'asc');
×
NEW
98
    history.push(`/resources?${queryStr}`);
×
99
  };
100

101
  const handleDESCSorting = () => {
72✔
NEW
102
    const queryStr = replaceQueryStr(query, 'desc');
×
NEW
103
    history.push(`/resources?${queryStr}`);
×
104
  };
105

106
  return (
72✔
107
    <>
108
      <SortingContainer data-testid="sorting-container">
109
        <SortingLabel>
110
          SORT BY TITLE
111
        </SortingLabel>
112
      </SortingContainer>
113
      {
114
        sortV === 'asc'
36✔
115
          ? (
116
            <>
117
              <SortingOrderASC data-testid="sorting-asc-active" onClick={handleASCSorting} />
118
              <SortingOrderDESCInactive data-testid="sorting-desc-inactive" onClick={handleDESCSorting} />
119
            </>
120
          )
121
          : (
122
            <>
123
              <SortingOrderASCInactive data-testid="sorting-asc-inactive" onClick={handleASCSorting} />
124
              <SortingOrderDESC data-testid="sorting-desc-active" onClick={handleDESCSorting} />
125
            </>
126
          )
127
      }
128
    </>
129
  );
130
};
131

132
export default Sorting;
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

© 2026 Coveralls, Inc