test: add more extension option tests
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
import { Extension } from '@tiptap/core/src/Extension'
|
import { Extension } from '@tiptap/core/src/Extension'
|
||||||
|
|
||||||
describe('extension options', () => {
|
describe('extension options', () => {
|
||||||
it('should pass through', () => {
|
it('should set options', () => {
|
||||||
const extension = Extension.create({
|
const extension = Extension.create({
|
||||||
defaultOptions: {
|
defaultOptions: {
|
||||||
foo: 1,
|
foo: 1,
|
||||||
@@ -17,6 +17,23 @@ describe('extension options', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should pass through', () => {
|
||||||
|
const extension = Extension
|
||||||
|
.create({
|
||||||
|
defaultOptions: {
|
||||||
|
foo: 1,
|
||||||
|
bar: 1,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.extend()
|
||||||
|
.configure()
|
||||||
|
|
||||||
|
expect(extension.options).to.deep.eq({
|
||||||
|
foo: 1,
|
||||||
|
bar: 1,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
it('should be configurable', () => {
|
it('should be configurable', () => {
|
||||||
const extension = Extension
|
const extension = Extension
|
||||||
.create({
|
.create({
|
||||||
@@ -35,24 +52,44 @@ describe('extension options', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
// TODO: this fails. not sure about it
|
it('should be extendable', () => {
|
||||||
|
const extension = Extension.create({
|
||||||
|
defaultOptions: {
|
||||||
|
foo: 1,
|
||||||
|
bar: 1,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
// it('should be extendable', () => {
|
const newExtension = extension.extend({
|
||||||
// const extension = Extension
|
defaultOptions: {
|
||||||
// .create({
|
...extension.options,
|
||||||
// defaultOptions: {
|
baz: 1,
|
||||||
// foo: 1,
|
},
|
||||||
// bar: 1,
|
})
|
||||||
// },
|
|
||||||
// })
|
|
||||||
// .extend({
|
|
||||||
// defaultOptions: {
|
|
||||||
// baz: 1,
|
|
||||||
// },
|
|
||||||
// })
|
|
||||||
|
|
||||||
// expect(extension.options).to.deep.eq({
|
expect(newExtension.options).to.deep.eq({
|
||||||
// baz: 1,
|
foo: 1,
|
||||||
// })
|
bar: 1,
|
||||||
// })
|
baz: 1,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should be overwritable', () => {
|
||||||
|
const extension = Extension
|
||||||
|
.create({
|
||||||
|
defaultOptions: {
|
||||||
|
foo: 1,
|
||||||
|
bar: 1,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.extend({
|
||||||
|
defaultOptions: {
|
||||||
|
baz: 1,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
expect(extension.options).to.deep.eq({
|
||||||
|
baz: 1,
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user