Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
e732ea0
test(unity-react-core): check element changes
oatkar Apr 24, 2025
11b0a4e
feat(app-degree-pages): q
oatkar May 29, 2025
15b7ad5
feat(unity-react-core): check element changes
oatkar May 29, 2025
a1d6085
feat(unity-react-core): check changes
oatkar Jun 10, 2025
26a4e24
feat(unity-react-core): e
oatkar Jun 26, 2025
efb7bb6
feat(unity-react-core): x
oatkar Jul 8, 2025
46403a3
chore: add todo's
davidornelas11 Jul 10, 2025
17fd905
feat(unity-react-core): error
oatkar Jul 25, 2025
0be323b
feat(unity-react-core): check-element-changes
oatkar Aug 28, 2025
c53c9cc
Merge branch 'dev' into uds-1663-check-element-changes
oatkar Aug 28, 2025
825f91d
feat(unity-react-core): check-element-changes merge with dev
oatkar Aug 28, 2025
40a97a5
feat(unity-react-core): changes
oatkar Sep 11, 2025
3ac15c3
chore: update check changes compare file
davidornelas11 Sep 25, 2025
5943a81
perf: update typescript types for check element changes script
davidornelas11 Sep 25, 2025
7566526
Merge pull request #1585 from ASU/uds-1663-updated-dave
davidornelas11 Sep 30, 2025
c0f00c3
chore: update check element changes steps
davidornelas11 Sep 30, 2025
314530e
feat(unity-react-core): check changes final
oatkar Oct 6, 2025
8ca742a
feat(unity-react-core): check changes final
oatkar Oct 6, 2025
500c0b0
chore(unity-react-core): update check changes script to add all compo…
davidornelas11 Nov 12, 2025
bc7eadc
chore(shared): uncomment out exports in shared
davidornelas11 Nov 12, 2025
13f858d
Merge branch 'dev' into uds-1663-check-element-changes
davidornelas11 Nov 12, 2025
8411255
chore(static-site): fix build issue
davidornelas11 Nov 12, 2025
80dae9a
chore: fix multiple tests along with dompurify
davidornelas11 Nov 13, 2025
7834638
Update packages/unity-react-core/scripts/check-changes.tsx
davidornelas11 Nov 13, 2025
7e6127e
Update packages/unity-react-core/scripts/check-element-changes.js
davidornelas11 Nov 13, 2025
9c43025
Update packages/unity-react-core/scripts/check-element-changes.js
davidornelas11 Nov 13, 2025
bb241e1
Update packages/unity-react-core/scripts/check-element-changes.js
davidornelas11 Nov 13, 2025
6248b2c
chore: remove package-lock.json
davidornelas11 Nov 14, 2025
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
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"stop": "node server/server.stop.js",
"prepare": "husky install",
"commit": "cz",
"check-element-changes": "node ./scripts/check-element-changes.js -d"
"check-element-changes": "node ./packages/unity-react-core/scripts/check-element-changes.js"
},
"jest": {
"preset": "jest-puppeteer",
Expand Down Expand Up @@ -74,6 +74,7 @@
"copy-webpack-plugin": "^8.1.1",
"css-minimizer-webpack-plugin": "^2.0.0",
"cz-conventional-changelog": "^3.3.0",
"diff": "^8.0.2",
"dompurify": "^3.2.4",
"eslint": "^9",
"eslint-config-prettier": "^8.2.0",
Expand Down Expand Up @@ -102,6 +103,7 @@
"semantic-release": "^22",
"semantic-release-monorepo": "^8.0.2",
"semver": "^7.5.2",
"tsx": "^4.19.3",
"vite": "^5.3.5",
"webpack": "^5.32.0",
"webpack-bundle-analyzer": "^4.4.1",
Expand Down
20 changes: 7 additions & 13 deletions packages/app-degree-pages/__mocks__/unity-react-core-mock.jsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,8 @@
/* eslint-disable react/jsx-props-no-spreading */
// @ts-check
import * as asuCore from "@asu/unity-react-core";
import React from "react";
import { vi } from "vitest"

const {
Accordion: _C1,
AnchorMenu: _C2,
Button: _C3,
Card: _C4,
Hero: _C5,
Pagination: _C6,
Video: _C7,
...rest
} = asuCore;

const mockComponent = vi.fn(props => <>{props?.children}</>);

const Accordion = mockComponent;
Expand All @@ -28,7 +16,11 @@ const Card = mockComponent;
const Hero = mockComponent;
const Pagination = mockComponent;
const Video = mockComponent;
const Divider = mockComponent;
const Image = mockComponent;
const List = mockComponent;

// Mock all the components we might need
vi.doMock("@asu/unity-react-core", () => ({
Accordion,
AnchorMenu,
Expand All @@ -37,5 +29,7 @@ vi.doMock("@asu/unity-react-core", () => ({
Hero,
Pagination,
Video,
...rest,
Divider,
Image,
List,
}));
2 changes: 2 additions & 0 deletions packages/app-degree-pages/vitest.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { afterEach } from 'vitest'

import "./__mocks__/fetch-mock";
import "./__mocks__/window-mock";
import "./__mocks__/unity-react-core-mock";

afterEach(() => {
cleanup()
});
5 changes: 5 additions & 0 deletions packages/component-header-footer/setupTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,9 @@ import "@testing-library/jest-dom";

import "./__mocks__/window-mock";

if (typeof global.TextEncoder === 'undefined') {
const util = require('util');
global.TextEncoder = util.TextEncoder;
}

expect.extend({ toMatchImageSnapshot });
2 changes: 1 addition & 1 deletion packages/shared/utils/html-utils.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ export type FocusableElement = {
* @param {string} targetSelector
* @returns {FocusableElement}
*/
export function queryFirstFocusable(targetSelector: string): FocusableElement;
export function queryFirstFocusable(targetSelector: string): FocusableElement | null;
25 changes: 22 additions & 3 deletions packages/shared/utils/html-utils.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,37 @@
// @ts-check
import DOMPurify from "dompurify";

// Lazy initialization of DOMPurify to support server-side rendering
let DOMPurifyInstanceServerCompatible = null;

function getDOMPurifyInstance() {
if (!DOMPurifyInstanceServerCompatible) {
// Initialize DOMPurify with the current window (browser or JSDOM)
if (typeof window !== "undefined") {
DOMPurifyInstanceServerCompatible = DOMPurify(window);
} else {
// Fallback for environments without window
DOMPurifyInstanceServerCompatible = DOMPurify;
}
}
return DOMPurifyInstanceServerCompatible;
}

/**
* @typedef {{
* focus: () => void
* } & Element } FocusableElement
* @param {string} targetSelector
* @returns {FocusableElement}
* @returns {FocusableElement | null}
*/
function queryFirstFocusable(targetSelector) {
const target = targetSelector
? document.querySelector(targetSelector)
: document;

/** @type {FocusableElement} */
if (!target) return null;

/** @type {FocusableElement | null} */
const focusable = target.querySelector(
'button, [href], input, select, textarea, [tabIndex]:not([tabIndex="-1"])'
);
Expand All @@ -25,7 +43,8 @@ function queryFirstFocusable(targetSelector) {
* @returns {Object}
*/
export const sanitizeDangerousMarkup = content => {
return { __html: DOMPurify.sanitize(content) };
const purify = getDOMPurifyInstance();
return { __html: purify.sanitize(content) };
};

export { queryFirstFocusable };
8 changes: 4 additions & 4 deletions packages/static-site/src/pages/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const Home = () => {
</div>
<div className="container">
<h2>Unity Design System (UDS)</h2>
<Divider />
<Divider type="default" />
<div className="row my-6">
<Card
title="UDS Guidelines"
Expand All @@ -54,7 +54,7 @@ const Home = () => {
</div>
<div className="container">
<h2>Implementing UDS</h2>
<Divider />
<Divider type="default" />
<div className="row my-6">
<Card
title="ASU Header and Footer"
Expand Down Expand Up @@ -105,14 +105,14 @@ const Home = () => {
<a id="codekit"></a>
<div className="container">
<h2>Npm Packages</h2>
<Divider />
<Divider type="default" />
<div className="row my-6">
<PackageCards />
</div>
</div>
<div className="container">
<h2>Deprecated Packages</h2>
<Divider />
<Divider type="default" />
<div className="row my-6">
<DeprecatedPackageCards />
</div>
Expand Down
Loading