-
-
Notifications
You must be signed in to change notification settings - Fork 755
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2984 from udecode/fix/string-char-mapping-key-order
Fix `StringCharMapping` key order dependency
- Loading branch information
Showing
3 changed files
with
32 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@udecode/plate-diff": patch | ||
--- | ||
|
||
Fix: Node equivalency checking is incorrectly dependent on the key order of the node object |
10 changes: 10 additions & 0 deletions
10
packages/diff/src/internal/utils/string-char-mapping.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { StringCharMapping } from './string-char-mapping'; | ||
|
||
describe('StringCharMapping', () => { | ||
it('treats nodes as equivalent regardless of key order', () => { | ||
const map = new StringCharMapping(); | ||
const c1 = map.nodeToChar({ type: 'a', children: [] }); | ||
const c2 = map.nodeToChar({ children: [], type: 'a' }); | ||
expect(c1).toBe(c2); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters