editor-js / document-model

❗️WIP❗️
Apache License 2.0
10 stars 2 forks source link

Add model events dispatch #50

Closed gohabereg closed 9 months ago

gohabereg commented 9 months ago
  1. Each node dispatch a Changed event on updates
  2. Parent node subscribes to child nodes event and redispatch it with updated index
  3. That way all of the events will got up through the whole tree do EditorDocument instance
  4. EditorJSModel can subscribe to EditorDocument events and redispatch them as public API
github-actions[bot] commented 9 months ago

✅ Mutation testing passed

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

Mutated files
src/utils/EventBus/events/BaseEvent.ts
src/utils/EventBus/events/PropertyModifiedEvent.ts
src/utils/EventBus/events/TextAddedEvent.ts
src/utils/EventBus/events/TextFormattedEvent.ts
src/utils/EventBus/events/TextRemovedEvent.ts
src/utils/EventBus/events/TextUnformattedEvent.ts
src/utils/EventBus/events/TuneModifiedEvent.ts
src/utils/EventBus/events/ValueModifiedEvent.ts
src/utils/EventBus/events/index.ts
src/utils/types.ts
src/entities/BlockNode/index.ts
src/entities/BlockTune/index.ts
src/entities/EditorDocument/index.ts
src/entities/ValueNode/index.ts
src/entities/inline-fragments/ParentInlineNode/index.ts
src/utils/EventBus/EventBus.ts
src/utils/EventBus/events/BlockAddedEvent.ts
src/utils/EventBus/events/BlockRemovedEvent.ts
src/utils/EventBus/types/EventMap.ts
src/utils/EventBus/types/EventPayloadBase.ts
src/utils/EventBus/types/indexing.ts
github-actions[bot] commented 9 months ago

Coverage report for ./packages/model

St.:grey_question:
Category Percentage Covered / Total
🟢 Statements 100% 572/572
🟢 Branches
99.26% (+0.05% 🔼)
135/136
🟢 Functions
99.3% (+0.11% 🔼)
141/142
🟢 Lines 100% 548/548
Show new covered files 🐣
|
St.:grey_question:
| File | Statements | Branches | Functions | Lines | | :----------------------------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------- | :--------- | :------- | :-------- | :---- | | 🟢 |
`...` / EventBus.ts
| 100% | 100% | 100% | 100% | | 🟢 |
`...` / EventType.ts
| 100% | 100% | 100% | 100% | | 🟢 |
`...` / index.ts
| 100% | 100% | 100% | 100% | | 🟢 |
`...` / BlockAddedEvent.ts
| 100% | 100% | 100% | 100% | | 🟢 |
`...` / EventAction.ts
| 100% | 100% | 100% | 100% | | 🟢 |
`...` / BaseEvent.ts
| 100% | 100% | 100% | 100% | | 🟢 |
`...` / BlockRemovedEvent.ts
| 100% | 100% | 100% | 100% | | 🟢 |
`...` / PropertyModifiedEvent.ts
| 100% | 100% | 100% | 100% | | 🟢 |
`...` / TextFormattedEvent.ts
| 100% | 100% | 100% | 100% | | 🟢 |
`...` / TextUnformattedEvent.ts
| 100% | 100% | 100% | 100% | | 🟢 |
`...` / TextAddedEvent.ts
| 100% | 100% | 100% | 100% | | 🟢 |
`...` / TextRemovedEvent.ts
| 100% | 100% | 100% | 100% | | 🟢 |
`...` / TuneModifiedEvent.ts
| 100% | 100% | 100% | 100% | | 🟢 |
`...` / ValueModifiedEvent.ts
| 100% | 100% | 100% | 100% |

Test suite run success

330 tests passing in 18 suites.

Report generated by 🧪jest coverage report action from f308e1c35ffcb2dec7e4e6baae8938ce8305722c