Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement DocumentModel initialization #39

Merged
merged 11 commits into from
Nov 4, 2023
Merged

Conversation

gohabereg
Copy link
Member

@gohabereg gohabereg commented Oct 5, 2023

Changes

  1. Update entities to accept serialized data into constructor — it enables model initialization using saved data
  2. Update BlockNodeData structure to accept any object/array structures as Tool data
  3. Update serialized data schema to mark ValueNode/TextNode data with special property $t
  4. Add private initialize methods to EditorDocument and BlockNode classes to create entities from passed serialized data
  5. Update ValueNode/TextNode methods call from BlockNode to support any tool data structure

Two issues raised to cover some of added code with integration tests: #40 #41

@github-actions
Copy link

github-actions bot commented Oct 5, 2023

✅ Mutation testing passed

Report: https://dashboard.stryker-mutator.io/reports/github.com/editor-js/document-model/PR-39

Mutated files
src/entities/BlockNode/consts.ts
src/entities/BlockNode/types/BlockChildType.ts
src/entities/EditorDocument/types/EditorDocumentSerialized.ts
src/entities/ValueNode/types/ValueSerialized.ts
src/utils/keypath.ts
src/utils/mapObject.ts
src/entities/BlockNode/index.ts
src/entities/BlockNode/types/BlockNodeConstructorParameters.ts
src/entities/BlockNode/types/BlockNodeData.ts
src/entities/BlockNode/types/BlockNodeSerialized.ts
src/entities/BlockNode/types/DataKey.ts
src/entities/BlockNode/types/index.ts
src/entities/BlockTune/index.ts
src/entities/BlockTune/types/BlockTuneConstructorParameters.ts
src/entities/BlockTune/types/BlockTuneSerialized.ts
src/entities/EditorDocument/index.ts
src/entities/EditorDocument/types/EditorDocumentConstructorParameters.ts
src/entities/EditorDocument/types/index.ts
src/entities/ValueNode/index.ts
src/entities/ValueNode/types/index.ts
src/entities/inline-fragments/InlineNode/index.ts
src/entities/inline-fragments/ParentInlineNode/index.ts
src/entities/inline-fragments/TextInlineNode/index.ts
src/entities/inline-fragments/TextNode/index.ts
src/tools/ToolsRegistry.ts
src/tools/types/BlockToolConstructable.ts
src/tools/types/index.ts

@github-actions
Copy link

github-actions bot commented Oct 5, 2023

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements 100% 468/468
🟢 Branches
99.21% (+0.19% 🔼)
126/127
🟢 Functions
99.23% (+0.09% 🔼)
129/130
🟢 Lines 100% 447/447
Show new covered files 🐣
St.
File Statements Branches Functions Lines
🟢
... / BlockChildType.ts
100% 100% 100% 100%
🟢
... / index.ts
100% 100% 100% 100%
🟢
... / consts.ts
100% 100% 100% 100%
🟢 utils/keypath.ts 100% 100% 100% 100%
🟢 utils/mapObject.ts 100% 100% 100% 100%

Test suite run success

310 tests passing in 17 suites.

Report generated by 🧪jest coverage report action from 91b40ee

@gohabereg gohabereg marked this pull request as ready for review October 7, 2023 23:05
src/entities/BlockNode/BlockNode.spec.ts Outdated Show resolved Hide resolved
src/entities/BlockNode/BlockNode.spec.ts Outdated Show resolved Hide resolved
@neSpecc
Copy link
Contributor

neSpecc commented Oct 17, 2023

Could you please write a short changelog in the PR description? It helps with review

src/entities/inline-fragments/ParentInlineNode/index.ts Outdated Show resolved Hide resolved
src/entities/ValueNode/index.ts Outdated Show resolved Hide resolved
src/entities/ValueNode/ValueNode.spec.ts Outdated Show resolved Hide resolved
src/entities/BlockNode/types/DataKey.ts Show resolved Hide resolved
src/entities/BlockNode/index.ts Show resolved Hide resolved
src/entities/BlockNode/index.ts Outdated Show resolved Hide resolved
src/utils/keypath.spec.ts Outdated Show resolved Hide resolved
src/entities/BlockNode/BlockNode.spec.ts Outdated Show resolved Hide resolved
src/entities/BlockNode/BlockNode.spec.ts Show resolved Hide resolved
@gohabereg gohabereg added this pull request to the merge queue Nov 4, 2023
Merged via the queue into main with commit 0548c57 Nov 4, 2023
5 checks passed
@gohabereg gohabereg deleted the feature/model-initialization branch November 4, 2023 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants