From 47032bf96d631dc3b6b22b1eb89d7d924da040e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Sat, 17 Apr 2021 00:25:04 +0200 Subject: [PATCH] test: add extension option tests --- .../integration/core/extensionOptions.spec.ts | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 tests/cypress/integration/core/extensionOptions.spec.ts diff --git a/tests/cypress/integration/core/extensionOptions.spec.ts b/tests/cypress/integration/core/extensionOptions.spec.ts new file mode 100644 index 00000000..87ca6be0 --- /dev/null +++ b/tests/cypress/integration/core/extensionOptions.spec.ts @@ -0,0 +1,58 @@ +/// + +import { Extension } from '@tiptap/core/src/Extension' + +describe('extension options', () => { + it('should pass through', () => { + const extension = Extension.create({ + defaultOptions: { + foo: 1, + bar: 1, + }, + }) + + expect(extension.options).to.deep.eq({ + foo: 1, + bar: 1, + }) + }) + + it('should be configurable', () => { + const extension = Extension + .create({ + defaultOptions: { + foo: 1, + bar: 1, + }, + }) + .configure({ + bar: 2, + }) + + expect(extension.options).to.deep.eq({ + foo: 1, + bar: 2, + }) + }) + + // TODO: this fails. not sure about it + + // it('should be extendable', () => { + // const extension = Extension + // .create({ + // defaultOptions: { + // foo: 1, + // bar: 1, + // }, + // }) + // .extend({ + // defaultOptions: { + // baz: 1, + // }, + // }) + + // expect(extension.options).to.deep.eq({ + // baz: 1, + // }) + // }) +})