Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zbeyens committed Jan 22, 2025
1 parent 566ac85 commit 528ace5
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 5 deletions.
2 changes: 1 addition & 1 deletion config/eslint/bases/jest.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ module.exports = {
files: filePatterns.test,
plugins: ['jest', 'jest-formatting', 'testing-library', 'jest-dom'],
rules: {
'jest/no-disabled-tests': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-object-literal-type-assertion': 'off',
'import/default': 'off',
'import/namespace': 'off',
'import/no-duplicates': 'off',
Expand Down
2 changes: 1 addition & 1 deletion jest.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ module.exports = {
},
transformIgnorePatterns: [
'/node_modules/(?!(' +
'lucide-react|cheerio|react-dnd|dnd-core|@react-dnd|react-dnd-html5-backend|react-tweet|unified' +
'cheerio|react-dnd|dnd-core|@react-dnd|react-dnd-html5-backend|react-tweet|unified' +
'|remark-.*' +
'|mdast-.*' +
'|micromark.*' +
Expand Down
2 changes: 1 addition & 1 deletion packages/media/src/react/placeholder/internal/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,5 @@ function populateMaps(
function extname(path: string) {
const index = path.lastIndexOf('.');

return index < 0 ? '' : path.slice(Math.max(0, index));
return index === -1 ? '' : path.slice(Math.max(0, index));
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const shiftSelection = (
// Find the anchor block within the current selection array.
const anchorIndex = blocks.findIndex(([node]) => node.id === anchorId);

if (anchorIndex < 0) {
if (anchorIndex === -1) {
// If anchor not found in the current selection, fallback:
setOption('anchorId', bottomNode.id);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const setBlockSelectionIndent = (
const currentIndent = prevIndent + indent;

editor.tf.setNodes(
{ indent: currentIndent < 0 ? 0 : currentIndent },
{ indent: Math.max(currentIndent, 0) },
{
...options,
at: path,
Expand Down
18 changes: 18 additions & 0 deletions scripts/setupTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,21 @@ jest.mock('@udecode/plate-core', () => ({
__esModule: true,
...jest.requireActual('@udecode/plate-core'),
}));

// Add mock for lucide-react
jest.mock('lucide-react', () => {
return new Proxy(
{
__esModule: true,
},
{
get: function (_, prop) {
if (prop === '__esModule') return true;
// Return a mock component for any icon request
return function MockIcon() {
return null;
};
},
}
);
});

0 comments on commit 528ace5

Please sign in to comment.