Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
#!/bin/sh
# yarn test
[ -n "$CI" ] && exit 0

echo "Running build and tests..."
yarn test && yarn build

if [ $? -ne 0 ]; then
echo "Build or tests failed. Please fix errors before pushing."
exit 1
fi
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ export const AtAGlance = ({
{timeCommitment && (
<GlanceItem item={timeCommitment} type="timeCommitment" />
)}
{stemOptText && (
<GlanceItem item={stemOptText} type="stemOptText" />
)}
{stemOptText && <GlanceItem item={stemOptText} type="stemOptText" />}
</ul>
</section>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,7 @@ const DetailPage = ({
mathIntensity={
atAGlance?.mathIntensity || resolver.getMathIntensity()
}
stemOptText={
resolver.hasStemOptText()
}

stemOptText={resolver.hasStemOptText()}
/>
)}
{!introContent?.hideRequiredCourses &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const glanceItemsMap = {
},
mathIntensity: { icon: "calculator", title: "Math intensity" },
timeCommitment: { icon: "calendar-alt", title: "Time commitment" },
stemOptText: {icon: "star", title: "STEM-OPT extension eligible"}
stemOptText: { icon: "star", title: "STEM-OPT extension eligible" },
};

const GRID_VIEW_ID = "grid-view";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { RfiSelect } from "../../controls";
* @param {{ gaData: import("../../../../../../shared/services/googleAnalytics").GAEventObject}} props
*/
// eslint-disable-next-line react/prop-types
export const Campus = ({ gaData, autoFocus}) => {
export const Campus = ({ gaData, autoFocus }) => {
const label = "Which applies to you?";
const name = "Campus";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, { useEffect, useState } from "react";

import { gaEventPropTypes, trackGAEvent } from "../../../../../../shared";
import { PII_VALUE } from "../../../core/utils/constants";
import { fetchCountries } from "../../../core/utils/fetchCountries";
import { useRfiContext } from "../../../core/utils/rfiContext";
import { RfiSelect } from "../../controls";
import { PII_VALUE } from "../../../core/utils/constants";

// Options
function getCountryOptions(resultsArrayOfObjects) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from "react";

import { gaEventPropTypes, trackGAEvent } from "../../../../../../shared";
import { RfiEmailInput } from "../../controls";
import { PII_VALUE } from "../../../core/utils/constants";
import { RfiEmailInput } from "../../controls";

/**
* @param {{ gaData: import("../../../../../../shared/services/googleAnalytics").GAEventObject}} props
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from "react";

import { gaEventPropTypes, trackGAEvent } from "../../../../../../shared";
import { RfiTextInput } from "../../controls";
import { PII_VALUE } from "../../../core/utils/constants";
import { RfiTextInput } from "../../controls";

/**
* @param {{ gaData: import("../../../../../../shared/services/googleAnalytics").GAEventObject}} props
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from "react";

import { gaEventPropTypes, trackGAEvent } from "../../../../../../shared";
import { RfiTextInput } from "../../controls";
import { PII_VALUE } from "../../../core/utils/constants";
import { RfiTextInput } from "../../controls";

/**
* @param {{ gaData: import("../../../../../../shared/services/googleAnalytics").GAEventObject}} props
Expand Down
2 changes: 1 addition & 1 deletion packages/app-rfi/src/components/steps/questions/Phone.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from "react";

import { gaEventPropTypes, trackGAEvent } from "../../../../../../shared";
import { RfiPhone } from "../../controls";
import { PII_VALUE } from "../../../core/utils/constants";
import { RfiPhone } from "../../controls";

/**
* @param {{ gaData: import("../../../../../../shared/services/googleAnalytics").GAEventObject}} props
Expand Down
4 changes: 2 additions & 2 deletions packages/app-webdir-ui/src/ProfileCard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ const ProfileCard = ({ ...props }) => {
<ul className="person-contact-info">
{props.email && (
<li>
<span className="fas fa-envelope"/>
<span className="fas fa-envelope" />
<a
onClick={() => sendEvent(props.email)}
href={`mailto:${props.email.toLowerCase()}`}
Expand All @@ -108,7 +108,7 @@ const ProfileCard = ({ ...props }) => {
)}
{formattedTelephone && (
<li>
<span className="fas fa-phone"/>
<span className="fas fa-phone" />
<a
onClick={() => sendEvent(formattedTelephone)}
href={`tel:${formattedTelephone}`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const WebDirLayout = styled.div`
.uds-grid > .row {
gap: 1rem;
& > div {
flex: 0 0 282px;
flex: 0 0 282px;
}
}

Expand Down Expand Up @@ -47,7 +47,7 @@ const FacultyRankLayout = styled.div`
.uds-grid > .row {
gap: 1rem;
& > div {
flex: 0 0 282px;
flex: 0 0 282px;
}
}
.view-toggle {
Expand Down
4 changes: 1 addition & 3 deletions packages/app-webdir-ui/src/grid/grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,7 @@ const Grid = ({

return (
<div className={`uds-grid ${className || ""}`}>
<div className={`row ${rowClassName || ""}`}>
{renderContent()}
</div>
<div className={`row ${rowClassName || ""}`}>{renderContent()}</div>
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ const StyledFooter = styled.footer`
sans-serif;
line-height: 1.5rem;

a:focus, button:focus {
a:focus,
button:focus {
outline: none;
box-shadow: 0 0 0 2px var(--color-base-white), 0 0 0 4px var(--color-base-grey-7) !important;
-webkit-tap-highlight-color: transparent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
// @ts-check
import { render, fireEvent, cleanup } from "@testing-library/react";
import React from "react";

import { NavbarContainer, BUTTON_ERROR_MESSAGE } from ".";

import { trackGAEvent } from "../../../../../../../shared";
import { AppContextProvider } from "../../../core/context/app-context";

jest.mock("../../../../../../../shared", () => ({
idGenerator: jest.fn().mockImplementation(function* () {
Expand All @@ -11,9 +15,6 @@ jest.mock("../../../../../../../shared", () => ({
trackGAEvent: jest.fn(),
}));

import { NavbarContainer, BUTTON_ERROR_MESSAGE } from ".";
import { AppContextProvider } from "../../../core/context/app-context";

const stateWithButtons = {
navTree: [
{
Expand Down Expand Up @@ -66,12 +67,12 @@ const stateWithButtons = {
buttons: [
{ text: "Login", href: "/login" },
{ text: "Sign Up", onClick: jest.fn() },
{ text: "Contact", onClick: jest.fn(), href: "#" }
{ text: "Contact", onClick: jest.fn(), href: "#" },
],
breakpoint: "lg"
breakpoint: "lg",
};

const renderNavbarContainer = (props) => {
const renderNavbarContainer = props => {
return render(
<AppContextProvider initialValue={props}>
<NavbarContainer />
Expand Down Expand Up @@ -133,7 +134,9 @@ describe("#NavbarContainer Button Tests", () => {
it("should log an error for buttons with both onClick and href", () => {
cleanup();

const consoleErrorSpy = jest.spyOn(console, "error").mockImplementation(() => {});
const consoleErrorSpy = jest
.spyOn(console, "error")
.mockImplementation(() => {});

renderNavbarContainer(stateWithButtons);

Expand All @@ -145,13 +148,14 @@ describe("#NavbarContainer Button Tests", () => {
it("should not render buttons section when no buttons exist in context", () => {
const stateWithoutButtons = {
...stateWithButtons,
buttons: []
buttons: [],
};

cleanup();
const noButtonsComponent = renderNavbarContainer(stateWithoutButtons);

const buttonsContainer = noButtonsComponent.queryByTestId("buttons-container");
const buttonsContainer =
noButtonsComponent.queryByTestId("buttons-container");
expect(buttonsContainer).not.toBeInTheDocument();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,13 @@ DropdownItem.propTypes = {
dropdownName: PropTypes.string,
items: PropTypes.arrayOf(
PropTypes.arrayOf(
PropTypes.shape({
text: PropTypes.string,
selected: PropTypes.bool,
onClick: PropTypes.func,
href: PropTypes.string,
})
)
PropTypes.shape({
text: PropTypes.string,
selected: PropTypes.bool,
onClick: PropTypes.func,
href: PropTypes.string,
})
)
),
buttons: PropTypes.arrayOf(PropTypes.shape(ButtonPropTypes)),
classes: PropTypes.string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,15 @@ describe("#Navbar Container Component with onClick and no href", () => {
navTree: testNavTreeWithOnClickEventAndNoHref.map(item => ({
...item,
onClick: item.items?.length ? undefined : () => onClick(),
items: item.items?.map(subMenu =>
subMenu.map(subItem => ({
...subItem,
onClick: subItem.onClick ? () => subMenuOnClick() : () => undefined,
}))
) || undefined,
items:
item.items?.map(subMenu =>
subMenu.map(subItem => ({
...subItem,
onClick: subItem.onClick
? () => subMenuOnClick()
: () => undefined,
}))
) || undefined,
})),
});
navItems = component.queryAllByTestId("nav-item");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe("#Button", () => {

it("should call onClick", () => {
fireEvent.click(element);
expect(buttonOnClick).toBeCalledTimes(1);
expect(buttonOnClick).toHaveBeenCalledTimes(1);
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ describe("#Button Icon", () => {

it("should call onClick", () => {
fireEvent.click(element);
expect(buttonOnClick).toBeCalledTimes(1);
expect(buttonOnClick).toHaveBeenCalledTimes(1);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe("#Tag Button", () => {

it("should call onClick", () => {
fireEvent.click(element);
expect(buttonOnClick).toBeCalledTimes(1);
expect(buttonOnClick).toHaveBeenCalledTimes(1);
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import {
} from "../../../../../shared";
import { Button } from "../Button/Button";
import { GaEventWrapper } from "../GaEventWrapper/GaEventWrapper";
import { AnchorMenuWrapper } from "./AnchorMenu.styles";
import { useBaseSpecificFramework } from "../GaEventWrapper/useBaseSpecificFramework";
import { AnchorMenuWrapper } from "./AnchorMenu.styles";

const menuTitle = "On This Page";

Expand All @@ -44,7 +44,6 @@ export const AnchorMenu = ({
firstElementId,
focusFirstFocusableElement = false,
}) => {

const { isReact, isBootstrap } = useBaseSpecificFramework();

const anchorMenuRef = useRef(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ export const Pagination = ({
};

const renderPages = () => {

if (totalPages < 5) {
return (
<>
Expand Down Expand Up @@ -119,7 +118,7 @@ export const Pagination = ({
1
</PageItem>
)}
{selectedPage > (totalPages - displayMinimumPages ) && (
{selectedPage > totalPages - displayMinimumPages && (
<PageItem
isClickeable
ariaLabel={`Page 2 of ${totalPages}`}
Expand All @@ -144,10 +143,10 @@ export const Pagination = ({
{renderedPages[renderedPages.length - 1] < totalPages - 1 && (
<PageItem ellipses>...</PageItem>
)}
{selectedPage < displayMinimumPages + 1 && (
{selectedPage < displayMinimumPages + 1 && (
<PageItem
isClickeable
ariaLabel={`Page ${totalPages-1} of ${totalPages}`}
ariaLabel={`Page ${totalPages - 1} of ${totalPages}`}
selectedPage={selectedPage === totalPages - 1}
onClick={e => handleChangePage(e, totalPages - 1)}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import PropTypes from "prop-types";
import React from "react";

import { GaEventWrapper } from "../../GaEventWrapper/GaEventWrapper";
import { NavControlButtons } from "./NavControls.styles";
import { useBaseSpecificFramework } from "../../GaEventWrapper/useBaseSpecificFramework";
import { NavControlButtons } from "./NavControls.styles";

/**
* @typedef {Object} NavControlsProps
Expand Down