fix: update docs and add tests for collaboration and priority docs

This commit is contained in:
Nick the Sick 2024-08-12 11:14:41 +02:00
parent e11aa0de22
commit 2c6590b3d4
No known key found for this signature in database
GPG Key ID: F575992F156E5BCC
9 changed files with 96 additions and 11 deletions

View File

@ -3,5 +3,22 @@ context('/src/Demos/CollaborationSplitPane/React/', () => {
cy.visit('/src/Demos/CollaborationSplitPane/React/')
})
// TODO: Write tests
it('should have a working tiptap instance', () => {
cy.get('.tiptap').then(([{ editor }]) => {
// eslint-disable-next-line
expect(editor).to.not.be.null
})
})
it('should have a ydoc', () => {
cy.get('.tiptap').then(([{ editor }]) => {
/**
* @type {import('yjs').Doc}
*/
const yDoc = editor.extensionManager.extensions.find(a => a.name === 'collaboration').options.document
// eslint-disable-next-line
expect(yDoc).to.not.be.null
})
})
})

View File

@ -3,5 +3,22 @@ context('/src/Extensions/Collaboration/React/', () => {
cy.visit('/src/Extensions/Collaboration/React/')
})
// TODO: Write tests
it('should have a working tiptap instance', () => {
cy.get('.tiptap').then(([{ editor }]) => {
// eslint-disable-next-line
expect(editor).to.not.be.null
})
})
it('should have a ydoc', () => {
cy.get('.tiptap').then(([{ editor }]) => {
/**
* @type {import('yjs').Doc}
*/
const yDoc = editor.extensionManager.extensions.find(a => a.name === 'collaboration').options.document
// eslint-disable-next-line
expect(yDoc).to.not.be.null
})
})
})

View File

@ -3,5 +3,22 @@ context('/src/Extensions/Collaboration/Vue/', () => {
cy.visit('/src/Extensions/Collaboration/Vue/')
})
// TODO: Write tests
it('should have a working tiptap instance', () => {
cy.get('.tiptap').then(([{ editor }]) => {
// eslint-disable-next-line
expect(editor).to.not.be.null
})
})
it('should have a ydoc', () => {
cy.get('.tiptap').then(([{ editor }]) => {
/**
* @type {import('yjs').Doc}
*/
const yDoc = editor.extensionManager.extensions.find(a => a.name === 'collaboration').options.document
// eslint-disable-next-line
expect(yDoc).to.not.be.null
})
})
})

View File

@ -1,7 +1,24 @@
context('/src/Extensions/CollaborationCursor/React', () => {
before(() => {
cy.visit('/src/Extensions/CollaborationCursor/React')
cy.visit('/src/Extensions/CollaborationCursor/React/')
})
// TODO: Write tests
it('should have a working tiptap instance', () => {
cy.get('.tiptap').then(([{ editor }]) => {
// eslint-disable-next-line
expect(editor).to.not.be.null
})
})
it('should have a ydoc', () => {
cy.get('.tiptap').then(([{ editor }]) => {
/**
* @type {import('yjs').Doc}
*/
const yDoc = editor.extensionManager.extensions.find(a => a.name === 'collaboration').options.document
// eslint-disable-next-line
expect(yDoc).to.not.be.null
})
})
})

View File

@ -1,7 +1,24 @@
context('/src/Extensions/CollaborationCursor/Vue', () => {
before(() => {
cy.visit('/src/Extensions/CollaborationCursor/Vue')
cy.visit('/src/Extensions/CollaborationCursor/Vue/')
})
// TODO: Write tests
it('should have a working tiptap instance', () => {
cy.get('.tiptap').then(([{ editor }]) => {
// eslint-disable-next-line
expect(editor).to.not.be.null
})
})
it('should have a ydoc', () => {
cy.get('.tiptap').then(([{ editor }]) => {
/**
* @type {import('yjs').Doc}
*/
const yDoc = editor.extensionManager.extensions.find(a => a.name === 'collaboration').options.document
// eslint-disable-next-line
expect(yDoc).to.not.be.null
})
})
})

View File

@ -32,7 +32,7 @@ declare module '@tiptap/core' {
name: string
/**
* The priority of your extension. The higher, the later it will be called
* The priority of your extension. The higher, the earlier it will be called
* and will take precedence over other extensions with a lower priority.
* @default 100
* @example 101

View File

@ -35,7 +35,7 @@ declare module '@tiptap/core' {
name: string
/**
* The priority of your extension. The higher, the later it will be called
* The priority of your extension. The higher, the earlier it will be called
* and will take precedence over other extensions with a lower priority.
* @default 100
* @example 101

View File

@ -36,7 +36,7 @@ declare module '@tiptap/core' {
name: string
/**
* The priority of your extension. The higher, the later it will be called
* The priority of your extension. The higher, the earlier it will be called
* and will take precedence over other extensions with a lower priority.
* @default 100
* @example 101

View File

@ -96,7 +96,7 @@ const defaultOnUpdate = () => null
export const CollaborationCursor = Extension.create<CollaborationCursorOptions, CollaborationCursorStorage>({
name: 'collaborationCursor',
priority: 1001,
priority: 999,
addOptions() {
return {