Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix deep-equality for array properties (#4672)
- Loading branch information
1 parent
0540fea
commit 2523dc4
Showing
5 changed files
with
45 additions
and
6 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 @@ | ||
--- | ||
'slate': minor | ||
--- | ||
|
||
Fix - deep-equals was always returning true when array props were equals. |
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
20 changes: 20 additions & 0 deletions
20
packages/slate/test/utils/deep-equal/deep-equals-with-array.js
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,20 @@ | ||
import { isDeepEqual } from '../../../src/utils/deep-equal' | ||
|
||
export const input = { | ||
objectA: { | ||
text: 'same text', | ||
array: ['array-content'], | ||
bold: true, | ||
}, | ||
objectB: { | ||
text: 'same text', | ||
array: ['array-content'], | ||
bold: true, | ||
}, | ||
} | ||
|
||
export const test = ({ objectA, objectB }) => { | ||
return isDeepEqual(objectA, objectB) | ||
} | ||
|
||
export const output = true |
20 changes: 20 additions & 0 deletions
20
packages/slate/test/utils/deep-equal/deep-not-equals-with-array.js
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,20 @@ | ||
import { isDeepEqual } from '../../../src/utils/deep-equal' | ||
|
||
export const input = { | ||
objectA: { | ||
text: 'same text', | ||
array: ['array-content'], | ||
bold: true, | ||
}, | ||
objectB: { | ||
text: 'same text', | ||
array: ['array-content'], | ||
bold: false, | ||
}, | ||
} | ||
|
||
export const test = ({ objectA, objectB }) => { | ||
return isDeepEqual(objectA, objectB) | ||
} | ||
|
||
export const output = false |