Skip to content

Commit

Permalink
build: 開発環境の整理
Browse files Browse the repository at this point in the history
  • Loading branch information
uidev1116 committed Jul 9, 2024
1 parent ea47384 commit 0e9d79c
Show file tree
Hide file tree
Showing 4 changed files with 421 additions and 1,831 deletions.
6 changes: 3 additions & 3 deletions __tests__/inline-menu.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe('inline-menu', () => {
});
const editMenu = TestRenderer.create(<InlineMenu view={view} menu={[strong]} blockMenu={[paragraph]} />);
const { tr } = view.state;
tr.setSelection(TextSelection.create(tr.doc, 0, 3));
tr.setSelection(TextSelection.create(tr.doc, 1, 4)); // select 'test'
view.dispatch(tr);
TestRenderer.act(() => {
editMenu.update(<InlineMenu view={view} menu={[strong]} blockMenu={[paragraph]} />);
Expand All @@ -71,7 +71,7 @@ describe('inline-menu', () => {
});
const editMenu = TestRenderer.create(<InlineMenu view={view} menu={[strong]} blockMenu={[paragraph]} />);
const { tr } = view.state;
tr.setSelection(TextSelection.create(tr.doc, 0, 3));
tr.setSelection(TextSelection.create(tr.doc, 1, 4)); // select 'test'
view.dispatch(tr);
TestRenderer.act(() => {
editMenu.update(<InlineMenu view={view} menu={[strong]} blockMenu={[paragraph]} />);
Expand All @@ -81,4 +81,4 @@ describe('inline-menu', () => {
});
expect(item.props.style.top).not.toBe(0);
});
})
})
8 changes: 4 additions & 4 deletions __tests__/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ export const getSchemaFromExtensions = (extensions: Extension[]) => {
export const getNodeViews = (extensions: Extension[]) => {
const views = {}
extensions.forEach(extension => {
if (extension.view) {
if (extension.view !== undefined) {
views[extension.name] = (node: Node, view: EditorView, getPos) => {
return extension.view(node, view, getPos);
return extension.view && extension.view(node, view, getPos);
}
}
})
Expand All @@ -94,9 +94,9 @@ export const getEditorViewFromExtensions = (extensions: Extension[]) => {
const options = { schema, plugins: [], doc };
return new EditorView(null, {
state: EditorState.create(options),
attributes: null,
attributes: {},
nodeViews: {}
});
}

export const stripHTML = (html: string) => html.replace(/<[^>]*>?/gm, '')
export const stripHTML = (html: string) => html.replace(/<[^>]*>?/gm, '')
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ module.exports = {
transform: {
'^.+\\.tsx?$': 'ts-jest'
},
moduleDirectories: ['node_modules', 'src'],
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$',
setupFilesAfterEnv: ['jest-prosemirror/environment'],
testEnvironment: 'jsdom', // Required for dom manipulation
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
globals: {
Expand Down
Loading

0 comments on commit 0e9d79c

Please sign in to comment.