mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-12-24 09:27:49 +08:00
d3aeac4afa
* Fix TipTap getting loaded as CommonJS when the intent is to use the ES Module version. * `package.json` change also makes explicit exports required * Update `core` utilities exports to include all utilities * Update tests to use exported utilities
69 lines
1.0 KiB
TypeScript
69 lines
1.0 KiB
TypeScript
/// <reference types="cypress" />
|
|
|
|
import { mergeDeep } from '@tiptap/core'
|
|
|
|
describe('mergeDeep', () => {
|
|
it('should merge', () => {
|
|
const one = {
|
|
a: 1,
|
|
}
|
|
const two = {
|
|
b: 1,
|
|
}
|
|
const result = {
|
|
a: 1,
|
|
b: 1,
|
|
}
|
|
const merged = mergeDeep(one, two)
|
|
|
|
expect(merged).to.deep.eq(result)
|
|
})
|
|
|
|
it('should not merge array', () => {
|
|
const one = {
|
|
a: [1],
|
|
}
|
|
const two = {
|
|
a: [2],
|
|
}
|
|
const result = {
|
|
a: [2],
|
|
}
|
|
const merged = mergeDeep(one, two)
|
|
|
|
expect(merged).to.deep.eq(result)
|
|
})
|
|
|
|
it('should merge deep', () => {
|
|
const one = {
|
|
a: 1,
|
|
b: {
|
|
c: true,
|
|
},
|
|
d: {
|
|
e: true,
|
|
f: [1],
|
|
},
|
|
}
|
|
const two = {
|
|
b: 1,
|
|
d: {
|
|
f: [2],
|
|
g: 1,
|
|
},
|
|
}
|
|
const result = {
|
|
a: 1,
|
|
b: 1,
|
|
d: {
|
|
e: true,
|
|
f: [2],
|
|
g: 1,
|
|
},
|
|
}
|
|
const merged = mergeDeep(one, two)
|
|
|
|
expect(merged).to.deep.eq(result)
|
|
})
|
|
})
|