Skip to content
Open
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
4,354 changes: 1,635 additions & 2,719 deletions package-lock.json

Large diffs are not rendered by default.

56 changes: 7 additions & 49 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@
"semantic-release": "semantic-release",
"snapshot": "jest --updateSnapshot",
"start": "npm start --workspace=www",
"test": "jest --coverage",
"test:watch": "npm run test -- --watch",
"test:watch-no-coverage": "npm run test:watch -- --coverage=false",
"test": "vitest run --coverage",
"test:no-coverage": "vitest run",
"test:watch": "vitest watch --coverage",
"test:watch-no-coverage": "vitest watch",
"generate-component": "npm start --workspace=component-generator",
"example:start": "npm start --workspace=example",
"example:start:with-theme": "npm run start:with-theme --workspace=example",
Expand Down Expand Up @@ -127,10 +128,8 @@
"@formatjs/cli": "^5.0.2",
"@semantic-release/changelog": "^6.0.1",
"@semantic-release/git": "^10.0.1",
"@testing-library/jest-dom": "^6.6",
"@testing-library/react": "^16.1",
"@testing-library/user-event": "^14.5",
"@types/jest": "^29.5.10",
"@types/react": "^18",
"@types/react-dom": "^18",
"@types/react-responsive": "^9.0.0",
Expand All @@ -139,8 +138,8 @@
"@types/uuid": "^9.0.0",
"@typescript-eslint/eslint-plugin": "^5.22.0",
"@typescript-eslint/parser": "^5.22.0",
"@vitest/coverage-v8": "^4.0.15",
"axios-mock-adapter": "^2.0.0",
"babel-jest": "^29.7.0",
"babel-loader": "^8.2.4",
"commander": "^9.3.0",
"eslint": "8.57.1",
Expand All @@ -151,55 +150,14 @@
"eslint-plugin-jsx-a11y": "6.10.2",
"husky": "^9.0.11",
"identity-obj-proxy": "^3.0.0",
"jest": "^29.7.0",
"jest-cli": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"lint-staged": "^15.2.0",
"markdown-loader-jest": "^0.1.1",
"react": "^18",
"react-test-renderer": "^18",
"regenerator-runtime": "^0.14.0",
"semantic-release": "^20.1.3",
"stylelint": "^15.11.0",
"ts-jest": "^29.1.2",
"typescript": "^4.7.4"
},
"jest": {
"testEnvironment": "jsdom",
"transform": {
"^.+\\.md?$": "markdown-loader-jest",
"^.+\\.jsx?$": "babel-jest",
"^icons/index.js$": "babel-jest",
"^.+\\.tsx?$": "ts-jest"
},
"setupFilesAfterEnv": [
"./src/setupTest.ts"
],
"moduleNameMapper": {
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
"\\.(css|scss)$": "identity-obj-proxy"
},
"collectCoverageFrom": [
"src/**/*.{js,jsx,ts,tsx}"
],
"coveragePathIgnorePatterns": [
"/node_modules/",
"src/setupTest.ts",
"src/index.js",
"/tests/",
"/www/",
"/dist/"
],
"testPathIgnorePatterns": [
"/node_modules/",
"/www/",
"/dist/",
"/dependent-usage-analyzer/",
"/component-generator/"
],
"transformIgnorePatterns": [
"/node_modules/(?!(@openedx/paragon)/).*/"
]
"typescript": "^4.7.4",
"vitest": "^4.0.15"
},
"browserslist": [
"extends @edx/browserslist-config"
Expand Down
9 changes: 6 additions & 3 deletions src/Avatar/Avatar.test.jsx → src/Avatar/Avatar.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import React from 'react';
import {
describe,
expect,
it,
} from 'vitest';
import renderer from 'react-test-renderer';
import Avatar from './index';

Expand All @@ -21,8 +25,7 @@ describe('Avatar', () => {
it('has a default avatar url', () => {
const testRenderer = renderer.create(<Avatar />);
const testInstance = testRenderer.root;
// test-file-stub is what our fileMock.js returns for all images and svgs
expect(testInstance.findByType('img').props.src).toBe('test-file-stub');
expect(testInstance.findByType('img').props.src).toMatch(/^data:image\/svg\+xml,/);
});

it('can set a custom avatar url', () => {
Expand Down
41 changes: 0 additions & 41 deletions src/Avatar/__snapshots__/Avatar.test.jsx.snap

This file was deleted.

41 changes: 41 additions & 0 deletions src/Avatar/__snapshots__/Avatar.test.tsx.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`Avatar > renders in all sizes 1`] = `
[
<img
alt=""
className="pgn__avatar pgn__avatar-xs"
src="data:image/svg+xml,%3csvg%20width='36'%20height='36'%20viewBox='0%200%2036%2036'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='36'%20height='36'%20fill='white'/%3e%3cpath%20d='M18%2018C20.21%2018%2022%2016.21%2022%2014C22%2011.79%2020.21%2010%2018%2010C15.79%2010%2014%2011.79%2014%2014C14%2016.21%2015.79%2018%2018%2018ZM18%2020C15.33%2020%2010%2021.34%2010%2024V26H26V24C26%2021.34%2020.67%2020%2018%2020Z'%20fill='%2300262B'/%3e%3c/svg%3e"
/>,
<img
alt=""
className="pgn__avatar pgn__avatar-sm"
src="data:image/svg+xml,%3csvg%20width='36'%20height='36'%20viewBox='0%200%2036%2036'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='36'%20height='36'%20fill='white'/%3e%3cpath%20d='M18%2018C20.21%2018%2022%2016.21%2022%2014C22%2011.79%2020.21%2010%2018%2010C15.79%2010%2014%2011.79%2014%2014C14%2016.21%2015.79%2018%2018%2018ZM18%2020C15.33%2020%2010%2021.34%2010%2024V26H26V24C26%2021.34%2020.67%2020%2018%2020Z'%20fill='%2300262B'/%3e%3c/svg%3e"
/>,
<img
alt=""
className="pgn__avatar pgn__avatar-md"
src="data:image/svg+xml,%3csvg%20width='36'%20height='36'%20viewBox='0%200%2036%2036'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='36'%20height='36'%20fill='white'/%3e%3cpath%20d='M18%2018C20.21%2018%2022%2016.21%2022%2014C22%2011.79%2020.21%2010%2018%2010C15.79%2010%2014%2011.79%2014%2014C14%2016.21%2015.79%2018%2018%2018ZM18%2020C15.33%2020%2010%2021.34%2010%2024V26H26V24C26%2021.34%2020.67%2020%2018%2020Z'%20fill='%2300262B'/%3e%3c/svg%3e"
/>,
<img
alt=""
className="pgn__avatar pgn__avatar-lg"
src="data:image/svg+xml,%3csvg%20width='36'%20height='36'%20viewBox='0%200%2036%2036'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='36'%20height='36'%20fill='white'/%3e%3cpath%20d='M18%2018C20.21%2018%2022%2016.21%2022%2014C22%2011.79%2020.21%2010%2018%2010C15.79%2010%2014%2011.79%2014%2014C14%2016.21%2015.79%2018%2018%2018ZM18%2020C15.33%2020%2010%2021.34%2010%2024V26H26V24C26%2021.34%2020.67%2020%2018%2020Z'%20fill='%2300262B'/%3e%3c/svg%3e"
/>,
<img
alt=""
className="pgn__avatar pgn__avatar-xl"
src="data:image/svg+xml,%3csvg%20width='36'%20height='36'%20viewBox='0%200%2036%2036'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='36'%20height='36'%20fill='white'/%3e%3cpath%20d='M18%2018C20.21%2018%2022%2016.21%2022%2014C22%2011.79%2020.21%2010%2018%2010C15.79%2010%2014%2011.79%2014%2014C14%2016.21%2015.79%2018%2018%2018ZM18%2020C15.33%2020%2010%2021.34%2010%2024V26H26V24C26%2021.34%2020.67%2020%2018%2020Z'%20fill='%2300262B'/%3e%3c/svg%3e"
/>,
<img
alt=""
className="pgn__avatar pgn__avatar-xxl"
src="data:image/svg+xml,%3csvg%20width='36'%20height='36'%20viewBox='0%200%2036%2036'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='36'%20height='36'%20fill='white'/%3e%3cpath%20d='M18%2018C20.21%2018%2022%2016.21%2022%2014C22%2011.79%2020.21%2010%2018%2010C15.79%2010%2014%2011.79%2014%2014C14%2016.21%2015.79%2018%2018%2018ZM18%2020C15.33%2020%2010%2021.34%2010%2024V26H26V24C26%2021.34%2020.67%2020%2018%2020Z'%20fill='%2300262B'/%3e%3c/svg%3e"
/>,
<img
alt=""
className="pgn__avatar pgn__avatar-huge"
src="data:image/svg+xml,%3csvg%20width='36'%20height='36'%20viewBox='0%200%2036%2036'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='36'%20height='36'%20fill='white'/%3e%3cpath%20d='M18%2018C20.21%2018%2022%2016.21%2022%2014C22%2011.79%2020.21%2010%2018%2010C15.79%2010%2014%2011.79%2014%2014C14%2016.21%2015.79%2018%2018%2018ZM18%2020C15.33%2020%2010%2021.34%2010%2024V26H26V24C26%2021.34%2020.67%2020%2018%2020Z'%20fill='%2300262B'/%3e%3c/svg%3e"
/>,
]
`;
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import React from 'react';
import {
describe,
expect,
it,
} from 'vitest';
import renderer from 'react-test-renderer';
import AvatarButton from '.';

Expand All @@ -20,8 +24,7 @@ describe('AvatarButton', () => {
it('has a default avatar url', () => {
const testRenderer = renderer.create(<AvatarButton>Casey</AvatarButton>);
const testInstance = testRenderer.root;
// test-file-stub is what our fileMock.js returns for all images and svgs
expect(testInstance.findByType('img').props.src).toBe('test-file-stub');
expect(testInstance.findByType('img').props.src).toMatch(/^data:image\/svg\+xml,/);
});

it('can set a custom avatar url', () => {
Expand Down
75 changes: 0 additions & 75 deletions src/AvatarButton/__snapshots__/AvatarButton.test.jsx.snap

This file was deleted.

75 changes: 75 additions & 0 deletions src/AvatarButton/__snapshots__/AvatarButton.test.tsx.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`AvatarButton > renders in all sizes 1`] = `
[
<button
className="btn-avatar pgn__avatar-button-avatar pgn__avatar-button-avatar-sm btn btn-tertiary btn-sm"
disabled={false}
type="button"
>
<img
alt=""
className="pgn__avatar pgn__avatar-xs"
src="data:image/svg+xml,%3csvg%20width='36'%20height='36'%20viewBox='0%200%2036%2036'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='36'%20height='36'%20fill='white'/%3e%3cpath%20d='M18%2018C20.21%2018%2022%2016.21%2022%2014C22%2011.79%2020.21%2010%2018%2010C15.79%2010%2014%2011.79%2014%2014C14%2016.21%2015.79%2018%2018%2018ZM18%2020C15.33%2020%2010%2021.34%2010%2024V26H26V24C26%2021.34%2020.67%2020%2018%2020Z'%20fill='%2300262B'/%3e%3c/svg%3e"
/>
Casey
</button>,
<button
className="btn-avatar pgn__avatar-button-avatar pgn__avatar-button-avatar-md btn btn-tertiary btn-md"
disabled={false}
type="button"
>
<img
alt=""
className="pgn__avatar pgn__avatar-sm"
src="data:image/svg+xml,%3csvg%20width='36'%20height='36'%20viewBox='0%200%2036%2036'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='36'%20height='36'%20fill='white'/%3e%3cpath%20d='M18%2018C20.21%2018%2022%2016.21%2022%2014C22%2011.79%2020.21%2010%2018%2010C15.79%2010%2014%2011.79%2014%2014C14%2016.21%2015.79%2018%2018%2018ZM18%2020C15.33%2020%2010%2021.34%2010%2024V26H26V24C26%2021.34%2020.67%2020%2018%2020Z'%20fill='%2300262B'/%3e%3c/svg%3e"
/>
Casey
</button>,
<button
className="btn-avatar pgn__avatar-button-avatar pgn__avatar-button-avatar-lg btn btn-tertiary btn-lg"
disabled={false}
type="button"
>
<img
alt=""
className="pgn__avatar pgn__avatar-md"
src="data:image/svg+xml,%3csvg%20width='36'%20height='36'%20viewBox='0%200%2036%2036'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='36'%20height='36'%20fill='white'/%3e%3cpath%20d='M18%2018C20.21%2018%2022%2016.21%2022%2014C22%2011.79%2020.21%2010%2018%2010C15.79%2010%2014%2011.79%2014%2014C14%2016.21%2015.79%2018%2018%2018ZM18%2020C15.33%2020%2010%2021.34%2010%2024V26H26V24C26%2021.34%2020.67%2020%2018%2020Z'%20fill='%2300262B'/%3e%3c/svg%3e"
/>
Casey
</button>,
<button
className="btn-avatar pgn__avatar-button-avatar pgn__avatar-button-avatar-sm pgn__avatar-button-hide-label btn btn-tertiary btn-sm"
disabled={false}
type="button"
>
<img
alt="Casey"
className="pgn__avatar pgn__avatar-xs"
src="data:image/svg+xml,%3csvg%20width='36'%20height='36'%20viewBox='0%200%2036%2036'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='36'%20height='36'%20fill='white'/%3e%3cpath%20d='M18%2018C20.21%2018%2022%2016.21%2022%2014C22%2011.79%2020.21%2010%2018%2010C15.79%2010%2014%2011.79%2014%2014C14%2016.21%2015.79%2018%2018%2018ZM18%2020C15.33%2020%2010%2021.34%2010%2024V26H26V24C26%2021.34%2020.67%2020%2018%2020Z'%20fill='%2300262B'/%3e%3c/svg%3e"
/>
</button>,
<button
className="btn-avatar pgn__avatar-button-avatar pgn__avatar-button-avatar-md pgn__avatar-button-hide-label btn btn-tertiary btn-md"
disabled={false}
type="button"
>
<img
alt="Casey"
className="pgn__avatar pgn__avatar-sm"
src="data:image/svg+xml,%3csvg%20width='36'%20height='36'%20viewBox='0%200%2036%2036'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='36'%20height='36'%20fill='white'/%3e%3cpath%20d='M18%2018C20.21%2018%2022%2016.21%2022%2014C22%2011.79%2020.21%2010%2018%2010C15.79%2010%2014%2011.79%2014%2014C14%2016.21%2015.79%2018%2018%2018ZM18%2020C15.33%2020%2010%2021.34%2010%2024V26H26V24C26%2021.34%2020.67%2020%2018%2020Z'%20fill='%2300262B'/%3e%3c/svg%3e"
/>
</button>,
<button
className="btn-avatar pgn__avatar-button-avatar pgn__avatar-button-avatar-lg pgn__avatar-button-hide-label btn btn-tertiary btn-lg"
disabled={false}
type="button"
>
<img
alt="Casey"
className="pgn__avatar pgn__avatar-md"
src="data:image/svg+xml,%3csvg%20width='36'%20height='36'%20viewBox='0%200%2036%2036'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='36'%20height='36'%20fill='white'/%3e%3cpath%20d='M18%2018C20.21%2018%2022%2016.21%2022%2014C22%2011.79%2020.21%2010%2018%2010C15.79%2010%2014%2011.79%2014%2014C14%2016.21%2015.79%2018%2018%2018ZM18%2020C15.33%2020%2010%2021.34%2010%2024V26H26V24C26%2021.34%2020.67%2020%2018%2020Z'%20fill='%2300262B'/%3e%3c/svg%3e"
/>
</button>,
]
`;
Loading
Loading