diff --git a/client-html/jest.config.js b/client-html/jest.config.js index 7ae4c938dec..59541e65f2e 100644 --- a/client-html/jest.config.js +++ b/client-html/jest.config.js @@ -10,6 +10,9 @@ module.exports = { tsconfig: "tsconfig.test.json", }, }, + setupFiles: [ + "/src/tests/tests.setup.ts" + ], transform: { ".+\\.(css|styl|less|sass|scss|png|jpg|gif|svg|ttf|woff|woff2)$": "jest-transform-stub", }, diff --git a/client-html/src/js/common/components/form/formFields/EditInPlaceDateTimeField.tsx b/client-html/src/js/common/components/form/formFields/EditInPlaceDateTimeField.tsx index 9a70155bf53..bcc1f1e777b 100644 --- a/client-html/src/js/common/components/form/formFields/EditInPlaceDateTimeField.tsx +++ b/client-html/src/js/common/components/form/formFields/EditInPlaceDateTimeField.tsx @@ -30,7 +30,9 @@ import IconButton from "@mui/material/IconButton"; import TextField from "@mui/material/TextField"; import { DateTimeField } from "./DateTimeField"; import { formatStringDate } from "../../../utils/dates/formatString"; -import { HH_MM_COLONED, III_DD_MMM_YYYY, III_DD_MMM_YYYY_HH_MM, YYYY_MM_DD_MINUSED } from "../../../utils/dates/format"; +import { + HH_MM_COLONED, III_DD_MMM_YYYY, III_DD_MMM_YYYY_HH_MM, YYYY_MM_DD_MINUSED +} from "../../../utils/dates/format"; import { appendTimezone, appendTimezoneToUTC } from "../../../utils/dates/formatTimezone"; const styles = theme => createStyles({ @@ -180,13 +182,10 @@ const EditInPlaceDateTimeField: React.FC = ( fieldClasses = {}, formatting = "primary", meta: { error, invalid }, - InputProps = {}, labelAdornment, helperText, label, listSpacing = true, - hideLabel, - editableComponent, disabled, formatValue, className, @@ -194,7 +193,6 @@ const EditInPlaceDateTimeField: React.FC = ( placeholder, inlineMargin, persistValue, - ...custom } ) => { const [isEditing, setIsEditing] = useState(false); @@ -393,20 +391,20 @@ const EditInPlaceDateTimeField: React.FC = ( onKeyDown={onEnterPress} inputRef={inputNode} inputProps={{ - size: isInline && renderedValue ? renderedValue.length + 1 : undefined, - className: clsx({ - [classes.inlineInput]: isInline, - [classes.readonly]: disabled, - }), - placeholder: placeholder || (!isEditing && "No value"), - }} + size: isInline && renderedValue ? renderedValue.length + 1 : undefined, + className: clsx({ + [classes.inlineInput]: isInline, + [classes.readonly]: disabled, + }), + placeholder: placeholder || (!isEditing && "No value"), + }} value={textValue} classes={{ - root: clsx(classes.input, fieldClasses.text, isInline && classes.inlineInput, - classes.inputWrapper), - underline: fieldClasses.underline, - input: clsx(classes.input, fieldClasses.text) - }} + root: clsx(classes.input, fieldClasses.text, isInline && classes.inlineInput, + classes.inputWrapper), + underline: fieldClasses.underline, + input: clsx(classes.input, fieldClasses.text) + }} endAdornment={( { const label = this.getOptionLabel(data); - const content = getHighlightedPartLabel(label, searchValue); + const content = getHighlightedPartLabel(label, searchValue, optionProps); let option = content; diff --git a/client-html/src/js/common/components/form/formFields/EditInPlaceSearchSelect.tsx b/client-html/src/js/common/components/form/formFields/EditInPlaceSearchSelect.tsx index f9a27e94fdf..38c1fd7519c 100644 --- a/client-html/src/js/common/components/form/formFields/EditInPlaceSearchSelect.tsx +++ b/client-html/src/js/common/components/form/formFields/EditInPlaceSearchSelect.tsx @@ -78,13 +78,6 @@ const searchStyles = theme => createStyles({ maxWidth: "calc(100% * 1.4)" } }, - option: { - whiteSpace: "nowrap", - "& > span:last-child": { - overflow: "hidden", - textOverflow: "ellipsis" - } - }, inline: { fontSize: "inherit" }, @@ -251,7 +244,6 @@ const EditInPlaceSearchSelect: React.FC = ({ : [...items] ), [items, selectLabelCondition, selectLabelMark, sortPropKey]); - const isAdornmentHovered = useRef(false); const inputNode = useRef(null); const [searchValue, setSearchValue] = useState(""); @@ -273,10 +265,6 @@ const EditInPlaceSearchSelect: React.FC = ({ }, [selectLabelCondition, formattedDisplayValue, defaultDisplayValue, sortedItems, input.value]); const onBlur = () => { - if (isAdornmentHovered.current) { - return; - } - setIsEditing(false); if (!inline) { @@ -289,24 +277,6 @@ const EditInPlaceSearchSelect: React.FC = ({ } }; - const onAdornmentOver = () => { - isAdornmentHovered.current = true; - }; - - const onAdornmentOut = () => { - isAdornmentHovered.current = false; - }; - - const onAdornmentClick = e => { - if (isAdornmentHovered.current) { - e.preventDefault(); - } - setTimeout(() => { - isAdornmentHovered.current = false; - onBlur(); - }, 1000); - }; - const formatCreateLabel = inputValue => `${createLabel} "${inputValue}"`; const filterItems = items => { @@ -455,13 +425,11 @@ const EditInPlaceSearchSelect: React.FC = ({ }; const renderOption = (optionProps, data) => { - const option = getHighlightedPartLabel(getOptionLabel(data), searchValue); - if (typeof itemRenderer === "function") { - return itemRenderer(option, data, searchValue) as any; + return itemRenderer(getHighlightedPartLabel(getOptionLabel(data), searchValue), data, searchValue, optionProps) as any; } - return option as any; + return getHighlightedPartLabel(getOptionLabel(data), searchValue, optionProps); }; const displayedValue = useMemo(() => { @@ -488,7 +456,7 @@ const EditInPlaceSearchSelect: React.FC = ({ }, [formattedDisplayValue, selectLabelCondition, alwaysDisplayDefault, returnType, defaultDisplayValue, selectLabelMark, input, classes]); const labelContent = useMemo(() => (labelAdornment ? ( - + {label} {' '} {labelAdornment} @@ -529,7 +497,6 @@ const EditInPlaceSearchSelect: React.FC = ({ onChange={handleChange} classes={{ root: clsx("d-inline-flex", classes.root), - option: itemRenderer ? null : classes.option, hasPopupIcon: classes.hasPopup, hasClearIcon: classes.hasClear, inputRoot: clsx(classes.inputWrapper, isEditing && classes.isEditing) @@ -649,7 +616,7 @@ const EditInPlaceSearchSelect: React.FC = ({ /> -)} + )} ); }; diff --git a/client-html/src/js/common/components/form/formFields/SelectCustomComponents.tsx b/client-html/src/js/common/components/form/formFields/SelectCustomComponents.tsx index aa563ce830a..2993651708f 100644 --- a/client-html/src/js/common/components/form/formFields/SelectCustomComponents.tsx +++ b/client-html/src/js/common/components/form/formFields/SelectCustomComponents.tsx @@ -12,6 +12,7 @@ import { createStyles } from "@mui/styles"; import { green } from "@mui/material/colors"; import clsx from "clsx"; import { AppTheme } from "../../../../model/common/Theme"; +import { Typography } from "@mui/material"; export const selectStyles = theme => createStyles({ textField: { @@ -84,12 +85,18 @@ export const selectStyles = theme => createStyles({ const listRef = React.createRef(); -export const ListRow = React.memo(({ data, index, style }) => React.cloneElement(data[index], { - style: { +export const ListRow = React.memo(({ data, index, style }) => { + const inlineStyle = { ...style, - top: style.top + 8, - }, -}), areEqual); + top: (style.top as number) + 8, + }; + + return ( + + {data[index]} + + ); +}, areEqual); const OuterElementContext = React.createContext({}); diff --git a/client-html/src/js/common/components/layout/TabsList.tsx b/client-html/src/js/common/components/layout/TabsList.tsx index 7e84502bd13..693d58d924e 100644 --- a/client-html/src/js/common/components/layout/TabsList.tsx +++ b/client-html/src/js/common/components/layout/TabsList.tsx @@ -110,14 +110,14 @@ const TabsList = React.memo(({ const [expanded, setExpanded] = useState([]); useEffect(() => { - const stored = JSON.parse(LSGetItem(TABLIST_LOCAL_STORAGE_KEY) || ""); + const stored = JSON.parse(LSGetItem(TABLIST_LOCAL_STORAGE_KEY)); if (stored && stored[itemProps.rootEntity]) { setExpanded(stored[itemProps.rootEntity]); } }, []); useEffect(() => { - const stored = JSON.parse(LSGetItem(TABLIST_LOCAL_STORAGE_KEY) || ""); + const stored = JSON.parse(LSGetItem(TABLIST_LOCAL_STORAGE_KEY)); let updated = {}; if (stored) { updated = { ...stored }; diff --git a/client-html/src/js/common/styles/GlobalStylesProvider.tsx b/client-html/src/js/common/styles/GlobalStylesProvider.tsx index 90ff0942678..a79f37e3398 100644 --- a/client-html/src/js/common/styles/GlobalStylesProvider.tsx +++ b/client-html/src/js/common/styles/GlobalStylesProvider.tsx @@ -331,7 +331,7 @@ const globalStyles = (theme: AppTheme) => } }, ".errorColor": { - color: theme.palette.error.main + color: theme.palette.error.light }, ".errorBackgroundColor": { backgroundColor: theme.palette.error.main @@ -339,12 +339,6 @@ const globalStyles = (theme: AppTheme) => ".errorColorFade-0-2": { color: alpha(theme.palette.error.main, 0.2) }, - ".errorDarkColor": { - color: theme.palette.error.dark - }, - ".errorDarkBackgroundColor": { - backgroundColor: theme.palette.error.dark - }, ".errorContrastColor": { color: theme.palette.error.contrastText }, @@ -352,13 +346,13 @@ const globalStyles = (theme: AppTheme) => color: theme.palette.primary.main }, ".warningColor": { - color: theme.palette.warning.main + color: theme.palette.warning.light }, ".successColor": { - color: theme.palette.success.main + color: theme.palette.success.light }, ".successBackgroundColor": { - backgroundColor: theme.palette.success.main + backgroundColor: theme.palette.success.light }, ".primaryContarstText": { color: theme.palette.primary.contrastText @@ -432,10 +426,7 @@ const globalStyles = (theme: AppTheme) => padding: theme.spacing(1) }, ".listHeadingPadding": { - padding: `${theme.spacing(1) + 4}px ${theme.spacing(3)}px`, - display: "flex", - justifyContent: "space-between", - height: "auto" + padding: theme.spacing(1.5,3), }, ".appHeaderFontSize": { fontSize: "1.125rem" diff --git a/client-html/src/js/common/themes/ishTheme.ts b/client-html/src/js/common/themes/ishTheme.ts index c27da06f1fb..b145b5c3196 100644 --- a/client-html/src/js/common/themes/ishTheme.ts +++ b/client-html/src/js/common/themes/ishTheme.ts @@ -130,31 +130,15 @@ const createOverrides = (palette):{ components: Components } => ({ }, MuiCssBaseline: { styleOverrides: { - "@global": { - body: { - fontFeatureSettings: - '"dlig" 0, "numr" 0, "dnom" 0, "tnum" 0, "case" 0, "zero" 0, "frac" 0, ' - + '"sups" 0, "subs" 0, "cpsp" 0, "salt" 0, "ss01" 0, "ss02" 0, "ss03" 0, ' - + '"cv01", "cv02", "cv03", "cv04", "cv05", "cv06", "cv07", "cv08", "cv09", ' - + '"cv10", "cv11", "calt", "liga", "kern"' - } + body: { + fontFeatureSettings: + '"dlig" 0, "numr" 0, "dnom" 0, "tnum" 0, "case" 0, "zero" 0, "frac" 0, ' + + '"sups" 0, "subs" 0, "cpsp" 0, "salt" 0, "ss01" 0, "ss02" 0, "ss03" 0, ' + + '"cv01", "cv02", "cv03", "cv04", "cv05", "cv06", "cv07", "cv08", "cv09", ' + + '"cv10", "cv11", "calt", "liga", "kern"' } } }, - // MuiPickerDTTabs: { - // styleOverrides: { - // tabs: { - // color: palette.primary.contrastText - // } - // } - // }, - // PrivateTabIndicator: { - // styleOverrides: { - // colorSecondary: { - // backgroundColor: palette.primary.contrastText - // } - // } - // }, MuiMenuItem: { styleOverrides: { root: { diff --git a/client-html/src/js/common/utils/formatting/index.tsx b/client-html/src/js/common/utils/formatting/index.tsx index 37b22e9ca08..74cb82c09b1 100644 --- a/client-html/src/js/common/utils/formatting/index.tsx +++ b/client-html/src/js/common/utils/formatting/index.tsx @@ -2,12 +2,12 @@ import React from "react"; import parse from "autosuggest-highlight/parse"; import match from "autosuggest-highlight/match"; -export const getHighlightedPartLabel = (label: string, highlighted: string) => { +export const getHighlightedPartLabel = (label: string, highlighted: string, options?: any) => { const matches = match(label, highlighted); const parts = parse(label, matches); return ( -
+
{parts.map((part, index) => ( {part.highlight ? {part.text} : part.text} ))} diff --git a/client-html/src/js/common/utils/hooks/index.ts b/client-html/src/js/common/utils/hooks/index.ts index d119e9fd1d6..485a078a7bc 100644 --- a/client-html/src/js/common/utils/hooks/index.ts +++ b/client-html/src/js/common/utils/hooks/index.ts @@ -45,7 +45,6 @@ function fire(stuck) { export const useStickyScrollSpy = () => { const scrollSpy = (e) => { - console.log(e); if (e.target) { fire(e.target.scrollTop > 20); } diff --git a/client-html/src/js/common/utils/storage/index.ts b/client-html/src/js/common/utils/storage/index.ts index 09ad24e43ff..e184d989f19 100644 --- a/client-html/src/js/common/utils/storage/index.ts +++ b/client-html/src/js/common/utils/storage/index.ts @@ -6,6 +6,7 @@ export const LSGetItem = (key: string) => { try { return localStorage.getItem(key); } catch (e) { + console.error(e); return null; } }; @@ -14,7 +15,7 @@ export const LSSetItem = (key: string, value: string) => { try { localStorage.setItem(key, value); } catch (e) { - // + console.error(e); } }; @@ -22,7 +23,7 @@ export const LSRemoveItem = (key: string) => { try { localStorage.removeItem(key); } catch (e) { - // + console.error(e); } }; diff --git a/client-html/src/js/containers/entities/contacts/components/ContactSelectItemRenderer.tsx b/client-html/src/js/containers/entities/contacts/components/ContactSelectItemRenderer.tsx index 4e8b8007649..aeacdf7b5d3 100644 --- a/client-html/src/js/containers/entities/contacts/components/ContactSelectItemRenderer.tsx +++ b/client-html/src/js/containers/entities/contacts/components/ContactSelectItemRenderer.tsx @@ -10,9 +10,13 @@ import Typography from "@mui/material/Typography"; import { Contact } from "@api/model"; import { D_MMM_YYYY } from "../../../../common/utils/dates/format"; -const ContactSelectItemRenderer = React.memo<{ content: string; data: Contact }>(props => { - const { content, data } = props; +interface Props { + content: string; + data: Contact ; + parentProps: any +} +const ContactSelectItemRenderer = React.memo(({ content, data, parentProps }) => { const caption = useMemo( () => ( @@ -25,17 +29,19 @@ const ContactSelectItemRenderer = React.memo<{ content: string; data: Contact }> ); return ( -
-
- {content} +
+
+
+ {content} +
+ + + {caption} + +
- - - {caption} - -
); }); -export default (content, data) => ; +export default (content, data, search, parentProps) => ; diff --git a/client-html/src/js/containers/entities/contacts/components/ContactsEducation.tsx b/client-html/src/js/containers/entities/contacts/components/ContactsEducation.tsx index b299c598ea7..6a4aa8480d8 100644 --- a/client-html/src/js/containers/entities/contacts/components/ContactsEducation.tsx +++ b/client-html/src/js/containers/entities/contacts/components/ContactsEducation.tsx @@ -11,7 +11,6 @@ import { AccessState } from "../../../../common/reducers/accessReducer"; import { openInternalLink } from "../../../../common/utils/links"; import { State } from "../../../../reducers/state"; import { NestedTableColumn } from "../../../../model/common/NestedTable"; -import { getTableWrapperHeight } from "../utils"; import NestedTable from "../../../../common/components/list-view/components/list/ReactTableNestedList"; import ExpandableContainer from "../../../../common/components/layout/expandable/ExpandableContainer"; import { EditViewProps } from "../../../../model/common/ListView"; @@ -256,9 +255,6 @@ const ContactsEducation: React.FC = props => { item xs={12} className="flex-column" - style={{ - height: getTableWrapperHeight(enrolmentsCount) - }} > = props => { item xs={12} className="flex-column" - style={{ - height: getTableWrapperHeight(priorLearningsCount) - }} > = props => { item xs={12} className="flex-column" - style={{ - height: getTableWrapperHeight(outcomesCount) - }} > = props => { item xs={12} className="flex-column" - style={{ - height: getTableWrapperHeight(certificatesCount) - }} > = props => { return values ? (
- + = props => { item xs={12} className="flex-column" - style={{ - height: values.financialData && getTableWrapperHeight(values.financialData.length) - }} > = props => { const getMessagesTableTitle = () => (getMessagesCount() > 0 ? `${getMessagesCount()} ` : "") + (getMessagesCount() === 1 ? "message" : "messages"); - const tableWrapperHeight = getTableWrapperHeight(getMessagesCount()); - return values ? (
{ openInternalLink("/contact/" + contactId); }; -export const getTableWrapperHeight = (rowsCount: number) => Math.min( - rowsCount === 0 - ? DEFAULT_TITLE_HEIGHT + WRAPPER_SPACING - : rowsCount * DEFAULT_TABLE_CELL_HEIGHT + DEFAULT_TABLE_HEAD_HEIGHT + DEFAULT_TITLE_HEIGHT + WRAPPER_SPACING, - DEFAULT_TABLE_HEIGHT - ); - export const convertSelectBooleanToString = v => (typeof v === "boolean" ? String(v) : ""); export const convertSelectStringToBoolean = v => (v === "true" ? true : v === "false" ? false : ""); diff --git a/client-html/src/tests/audit/Audit.Components.test.tsx b/client-html/src/tests/audit/Audit.Components.test.tsx index a7b0582f2b7..9ff40cf679f 100644 --- a/client-html/src/tests/audit/Audit.Components.test.tsx +++ b/client-html/src/tests/audit/Audit.Components.test.tsx @@ -5,17 +5,17 @@ import { mockedEditView } from "../common/MockedEditView.Components"; // TODO Enable test on fix -describe("Virtual rendered AuditsEditView", () => { +describe.skip("Virtual rendered AuditsEditView", () => { mockedEditView({ entity: "Audit", EditView: AuditsEditView, record: mockedApi => mockedApi.db.getAudit(1), render: (wrapper, initialValues) => { - // expect(wrapper.find("#created input").val()).toContain(format(new Date(initialValues.created), III_DD_MMM_YYYY_HH_MM)); - // expect(wrapper.find("#entityIdentifier input").val()).toContain(initialValues.entityIdentifier); - // expect(wrapper.find("#entityId input").val()).toContain(initialValues.entityId); - // expect(wrapper.find("#action input").val()).toContain(initialValues.action); - // expect(wrapper.find("#message textarea").val()).toContain(initialValues.message); + expect(wrapper.find("#created input").val()).toContain(format(new Date(initialValues.created), III_DD_MMM_YYYY_HH_MM)); + expect(wrapper.find("#entityIdentifier input").val()).toContain(initialValues.entityIdentifier); + expect(wrapper.find("#entityId input").val()).toContain(initialValues.entityId); + expect(wrapper.find("#action input").val()).toContain(initialValues.action); + expect(wrapper.find("#message textarea").val()).toContain(initialValues.message); } }); }); diff --git a/client-html/src/tests/checkout/summary/CheckoutPreviousInvoiceList.Component.test.tsx b/client-html/src/tests/checkout/summary/CheckoutPreviousInvoiceList.Component.test.tsx index 3a3681e6a07..9e724494129 100644 --- a/client-html/src/tests/checkout/summary/CheckoutPreviousInvoiceList.Component.test.tsx +++ b/client-html/src/tests/checkout/summary/CheckoutPreviousInvoiceList.Component.test.tsx @@ -7,7 +7,7 @@ import { decimalPlus } from "../../../js/common/utils/numbers/decimalCalculation // TODO Enable test when find solution to test @mui checkboxes -describe("Virtual rendered CheckoutPreviousInvoiceList", () => { +describe.skip("Virtual rendered CheckoutPreviousInvoiceList", () => { defaultComponents({ entity: "CheckoutPreviousInvoiceList", View: props => , @@ -41,11 +41,11 @@ describe("Virtual rendered CheckoutPreviousInvoiceList", () => { const count = initialValues.length; let i; - // expect(shallow.find("input[type='checkbox']").at(0).props().checked).toEqual(true); - // - // for (i = 1; i <= count; i++) { - // expect(shallow.find("input[type='checkbox']").at(i).props().checked).toEqual(true); - // } + expect(shallow.find("input[type='checkbox']").at(0).props().checked).toEqual(true); + + for (i = 1; i <= count; i++) { + expect(shallow.find("input[type='checkbox']").at(i).props().checked).toEqual(true); + } } }); }); diff --git a/client-html/src/tests/entities/bankings/Banking.Components.test.tsx b/client-html/src/tests/entities/bankings/Banking.Components.test.tsx index 5b231834aef..8dfd0ccaa70 100644 --- a/client-html/src/tests/entities/bankings/Banking.Components.test.tsx +++ b/client-html/src/tests/entities/bankings/Banking.Components.test.tsx @@ -5,16 +5,16 @@ import { mockedEditView } from "../../common/MockedEditView.Components"; // TODO Enable test on fix -describe("Virtual rendered BankingEditView", () => { +describe.skip("Virtual rendered BankingEditView", () => { mockedEditView({ entity: "Banking", EditView: BankingEditView, record: mockecApi => mockecApi.db.getBanking(1), render: (wrapper, initialValues) => { - // expect(wrapper.find("div.textField").text()).toContain(initialValues.adminSite); - // expect(wrapper.find("#settlementDate input").val()).toContain( - // format(new Date(initialValues.settlementDate), III_DD_MMM_YYYY).toString() - // ); + expect(wrapper.find("div.textField").text()).toContain(initialValues.adminSite); + expect(wrapper.find("#settlementDate input").val()).toContain( + format(new Date(initialValues.settlementDate), III_DD_MMM_YYYY).toString() + ); } }); }); diff --git a/client-html/src/tests/entities/certificates/Certificate.Components.test.tsx b/client-html/src/tests/entities/certificates/Certificate.Components.test.tsx index 44aae9333bd..277e3a35ad8 100644 --- a/client-html/src/tests/entities/certificates/Certificate.Components.test.tsx +++ b/client-html/src/tests/entities/certificates/Certificate.Components.test.tsx @@ -5,21 +5,21 @@ import { mockedEditView } from "../../common/MockedEditView.Components"; // TODO Enable test on fix -describe("Virtual rendered CertificateEditView", () => { +describe.skip("Virtual rendered CertificateEditView", () => { mockedEditView({ entity: "Certificate", EditView: CertificateEditView, record: mockecApi => mockecApi.db.getCertificate(1), render: (wrapper, initialValues) => { - // expect(wrapper.find("#studentContactId input").val()).toContain(initialValues.studentName); - // expect(wrapper.find("#nationalCode input").val()).toContain(initialValues.nationalCode); - // expect(wrapper.find("#title input").val()).toContain(initialValues.title); - // expect(wrapper.find("#awardedOn input").val()).toContain( - // format(new Date(initialValues.awardedOn), III_DD_MMM_YYYY).toString() - // ); - // expect(wrapper.find("#issuedOn input").val()).toContain( - // format(new Date(initialValues.issuedOn), III_DD_MMM_YYYY).toString() - // ); + expect(wrapper.find("#studentContactId input").val()).toContain(initialValues.studentName); + expect(wrapper.find("#nationalCode input").val()).toContain(initialValues.nationalCode); + expect(wrapper.find("#title input").val()).toContain(initialValues.title); + expect(wrapper.find("#awardedOn input").val()).toContain( + format(new Date(initialValues.awardedOn), III_DD_MMM_YYYY).toString() + ); + expect(wrapper.find("#issuedOn input").val()).toContain( + format(new Date(initialValues.issuedOn), III_DD_MMM_YYYY).toString() + ); } }); }); diff --git a/client-html/src/tests/entities/corporatePasses/CorporatePass.Components.test.tsx b/client-html/src/tests/entities/corporatePasses/CorporatePass.Components.test.tsx index 1233d9aa6bd..1e073eeceb1 100644 --- a/client-html/src/tests/entities/corporatePasses/CorporatePass.Components.test.tsx +++ b/client-html/src/tests/entities/corporatePasses/CorporatePass.Components.test.tsx @@ -5,18 +5,18 @@ import { mockedEditView } from "../../common/MockedEditView.Components"; // TODO Enable test on fix -describe("Virtual rendered CorporatePassEditView", () => { +describe.skip("Virtual rendered CorporatePassEditView", () => { mockedEditView({ entity: "CorporatePass", EditView: CorporatePassEditView, record: mockecApi => mockecApi.db.getCorporatePass(1), render: (wrapper, initialValues) => { - // expect(wrapper.find("#contactId input").val()).toContain(initialValues.contactFullName); - // expect(wrapper.find("#password input").val()).toContain(initialValues.password); - // expect(wrapper.find("#invoiceEmail input").val()).toContain(initialValues.invoiceEmail); - // expect(wrapper.find("#expiryDate input").val()).toContain( - // format(new Date(initialValues.expiryDate), III_DD_MMM_YYYY).toString() - // ); + expect(wrapper.find("#contactId input").val()).toContain(initialValues.contactFullName); + expect(wrapper.find("#password input").val()).toContain(initialValues.password); + expect(wrapper.find("#invoiceEmail input").val()).toContain(initialValues.invoiceEmail); + expect(wrapper.find("#expiryDate input").val()).toContain( + format(new Date(initialValues.expiryDate), III_DD_MMM_YYYY).toString() + ); } }); }); diff --git a/client-html/src/tests/entities/courseClasses/DuplicateTraineeshipModal.Component.test.tsx b/client-html/src/tests/entities/courseClasses/DuplicateTraineeshipModal.Component.test.tsx index 9714c22392f..8eb1d88af4c 100644 --- a/client-html/src/tests/entities/courseClasses/DuplicateTraineeshipModal.Component.test.tsx +++ b/client-html/src/tests/entities/courseClasses/DuplicateTraineeshipModal.Component.test.tsx @@ -13,7 +13,7 @@ import { defaultComponents } from "../../common/Default.Components"; // TODO Enable test when find solution to test @mui dialogs -describe("Virtual rendered DuplicateTraineeshipModal of Class list view", () => { +describe.skip("Virtual rendered DuplicateTraineeshipModal of Class list view", () => { defaultComponents({ entity: "CheckoutPreviousInvoiceList", View: props =>
, @@ -24,7 +24,7 @@ describe("Virtual rendered DuplicateTraineeshipModal of Class list view", () => setDialogOpened: stubFunction }), render: (wrapper, initial, shallow) => { - // expect(wrapper.find("div.heading").text()).toContain("Duplicate traineeship class"); + expect(wrapper.find("div.heading").text()).toContain("Duplicate traineeship class"); } }); }); diff --git a/client-html/src/tests/entities/survey/Survey.Components.test.tsx b/client-html/src/tests/entities/survey/Survey.Components.test.tsx index 3b2785eae7c..1f0759e8f75 100644 --- a/client-html/src/tests/entities/survey/Survey.Components.test.tsx +++ b/client-html/src/tests/entities/survey/Survey.Components.test.tsx @@ -3,17 +3,17 @@ import { mockedEditView } from "../../common/MockedEditView.Components"; // TODO Enable test on fix -describe("Virtual rendered SurveyEditView", () => { +describe.skip("Virtual rendered SurveyEditView", () => { mockedEditView({ entity: "Survey", EditView: SurveyEditView, record: mockecApi => mockecApi.db.getSurvey(1), render: (wrapper, initialValues) => { - // expect(wrapper.find(".textField").text()).toContain(initialValues.studentName); - // expect(wrapper.find("#EditListItemForm-netPromoterScore-1").text()).toContain(""); - // expect(wrapper.find("#EditListItemForm-netPromoterScore-2").text()).toContain(""); - // expect(wrapper.find("#comment textarea").val()).toContain(initialValues.comment); - // expect(wrapper.find("#visibility input").val()).toContain(initialValues.visibility); + expect(wrapper.find(".textField").text()).toContain(initialValues.studentName); + expect(wrapper.find("#EditListItemForm-netPromoterScore-1").text()).toContain(""); + expect(wrapper.find("#EditListItemForm-netPromoterScore-2").text()).toContain(""); + expect(wrapper.find("#comment textarea").val()).toContain(initialValues.comment); + expect(wrapper.find("#visibility input").val()).toContain(initialValues.visibility); } }); }); diff --git a/client-html/src/tests/preferences/avetmiss/AvetmissForm.test.tsx b/client-html/src/tests/preferences/avetmiss/AvetmissForm.test.tsx index 1d97938e455..413aaa8320e 100644 --- a/client-html/src/tests/preferences/avetmiss/AvetmissForm.test.tsx +++ b/client-html/src/tests/preferences/avetmiss/AvetmissForm.test.tsx @@ -6,77 +6,77 @@ import Avetmiss from "../../../js/containers/preferences/containers/avetmiss/Ave // TODO Enable test on fix -describe("Virtual rendered AvetmissForm", () => { +describe.skip("Virtual rendered AvetmissForm", () => { defaultComponents({ entity: "AvetmissForm", View: props => , record: () => ({}), defaultProps: () => ({}), render: wrapper => { - // expect(wrapper.find("#avetmiss-collegename input").val()).toEqual( - // mockedAPI.db.preference[PreferencesModel.AvetmissCollegeName.uniqueKey].toString() - // ); - // - // expect(wrapper.find("#avetmiss-jurisdiction input").val()).toEqual( - // mockedAPI.db.preference[PreferencesModel.Jurisdiction.uniqueKey].toString() - // ); - // - // expect(wrapper.find("#avetmiss-identifier input").val()).toEqual( - // mockedAPI.db.preference[PreferencesModel.Id.uniqueKey].toString() - // ); - // - // expect(wrapper.find("#avetmiss-type input").val()).toEqual( - // mockedAPI.db.preference[PreferencesModel.Type.uniqueKey].toString() - // ); - // - // expect(wrapper.find("#avetmiss-address-line1 input").val()).toEqual( - // mockedAPI.db.preference[PreferencesModel.Address1.uniqueKey].toString() - // ); - // - // expect(wrapper.find("#avetmiss-address-suburb input").val()).toEqual( - // mockedAPI.db.preference[PreferencesModel.Suburb.uniqueKey].toString() - // ); - // - // expect(wrapper.find("#avetmiss-address-line2 input").val()).toEqual( - // mockedAPI.db.preference[PreferencesModel.Address2.uniqueKey].toString() - // ); - // - // expect(wrapper.find("#avetmiss-address-postcode input").val()).toEqual( - // mockedAPI.db.preference[PreferencesModel.Postcode.uniqueKey].toString() - // ); - // - // expect(wrapper.find("#avetmiss-address-state input").val()).toEqual( - // mockedAPI.db.preference[PreferencesModel.State.uniqueKey].toString() - // ); - // - // /*---------*/ - // expect(wrapper.find("#avetmiss-contactname input").val()).toEqual( - // mockedAPI.db.preference[PreferencesModel.ContactName.uniqueKey].toString() - // ); - // - // expect(wrapper.find("#avetmiss-email input").val()).toEqual( - // mockedAPI.db.preference[PreferencesModel.Email.uniqueKey].toString() - // ); - // - // expect(wrapper.find("#avetmiss-phone input").val()).toEqual( - // mockedAPI.db.preference[PreferencesModel.Phone.uniqueKey].toString() - // ); - // - // expect(wrapper.find("#avetmiss-fax input").val()).toEqual( - // mockedAPI.db.preference[PreferencesModel.Fax.uniqueKey].toString() - // ); - // - // expect(wrapper.find("#avetmiss-certificate-signatory-name input").val()).toEqual( - // mockedAPI.db.preference[PreferencesModel.CertSignatoryName.uniqueKey].toString() - // ); - // - // expect(wrapper.find("#avetmiss-qld-identifier input").val()).toEqual( - // mockedAPI.db.preference[PreferencesModel.QldIdentifier.uniqueKey].toString() - // ); - // - // expect(wrapper.find("#avetmiss-fee-help-provider-code input").val()).toEqual( - // mockedAPI.db.preference[PreferencesModel.FeeHelpProviderCode.uniqueKey].toString() - // ); + expect(wrapper.find("#avetmiss-collegename input").val()).toEqual( + mockedAPI.db.preference[PreferencesModel.AvetmissCollegeName.uniqueKey].toString() + ); + + expect(wrapper.find("#avetmiss-jurisdiction input").val()).toEqual( + mockedAPI.db.preference[PreferencesModel.Jurisdiction.uniqueKey].toString() + ); + + expect(wrapper.find("#avetmiss-identifier input").val()).toEqual( + mockedAPI.db.preference[PreferencesModel.Id.uniqueKey].toString() + ); + + expect(wrapper.find("#avetmiss-type input").val()).toEqual( + mockedAPI.db.preference[PreferencesModel.Type.uniqueKey].toString() + ); + + expect(wrapper.find("#avetmiss-address-line1 input").val()).toEqual( + mockedAPI.db.preference[PreferencesModel.Address1.uniqueKey].toString() + ); + + expect(wrapper.find("#avetmiss-address-suburb input").val()).toEqual( + mockedAPI.db.preference[PreferencesModel.Suburb.uniqueKey].toString() + ); + + expect(wrapper.find("#avetmiss-address-line2 input").val()).toEqual( + mockedAPI.db.preference[PreferencesModel.Address2.uniqueKey].toString() + ); + + expect(wrapper.find("#avetmiss-address-postcode input").val()).toEqual( + mockedAPI.db.preference[PreferencesModel.Postcode.uniqueKey].toString() + ); + + expect(wrapper.find("#avetmiss-address-state input").val()).toEqual( + mockedAPI.db.preference[PreferencesModel.State.uniqueKey].toString() + ); + + /*---------*/ + expect(wrapper.find("#avetmiss-contactname input").val()).toEqual( + mockedAPI.db.preference[PreferencesModel.ContactName.uniqueKey].toString() + ); + + expect(wrapper.find("#avetmiss-email input").val()).toEqual( + mockedAPI.db.preference[PreferencesModel.Email.uniqueKey].toString() + ); + + expect(wrapper.find("#avetmiss-phone input").val()).toEqual( + mockedAPI.db.preference[PreferencesModel.Phone.uniqueKey].toString() + ); + + expect(wrapper.find("#avetmiss-fax input").val()).toEqual( + mockedAPI.db.preference[PreferencesModel.Fax.uniqueKey].toString() + ); + + expect(wrapper.find("#avetmiss-certificate-signatory-name input").val()).toEqual( + mockedAPI.db.preference[PreferencesModel.CertSignatoryName.uniqueKey].toString() + ); + + expect(wrapper.find("#avetmiss-qld-identifier input").val()).toEqual( + mockedAPI.db.preference[PreferencesModel.QldIdentifier.uniqueKey].toString() + ); + + expect(wrapper.find("#avetmiss-fee-help-provider-code input").val()).toEqual( + mockedAPI.db.preference[PreferencesModel.FeeHelpProviderCode.uniqueKey].toString() + ); } }); }); diff --git a/client-html/src/tests/preferences/class/ClassDefaultsForm.test.tsx b/client-html/src/tests/preferences/class/ClassDefaultsForm.test.tsx index f606627fa53..0b7a7d49a06 100644 --- a/client-html/src/tests/preferences/class/ClassDefaultsForm.test.tsx +++ b/client-html/src/tests/preferences/class/ClassDefaultsForm.test.tsx @@ -6,7 +6,7 @@ import ClassDefaults from "../../../js/containers/preferences/containers/class/C // TODO Enable test on fix -describe("Virtual rendered ClassDefaultsForm", () => { +describe.skip("Virtual rendered ClassDefaultsForm", () => { defaultComponents({ entity: "ClassDefaultsForm", View: props => , @@ -16,12 +16,12 @@ describe("Virtual rendered ClassDefaultsForm", () => { history: jest.fn() }), render: wrapper => { - // expect(wrapper.find("#courseclass_default_minimumPlaces input").val()).toContain( - // mockedAPI.db.preference[PreferencesModel.ClassMinPlaces.uniqueKey] - // ); - // expect(wrapper.find("#courseclass_default_maximumPlaces input").val()).toContain( - // mockedAPI.db.preference[PreferencesModel.ClassMaxPlaces.uniqueKey] - // ); + expect(wrapper.find("#courseclass_default_minimumPlaces input").val()).toContain( + mockedAPI.db.preference[PreferencesModel.ClassMinPlaces.uniqueKey] + ); + expect(wrapper.find("#courseclass_default_maximumPlaces input").val()).toContain( + mockedAPI.db.preference[PreferencesModel.ClassMaxPlaces.uniqueKey] + ); } }); }); diff --git a/client-html/src/tests/preferences/financial/FinancialForm.test.tsx b/client-html/src/tests/preferences/financial/FinancialForm.test.tsx index 3019d22ba19..52afb2aa19c 100644 --- a/client-html/src/tests/preferences/financial/FinancialForm.test.tsx +++ b/client-html/src/tests/preferences/financial/FinancialForm.test.tsx @@ -6,56 +6,56 @@ import Financial from "../../../js/containers/preferences/containers/financial/F // TODO Enable test on fix -describe("Virtual rendered FinancialForm", () => { +describe.skip("Virtual rendered FinancialForm", () => { defaultComponents({ entity: "FinancialForm", View: props => , record: () => ({}), defaultProps: () => ({}), render: wrapper => { - // expect(wrapper.find("#college-paymentInfo textarea").val()).toEqual( - // mockedAPI.db.preference[PreferencesModel.PaymentInfo.uniqueKey].toString() - // ); - // - // expect(wrapper.find("#account-default-debtors-id input").val()).toEqual( - // mockedAPI.db.preference[PreferencesModel.AccountDebtors.uniqueKey].toString() - // ); - // - // expect(wrapper.find("#account-default-bank-id input").val()).toEqual( - // mockedAPI.db.preference[PreferencesModel.AccountBank.uniqueKey].toString() - // ); - // - // expect(wrapper.find("#account-default-tax-id input").val()).toEqual( - // mockedAPI.db.preference[PreferencesModel.AccountTax.uniqueKey].toString() - // ); - // - // expect(wrapper.find("#account-default-studentEnrolments-id input").val()).toEqual( - // mockedAPI.db.preference[PreferencesModel.AccountStudentEnrolments.uniqueKey].toString() - // ); - // - // expect(wrapper.find("#account-prepaidFees-id input").val()).toEqual( - // mockedAPI.db.preference[PreferencesModel.AccountPrepaidFees.uniqueKey].toString() - // ); - // - // expect(wrapper.find("#account-prepaidFeesPostAt input").val()).toEqual( - // mockedAPI.db.preference[PreferencesModel.AccountPrepaidFeesPostAt.uniqueKey].toString() - // ); - // - // expect(wrapper.find("#account-default-voucherLiability-id input").val()).toEqual( - // mockedAPI.db.preference[PreferencesModel.AccountVoucherLiability.uniqueKey].toString() - // ); - // - // expect(wrapper.find("#account-default-voucherUnderpayment-id input").val()).toEqual( - // mockedAPI.db.preference[PreferencesModel.AccountVoucherUnderpayment.uniqueKey].toString() - // ); - // - // expect(wrapper.find("#default-currency input").val()).toEqual( - // mockedAPI.db.preference[PreferencesModel.AccountDefaultCurrency.uniqueKey].toString() - // ); - // - // expect(wrapper.find("#account-invoice-terms input").val()).toEqual( - // mockedAPI.db.preference[PreferencesModel.AccountInvoiceTerms.uniqueKey].toString() - // ); + expect(wrapper.find("#college-paymentInfo textarea").val()).toEqual( + mockedAPI.db.preference[PreferencesModel.PaymentInfo.uniqueKey].toString() + ); + + expect(wrapper.find("#account-default-debtors-id input").val()).toEqual( + mockedAPI.db.preference[PreferencesModel.AccountDebtors.uniqueKey].toString() + ); + + expect(wrapper.find("#account-default-bank-id input").val()).toEqual( + mockedAPI.db.preference[PreferencesModel.AccountBank.uniqueKey].toString() + ); + + expect(wrapper.find("#account-default-tax-id input").val()).toEqual( + mockedAPI.db.preference[PreferencesModel.AccountTax.uniqueKey].toString() + ); + + expect(wrapper.find("#account-default-studentEnrolments-id input").val()).toEqual( + mockedAPI.db.preference[PreferencesModel.AccountStudentEnrolments.uniqueKey].toString() + ); + + expect(wrapper.find("#account-prepaidFees-id input").val()).toEqual( + mockedAPI.db.preference[PreferencesModel.AccountPrepaidFees.uniqueKey].toString() + ); + + expect(wrapper.find("#account-prepaidFeesPostAt input").val()).toEqual( + mockedAPI.db.preference[PreferencesModel.AccountPrepaidFeesPostAt.uniqueKey].toString() + ); + + expect(wrapper.find("#account-default-voucherLiability-id input").val()).toEqual( + mockedAPI.db.preference[PreferencesModel.AccountVoucherLiability.uniqueKey].toString() + ); + + expect(wrapper.find("#account-default-voucherUnderpayment-id input").val()).toEqual( + mockedAPI.db.preference[PreferencesModel.AccountVoucherUnderpayment.uniqueKey].toString() + ); + + expect(wrapper.find("#default-currency input").val()).toEqual( + mockedAPI.db.preference[PreferencesModel.AccountDefaultCurrency.uniqueKey].toString() + ); + + expect(wrapper.find("#account-invoice-terms input").val()).toEqual( + mockedAPI.db.preference[PreferencesModel.AccountInvoiceTerms.uniqueKey].toString() + ); } }); }); diff --git a/client-html/src/tests/preferences/grading/GradingForm.Components.test.tsx b/client-html/src/tests/preferences/grading/GradingForm.Components.test.tsx index 0c9002038aa..812076a457d 100644 --- a/client-html/src/tests/preferences/grading/GradingForm.Components.test.tsx +++ b/client-html/src/tests/preferences/grading/GradingForm.Components.test.tsx @@ -4,7 +4,7 @@ import GradingTypesForm from "../../../js/containers/preferences/containers/grad // TODO Enable test on fix -describe("Virtual rendered GradingTypesForm", () => { +describe.skip("Virtual rendered GradingTypesForm", () => { defaultComponents({ entity: "GradingForm", View: props => , @@ -15,24 +15,22 @@ describe("Virtual rendered GradingTypesForm", () => { gradingTypes: initialValues }; }, - render: (wrapper, initialValues, shallow) => { + render: (wrapper, initialValues) => { initialValues.forEach((type, index) => { + expect(wrapper.find(`div[id='types[${index}].name'] input`).val()).toContain(type.name); - // expect(wrapper.find(`div[id='types[${index}].name'] input`).val()).toContain(type.name); - // - // - // expect(wrapper.find(`div[id='types[${index}].entryType'] input`).val()).toEqual(type.entryType); - // - // if (type.entryType === 'number') { - // expect(wrapper.find(`div[id='types[${index}].minValue'] input`).val()).toContain(type.minValue); - // expect(wrapper.find(`div[id='types[${index}].maxValue'] input`).val()).toContain(type.maxValue); - // } - // - // type.gradingItems.forEach((gradingItem, gIndex) => { - // expect(wrapper.find(`div[id='types[${index}].gradingItems[${gIndex}].name'] input`).val()).toContain(gradingItem.name); - // expect(wrapper.find(`div[id='types[${index}].gradingItems[${gIndex}].lowerBound'] input`).val()).toContain(gradingItem.lowerBound); - // }); + expect(wrapper.find(`div[id='types[${index}].entryType'] input`).val()).toEqual(type.entryType); + + if (type.entryType === 'number') { + expect(wrapper.find(`div[id='types[${index}].minValue'] input`).val()).toContain(type.minValue); + expect(wrapper.find(`div[id='types[${index}].maxValue'] input`).val()).toContain(type.maxValue); + } + + type.gradingItems.forEach((gradingItem, gIndex) => { + expect(wrapper.find(`div[id='types[${index}].gradingItems[${gIndex}].name'] input`).val()).toContain(gradingItem.name); + expect(wrapper.find(`div[id='types[${index}].gradingItems[${gIndex}].lowerBound'] input`).val()).toContain(gradingItem.lowerBound); + }); }); } }); diff --git a/client-html/src/tests/preferences/holidays/HolidaysForm.test.tsx b/client-html/src/tests/preferences/holidays/HolidaysForm.test.tsx index e09a79414dd..31efd014732 100644 --- a/client-html/src/tests/preferences/holidays/HolidaysForm.test.tsx +++ b/client-html/src/tests/preferences/holidays/HolidaysForm.test.tsx @@ -7,7 +7,7 @@ import Holidays from "../../../js/containers/preferences/containers/holidays/Hol // TODO Enable test on fix -describe("Virtual rendered HolidaysForm", () => { +describe.skip("Virtual rendered HolidaysForm", () => { defaultComponents({ entity: "HolidaysForm", View: props => , @@ -22,25 +22,25 @@ describe("Virtual rendered HolidaysForm", () => { }, render: (wrapper, initialValues, shallow) => { initialValues.forEach((value, index) => { - // expect(wrapper.find(`#holidays-item-${index} div[id='holidays[${index}].description'] input`).val()) - // .toEqual(value.description); - // - // expect(shallow.find(`#holidays-item-${index} input[type='checkbox']`).props().checked).toEqual(false); - // - // expect(wrapper.find(`#holidays-item-${index} div[id='holidays[${index}].startDateTime'] input`).val()).toContain( - // format(new Date(value.startDateTime), III_DD_MMM_YYYY).toString() - // ); - // - // expect(wrapper.find(`#holidays-item-${index} div[id='holidays[${index}].endDateTime'] input`).val()).toContain( - // format(new Date(value.endDateTime), III_DD_MMM_YYYY).toString() - // ); - // - // expect(wrapper.find(`#holidays-item-${index} div[id='holidays[${index}].repeat'] input`).val()).toEqual(value.repeat); - // - // if (value.repeat !== RepeatEnum.none) { - // expect(wrapper.find(`#holidays-item-${index} div[id='holidays[${index}].repeatEnd'] input`).val()) - // .toEqual(value.repeatEnd); - // } + expect(wrapper.find(`#holidays-item-${index} div[id='holidays[${index}].description'] input`).val()) + .toEqual(value.description); + + expect(shallow.find(`#holidays-item-${index} input[type='checkbox']`).props().checked).toEqual(false); + + expect(wrapper.find(`#holidays-item-${index} div[id='holidays[${index}].startDateTime'] input`).val()).toContain( + format(new Date(value.startDateTime), III_DD_MMM_YYYY).toString() + ); + + expect(wrapper.find(`#holidays-item-${index} div[id='holidays[${index}].endDateTime'] input`).val()).toContain( + format(new Date(value.endDateTime), III_DD_MMM_YYYY).toString() + ); + + expect(wrapper.find(`#holidays-item-${index} div[id='holidays[${index}].repeat'] input`).val()).toEqual(value.repeat); + + if (value.repeat !== RepeatEnum.none) { + expect(wrapper.find(`#holidays-item-${index} div[id='holidays[${index}].repeatEnd'] input`).val()) + .toEqual(value.repeatEnd); + } }); } }); diff --git a/client-html/src/tests/preferences/ldap/LDAPForm.test.tsx b/client-html/src/tests/preferences/ldap/LDAPForm.test.tsx index cea7c7268d7..72d4b21265c 100644 --- a/client-html/src/tests/preferences/ldap/LDAPForm.test.tsx +++ b/client-html/src/tests/preferences/ldap/LDAPForm.test.tsx @@ -6,7 +6,7 @@ import LDAP from "../../../js/containers/preferences/containers/ldap/LDAP"; // TODO Enable test on fix -describe("Virtual rendered LDAPForm", () => { +describe.skip("Virtual rendered LDAPForm", () => { defaultComponents({ entity: "LDAPForm", View: props => , @@ -16,47 +16,46 @@ describe("Virtual rendered LDAPForm", () => { history: jest.fn() }), render: wrapper => { + expect(wrapper.find("#ldap-host input").val()).toContain( + mockedAPI.db.preference[PreferencesModel.LdapHost.uniqueKey] + ); - // expect(wrapper.find("#ldap-host input").val()).toContain( - // mockedAPI.db.preference[PreferencesModel.LdapHost.uniqueKey] - // ); - // - // expect(wrapper.find("#ldap-bind-user-dn input").val()).toContain( - // mockedAPI.db.preference[PreferencesModel.LdapBindUserDN.uniqueKey] - // ); - // - // expect(wrapper.find("#ldap-serverport input").val()).toContain( - // mockedAPI.db.preference[PreferencesModel.LdapServerPort.uniqueKey] - // ); - // - // expect(wrapper.find("#ldap-bind-user-pass input").val()).toEqual( - // mockedAPI.db.preference[PreferencesModel.LdapBindUserPass.uniqueKey] - // ); - // - // expect(wrapper.find("#ldap-base-dn input").val()).toEqual( - // mockedAPI.db.preference[PreferencesModel.LdapBaseDN.uniqueKey] - // ); - // - // /*-----*/ - // expect(wrapper.find("#ldap-username-attibute input").val()).toEqual( - // mockedAPI.db.preference[PreferencesModel.LdapUsernameAttribute.uniqueKey] - // ); - // - // expect(wrapper.find("#ldap-user-search-filter input").val()).toEqual( - // mockedAPI.db.preference[PreferencesModel.LdapUserSearchFilter.uniqueKey] - // ); - // - // expect(wrapper.find("#ldap-group-member-attibute input").val()).toEqual( - // mockedAPI.db.preference[PreferencesModel.LdapGroupMemberAttribute.uniqueKey] - // ); - // - // expect(wrapper.find("#ldap-group-attibute input").val()).toEqual( - // mockedAPI.db.preference[PreferencesModel.LdapGroupAttribute.uniqueKey] - // ); - // - // expect(wrapper.find("#ldap-group-search-filter input").val()).toEqual( - // mockedAPI.db.preference[PreferencesModel.LdapGroupSearchFilter.uniqueKey] - // ); + expect(wrapper.find("#ldap-bind-user-dn input").val()).toContain( + mockedAPI.db.preference[PreferencesModel.LdapBindUserDN.uniqueKey] + ); + + expect(wrapper.find("#ldap-serverport input").val()).toContain( + mockedAPI.db.preference[PreferencesModel.LdapServerPort.uniqueKey] + ); + + expect(wrapper.find("#ldap-bind-user-pass input").val()).toEqual( + mockedAPI.db.preference[PreferencesModel.LdapBindUserPass.uniqueKey] + ); + + expect(wrapper.find("#ldap-base-dn input").val()).toEqual( + mockedAPI.db.preference[PreferencesModel.LdapBaseDN.uniqueKey] + ); + + /*-----*/ + expect(wrapper.find("#ldap-username-attibute input").val()).toEqual( + mockedAPI.db.preference[PreferencesModel.LdapUsernameAttribute.uniqueKey] + ); + + expect(wrapper.find("#ldap-user-search-filter input").val()).toEqual( + mockedAPI.db.preference[PreferencesModel.LdapUserSearchFilter.uniqueKey] + ); + + expect(wrapper.find("#ldap-group-member-attibute input").val()).toEqual( + mockedAPI.db.preference[PreferencesModel.LdapGroupMemberAttribute.uniqueKey] + ); + + expect(wrapper.find("#ldap-group-attibute input").val()).toEqual( + mockedAPI.db.preference[PreferencesModel.LdapGroupAttribute.uniqueKey] + ); + + expect(wrapper.find("#ldap-group-search-filter input").val()).toEqual( + mockedAPI.db.preference[PreferencesModel.LdapGroupSearchFilter.uniqueKey] + ); } }); }); diff --git a/client-html/src/tests/preferences/maintenance/MaintenanceForm.test.tsx b/client-html/src/tests/preferences/maintenance/MaintenanceForm.test.tsx index 9dd5e3ecc1f..e5746760234 100644 --- a/client-html/src/tests/preferences/maintenance/MaintenanceForm.test.tsx +++ b/client-html/src/tests/preferences/maintenance/MaintenanceForm.test.tsx @@ -6,16 +6,16 @@ import Maintenance from "../../../js/containers/preferences/containers/maintenan // TODO Enable test on fix -describe("Virtual rendered MaintenanceForm", () => { +describe.skip("Virtual rendered MaintenanceForm", () => { defaultComponents({ entity: "MaintenanceForm", View: props => , record: () => ({}), defaultProps: () => ({}), render: wrapper => { - // expect(wrapper.find("#logout-timeout input").val()).toEqual( - // mockedAPI.db.preference[PreferencesModel.LogoutTimeout.uniqueKey].toString() - // ); + expect(wrapper.find("#logout-timeout input").val()).toEqual( + mockedAPI.db.preference[PreferencesModel.LogoutTimeout.uniqueKey].toString() + ); } }); }); diff --git a/client-html/src/tests/preferences/messaging/MessagingForm.test.tsx b/client-html/src/tests/preferences/messaging/MessagingForm.test.tsx index 9ba9f738dcd..ade72ae9dec 100644 --- a/client-html/src/tests/preferences/messaging/MessagingForm.test.tsx +++ b/client-html/src/tests/preferences/messaging/MessagingForm.test.tsx @@ -6,7 +6,7 @@ import * as PreferencesModel from "../../../js/model/preferences"; // TODO Enable test on fix -describe("Virtual rendered MessagingForm", () => { +describe.skip("Virtual rendered MessagingForm", () => { defaultComponents({ entity: "MessagingForm", View: props => , @@ -16,33 +16,33 @@ describe("Virtual rendered MessagingForm", () => { history: jest.fn() }), render: wrapper => { - // expect(wrapper.find("#email-from input").val()).toContain( - // mockedAPI.db.preference[PreferencesModel.EmailFromAddress.uniqueKey] - // ); - // - // expect(wrapper.find("#email-from-name input").val()).toContain( - // mockedAPI.db.preference[PreferencesModel.EmailFromName.uniqueKey] - // ); - // - // expect(wrapper.find("#email-admin input").val()).toContain( - // mockedAPI.db.preference[PreferencesModel.EmailAdminAddress.uniqueKey] - // ); - // - // expect(wrapper.find("#email-pop3host input").val()).toContain( - // mockedAPI.db.preference[PreferencesModel.EmailPop3Host.uniqueKey] - // ); - // - // expect(wrapper.find("#email-bounce-address input").val()).toContain( - // mockedAPI.db.preference[PreferencesModel.EmailBounceAddress.uniqueKey] - // ); - // - // expect(wrapper.find("#email-pop3-account input").val()).toContain( - // mockedAPI.db.preference[PreferencesModel.EmailPop3Account.uniqueKey] - // ); - // - // expect(wrapper.find("#email-pop3-password input").val()).toEqual( - // mockedAPI.db.preference[PreferencesModel.EmailPop3Password.uniqueKey] - // ); + expect(wrapper.find("#email-from input").val()).toContain( + mockedAPI.db.preference[PreferencesModel.EmailFromAddress.uniqueKey] + ); + + expect(wrapper.find("#email-from-name input").val()).toContain( + mockedAPI.db.preference[PreferencesModel.EmailFromName.uniqueKey] + ); + + expect(wrapper.find("#email-admin input").val()).toContain( + mockedAPI.db.preference[PreferencesModel.EmailAdminAddress.uniqueKey] + ); + + expect(wrapper.find("#email-pop3host input").val()).toContain( + mockedAPI.db.preference[PreferencesModel.EmailPop3Host.uniqueKey] + ); + + expect(wrapper.find("#email-bounce-address input").val()).toContain( + mockedAPI.db.preference[PreferencesModel.EmailBounceAddress.uniqueKey] + ); + + expect(wrapper.find("#email-pop3-account input").val()).toContain( + mockedAPI.db.preference[PreferencesModel.EmailPop3Account.uniqueKey] + ); + + expect(wrapper.find("#email-pop3-password input").val()).toEqual( + mockedAPI.db.preference[PreferencesModel.EmailPop3Password.uniqueKey] + ); } }); }); diff --git a/client-html/src/tests/preferences/tutor-roles/TutorRolesForm.Components.test.tsx b/client-html/src/tests/preferences/tutor-roles/TutorRolesForm.Components.test.tsx index 01de3a7cf5b..621c638cedb 100644 --- a/client-html/src/tests/preferences/tutor-roles/TutorRolesForm.Components.test.tsx +++ b/client-html/src/tests/preferences/tutor-roles/TutorRolesForm.Components.test.tsx @@ -7,7 +7,7 @@ import { III_DD_MMM_YYYY } from "../../../js/common/utils/dates/format"; // TODO Enable test on fix -describe("Virtual rendered TutorRolesForm", () => { +describe.skip("Virtual rendered TutorRolesForm", () => { defaultComponents({ entity: "TutorRolesForm", View: props => , @@ -31,17 +31,17 @@ describe("Virtual rendered TutorRolesForm", () => { }; }, render: (wrapper, initialValues, shallow) => { - // expect(wrapper.find("#description input").val()).toContain(initialValues.description); - // expect(shallow.find("input[type='checkbox']").props().checked).toEqual(initialValues.active); - // - // initialValues.payRates.forEach((payRate, index) => { - // expect(wrapper.find(`div[id='payRates[${index}].validFrom'] input`).val()).toContain( - // format(new Date(payRate.validFrom), III_DD_MMM_YYYY).toString() - // ); - // expect(wrapper.find(`div[id='payRates[${index}].rate'] input`).val()).toContain(payRate.rate); - // expect(wrapper.find(`div[id='payRates[${index}].type'] input`).val()).toContain(payRate.type); - // expect(wrapper.find(`div[id='payRates[${index}].oncostRate'] input`).val()).toContain("10"); - // }); + expect(wrapper.find("#description input").val()).toContain(initialValues.description); + expect(shallow.find("input[type='checkbox']").props().checked).toEqual(initialValues.active); + + initialValues.payRates.forEach((payRate, index) => { + expect(wrapper.find(`div[id='payRates[${index}].validFrom'] input`).val()).toContain( + format(new Date(payRate.validFrom), III_DD_MMM_YYYY).toString() + ); + expect(wrapper.find(`div[id='payRates[${index}].rate'] input`).val()).toContain(payRate.rate); + expect(wrapper.find(`div[id='payRates[${index}].type'] input`).val()).toContain(payRate.type); + expect(wrapper.find(`div[id='payRates[${index}].oncostRate'] input`).val()).toContain("10"); + }); } }); }); diff --git a/client-html/src/tests/tests.setup.ts b/client-html/src/tests/tests.setup.ts new file mode 100644 index 00000000000..0cb6c3ec6cc --- /dev/null +++ b/client-html/src/tests/tests.setup.ts @@ -0,0 +1,22 @@ +/* + * Copyright ish group pty ltd 2021. + * + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. + */ + +// Disable useLayoutEffect warnings +jest.mock('react', () => ({ + ...jest.requireActual('react'), + useLayoutEffect: jest.requireActual('react').useEffect, +})); + +// Show only console errors +global.console = { + ...global.console, + log: jest.fn(), + warn: jest.fn(), + info: jest.fn(), + debug: jest.fn(), +}; \ No newline at end of file