revert: "fix(core): handle macOS text expansion properly in InputRules (#5261)"

This reverts commit 88e310b144.
This commit is contained in:
Nick the Sick 2024-09-16 06:19:37 +02:00
parent cf2067906f
commit e0c4db9674
No known key found for this signature in database
GPG Key ID: F575992F156E5BCC
50 changed files with 602 additions and 618 deletions

View File

@ -4,7 +4,9 @@ context('/src/Commands/InsertContentApplyingRules/React/', () => {
})
beforeEach(() => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
})
it('should apply list InputRule', () => {

View File

@ -4,19 +4,19 @@ context('/src/Examples/InteractivityComponentContent/React/', () => {
})
it('should have a working tiptap instance', () => {
cy.get('.tiptap').then(([{ editor }]) => {
cy.get('.ProseMirror').then(([{ editor }]) => {
// eslint-disable-next-line
expect(editor).to.not.be.null
})
})
it('should render a custom node', () => {
cy.get('.tiptap .react-component')
cy.get('.ProseMirror .react-component')
.should('have.length', 1)
})
it('should allow text editing inside component', () => {
cy.get('.tiptap .react-component .content div')
cy.get('.ProseMirror .react-component .content div')
.invoke('attr', 'contentEditable', true)
.invoke('text', '')
.type('Hello World!')
@ -24,27 +24,24 @@ context('/src/Examples/InteractivityComponentContent/React/', () => {
})
it('should allow text editing inside component with markdown text', () => {
cy.get('.tiptap .react-component .content div')
cy.get('.ProseMirror .react-component .content div')
.invoke('attr', 'contentEditable', true)
.invoke('text', '')
.click()
cy.get('.tiptap .react-component .content div')
.realType('Hello World! This is **bold**.')
cy.get('.tiptap .react-component .content div')
.type('Hello World! This is **bold**.')
.should('have.text', 'Hello World! This is bold.')
cy.get('.tiptap .react-component .content strong')
cy.get('.ProseMirror .react-component .content strong')
.should('exist')
})
it('should remove node via selectall', () => {
cy.get('.tiptap .react-component')
cy.get('.ProseMirror .react-component')
.should('have.length', 1)
cy.get('.tiptap')
cy.get('.ProseMirror')
.type('{selectall}{backspace}')
cy.get('.tiptap .react-component')
cy.get('.ProseMirror .react-component')
.should('have.length', 0)
})
})

View File

@ -27,10 +27,7 @@ context('/src/Examples/InteractivityComponentContent/Vue/', () => {
cy.get('.tiptap .vue-component .content')
.invoke('attr', 'contentEditable', true)
.invoke('text', '')
.click()
cy.get('.tiptap .vue-component .content')
.realType('Hello World! This is **bold**.')
cy.get('.tiptap .vue-component .content')
.type('Hello World! This is **bold**.')
.should('have.text', 'Hello World! This is bold.')
cy.get('.tiptap .vue-component .content strong')

View File

@ -4,109 +4,98 @@ context('/src/Examples/MarkdownShortcuts/React/', () => {
})
beforeEach(() => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
})
it('should make a h1', () => {
cy.get('.tiptap')
.realType('# Headline')
cy.get('.tiptap')
.type('# Headline')
.find('h1')
.should('contain', 'Headline')
})
it('should make a h2', () => {
cy.get('.tiptap')
.realType('## Headline')
cy.get('.tiptap')
.type('## Headline')
.find('h2')
.should('contain', 'Headline')
})
it('should make a h3', () => {
cy.get('.tiptap')
.realType('### Headline')
cy.get('.tiptap')
.type('### Headline')
.find('h3')
.should('contain', 'Headline')
})
it('should make a h4', () => {
cy.get('.tiptap')
.realType('#### Headline')
cy.get('.tiptap')
.type('#### Headline')
.find('h4')
.should('contain', 'Headline')
})
it('should make a h5', () => {
cy.get('.tiptap')
.realType('##### Headline')
cy.get('.tiptap')
.type('##### Headline')
.find('h5')
.should('contain', 'Headline')
})
it('should make a h6', () => {
cy.get('.tiptap')
.realType('###### Headline')
cy.get('.tiptap')
.type('###### Headline')
.find('h6')
.should('contain', 'Headline')
})
it('should create inline code', () => {
cy.get('.tiptap')
.realType('`$foobar`')
cy.get('.tiptap')
.type('`$foobar`')
.find('code')
.should('contain', '$foobar')
})
it('should create a code block without language', () => {
cy.get('.tiptap')
.realType('``` {enter}const foo = bar{enter}```')
cy.get('.tiptap')
.type('``` {enter}const foo = bar{enter}```')
.find('pre')
.should('contain', 'const foo = bar')
})
it('should create a bullet list from asteriks', () => {
cy.get('.tiptap')
.realType('* foobar')
cy.get('.tiptap')
.type('* foobar')
.find('ul')
.should('contain', 'foobar')
})
it('should create a bullet list from dashes', () => {
cy.get('.tiptap')
.realType('- foobar')
cy.get('.tiptap')
.type('- foobar')
.find('ul')
.should('contain', 'foobar')
})
it('should create a bullet list from pluses', () => {
cy.get('.tiptap')
.realType('+ foobar')
cy.get('.tiptap')
.type('+ foobar')
.find('ul')
.should('contain', 'foobar')
})
it('should create a ordered list', () => {
cy.get('.tiptap')
.realType('1. foobar')
cy.get('.tiptap')
.type('1. foobar')
.find('ol')
.should('contain', 'foobar')
})
it('should create a blockquote', () => {
cy.get('.tiptap')
.realType('> foobar')
cy.get('.tiptap')
.type('> foobar')
.find('blockquote')
.should('contain', 'foobar')
})

View File

@ -4,109 +4,98 @@ context('/src/Examples/MarkdownShortcuts/Vue/', () => {
})
beforeEach(() => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
})
it('should make a h1', () => {
cy.get('.tiptap')
.realType('# Headline')
cy.get('.tiptap')
.type('# Headline')
.find('h1')
.should('contain', 'Headline')
})
it('should make a h2', () => {
cy.get('.tiptap')
.realType('## Headline')
cy.get('.tiptap')
.type('## Headline')
.find('h2')
.should('contain', 'Headline')
})
it('should make a h3', () => {
cy.get('.tiptap')
.realType('### Headline')
cy.get('.tiptap')
.type('### Headline')
.find('h3')
.should('contain', 'Headline')
})
it('should make a h4', () => {
cy.get('.tiptap')
.realType('#### Headline')
cy.get('.tiptap')
.type('#### Headline')
.find('h4')
.should('contain', 'Headline')
})
it('should make a h5', () => {
cy.get('.tiptap')
.realType('##### Headline')
cy.get('.tiptap')
.type('##### Headline')
.find('h5')
.should('contain', 'Headline')
})
it('should make a h6', () => {
cy.get('.tiptap')
.realType('###### Headline')
cy.get('.tiptap')
.type('###### Headline')
.find('h6')
.should('contain', 'Headline')
})
it('should create inline code', () => {
cy.get('.tiptap')
.realType('`$foobar`')
cy.get('.tiptap')
.type('`$foobar`')
.find('code')
.should('contain', '$foobar')
})
it('should create a code block without language', () => {
cy.get('.tiptap')
.realType('``` {enter}const foo = bar{enter}```')
cy.get('.tiptap')
.type('``` {enter}const foo = bar{enter}```')
.find('pre')
.should('contain', 'const foo = bar')
})
it('should create a bullet list from asteriks', () => {
cy.get('.tiptap')
.realType('* foobar')
cy.get('.tiptap')
.type('* foobar')
.find('ul')
.should('contain', 'foobar')
})
it('should create a bullet list from dashes', () => {
cy.get('.tiptap')
.realType('- foobar')
cy.get('.tiptap')
.type('- foobar')
.find('ul')
.should('contain', 'foobar')
})
it('should create a bullet list from pluses', () => {
cy.get('.tiptap')
.realType('+ foobar')
cy.get('.tiptap')
.type('+ foobar')
.find('ul')
.should('contain', 'foobar')
})
it('should create a ordered list', () => {
cy.get('.tiptap')
.realType('1. foobar')
cy.get('.tiptap')
.type('1. foobar')
.find('ol')
.should('contain', 'foobar')
})
it('should create a blockquote', () => {
cy.get('.tiptap')
.realType('> foobar')
cy.get('.tiptap')
.type('> foobar')
.find('blockquote')
.should('contain', 'foobar')
})

View File

@ -4,7 +4,9 @@ context('/src/Examples/Minimal/React/', () => {
})
beforeEach(() => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
})
it('text should be wrapped in a paragraph by default', () => {

View File

@ -4,7 +4,9 @@ context('/src/Examples/Minimal/Vue/', () => {
})
beforeEach(() => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
})
it('text should be wrapped in a paragraph by default', () => {

View File

@ -4,7 +4,9 @@ context('/src/Examples/Savvy/React/', () => {
})
beforeEach(() => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
})
const tests = [
@ -22,8 +24,7 @@ context('/src/Examples/Savvy/React/', () => {
tests.forEach(test => {
it(`should parse ${test[0]} correctly`, () => {
cy.get('.tiptap').realType(`${test[0]} `)
cy.get('.tiptap').should('contain', test[1])
cy.get('.tiptap').type(`${test[0]} `).should('contain', test[1])
})
})

View File

@ -4,7 +4,9 @@ context('/src/Examples/Savvy/Vue/', () => {
})
beforeEach(() => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
})
const tests = [
@ -23,8 +25,7 @@ context('/src/Examples/Savvy/Vue/', () => {
tests.forEach(test => {
it(`should parse ${test[0]} correctly`, () => {
cy.get('.tiptap')
.realType(`${test[0]} `)
cy.get('.tiptap')
.type(`${test[0]} `)
.should('contain', test[1])
})
})

View File

@ -4,7 +4,9 @@ context('/src/Examples/Tasks/React/', () => {
})
beforeEach(() => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
})
it('should always use task items', () => {

View File

@ -4,7 +4,9 @@ context('/src/Examples/Tasks/Vue/', () => {
})
beforeEach(() => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
})
it('should always use task items', () => {

View File

@ -4,7 +4,9 @@ context('/src/Experiments/Commands/Vue/', () => {
})
beforeEach(() => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
})
it('should open a popup after typing a slash', () => {
@ -16,8 +18,7 @@ context('/src/Experiments/Commands/Vue/', () => {
]
items.forEach((item, i) => {
cy.get('.tiptap').type('{selectall}{backspace}')
cy.get('.tiptap').realType('/')
cy.get('.tiptap').type('{selectall}{backspace}/')
cy.get('.tippy-content .dropdown-menu').should('exist')
cy.get('.tippy-content .dropdown-menu button').eq(i).click()
cy.get('.tiptap').type(`I am a ${item.tag}`)
@ -26,14 +27,14 @@ context('/src/Experiments/Commands/Vue/', () => {
})
it('should close the popup without any command via esc', () => {
cy.get('.tiptap').realType('/')
cy.get('.tiptap').type('{selectall}{backspace}/')
cy.get('.tippy-content .dropdown-menu').should('exist')
cy.get('.tiptap').type('{esc}')
cy.get('.tippy-content .dropdown-menu').should('not.exist')
})
it('should open the popup when the cursor is after a slash', () => {
cy.get('.tiptap').realType('/')
cy.get('.tiptap').type('{selectall}{backspace}/')
cy.get('.tippy-content .dropdown-menu').should('exist')
cy.get('.tiptap').type('{leftArrow}')
cy.get('.tippy-content .dropdown-menu').should('not.exist')

View File

@ -4,121 +4,99 @@ context('/src/Extensions/Typography/React/', () => {
})
beforeEach(() => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
})
it('should keep dates as they are', () => {
cy.get('.tiptap').realType('1/4/2024')
cy.get('.tiptap').should('contain', '1/4/2024')
cy.get('.tiptap').type('1/4/2024').should('contain', '1/4/2024')
})
it('should make a fraction only with spaces afterwards', () => {
cy.get('.tiptap').realType('1/4')
cy.get('.tiptap').should('contain', '1/4')
cy.get('.tiptap').type('{selectall}{backspace}')
cy.get('.tiptap').realType('1/4 ')
cy.get('.tiptap').should('contain', '¼')
cy.get('.tiptap').type('1/4').should('contain', '1/4')
cy.get('.tiptap').type('{selectall}{backspace}1/4 ').should('contain', '¼')
})
it('should make an em dash from two dashes', () => {
cy.get('.tiptap').realType('-- emDash')
cy.get('.tiptap').should('contain', '— emDash')
cy.get('.tiptap').type('-- emDash').should('contain', '— emDash')
})
it('should make an ellipsis from three dots', () => {
cy.get('.tiptap').realType('... ellipsis')
cy.get('.tiptap').should('contain', '… ellipsis')
cy.get('.tiptap').type('... ellipsis').should('contain', '… ellipsis')
})
it('should make a correct open double quote', () => {
cy.get('.tiptap').realType('"openDoubleQuote"')
cy.get('.tiptap').should('contain', '“openDoubleQuote')
cy.get('.tiptap').type('"openDoubleQuote"').should('contain', '“openDoubleQuote')
})
it('should make a correct close double quote', () => {
cy.get('.tiptap').realType('"closeDoubleQuote"')
cy.get('.tiptap').should('contain', 'closeDoubleQuote”')
cy.get('.tiptap').type('"closeDoubleQuote"').should('contain', 'closeDoubleQuote”')
})
it('should make a correct open single quote', () => {
cy.get('.tiptap').realType("'openSingleQuote'")
cy.get('.tiptap').should('contain', 'openSingleQuote')
cy.get('.tiptap').type("'openSingleQuote'").should('contain', 'openSingleQuote')
})
it('should make a correct close single quote', () => {
cy.get('.tiptap').realType("'closeSingleQuote'")
cy.get('.tiptap').should('contain', 'closeSingleQuote')
cy.get('.tiptap').type("'closeSingleQuote'").should('contain', 'closeSingleQuote')
})
it('should make a left arrow', () => {
cy.get('.tiptap').realType('<- leftArrow')
cy.get('.tiptap').should('contain', '← leftArrow')
cy.get('.tiptap').type('<- leftArrow').should('contain', '← leftArrow')
})
it('should make a right arrow', () => {
cy.get('.tiptap').realType('-> rightArrow')
cy.get('.tiptap').should('contain', '→ rightArrow')
cy.get('.tiptap').type('-> rightArrow').should('contain', '→ rightArrow')
})
it('should make a copyright sign', () => {
cy.get('.tiptap').realType('(c) copyright')
cy.get('.tiptap').should('contain', '© copyright')
cy.get('.tiptap').type('(c) copyright').should('contain', '© copyright')
})
it('should make a registered trademark sign', () => {
cy.get('.tiptap').realType('(r) registeredTrademark')
cy.get('.tiptap').should('contain', '® registeredTrademark')
cy.get('.tiptap')
.type('(r) registeredTrademark')
.should('contain', '® registeredTrademark')
})
it('should make a trademark sign', () => {
cy.get('.tiptap').realType('(tm) trademark')
cy.get('.tiptap').should('contain', '™ trademark')
cy.get('.tiptap').type('(tm) trademark').should('contain', '™ trademark')
})
it('should make a one half', () => {
cy.get('.tiptap').realType('1/2 oneHalf')
cy.get('.tiptap').should('contain', '½ oneHalf')
cy.get('.tiptap').type('1/2 oneHalf').should('contain', '½ oneHalf')
})
it('should make a plus/minus sign', () => {
cy.get('.tiptap').realType('+/- plusMinus')
cy.get('.tiptap').should('contain', '± plusMinus')
cy.get('.tiptap').type('+/- plusMinus').should('contain', '± plusMinus')
})
it('should make a not equal sign', () => {
cy.get('.tiptap').realType('!= notEqual')
cy.get('.tiptap').should('contain', '≠ notEqual')
cy.get('.tiptap').type('!= notEqual').should('contain', '≠ notEqual')
})
it('should make a laquo', () => {
cy.get('.tiptap').realType('<< laquorow')
cy.get('.tiptap').should('contain', '« laquo')
cy.get('.tiptap').type('<< laquorow').should('contain', '« laquo')
})
it('should make a raquo', () => {
cy.get('.tiptap').realType('>> raquorow')
cy.get('.tiptap').should('contain', '» raquo')
cy.get('.tiptap').type('>> raquorow').should('contain', '» raquo')
})
it('should make a multiplication sign from an asterisk', () => {
cy.get('.tiptap').realType('1*1 multiplication')
cy.get('.tiptap').should('contain', '1×1 multiplication')
cy.get('.tiptap').type('1*1 multiplication').should('contain', '1×1 multiplication')
})
it('should make a multiplication sign from an x', () => {
cy.get('.tiptap').realType('1x1 multiplication')
cy.get('.tiptap').should('contain', '1×1 multiplication')
cy.get('.tiptap').type('1x1 multiplication').should('contain', '1×1 multiplication')
})
it('should make a multiplication sign from an asterisk with spaces', () => {
cy.get('.tiptap').realType('1 * 1 multiplication')
cy.get('.tiptap').should('contain', '1 × 1 multiplication')
cy.get('.tiptap').type('1 * 1 multiplication').should('contain', '1 × 1 multiplication')
})
it('should make a multiplication sign from an x with spaces', () => {
cy.get('.tiptap').realType('1 x 1 multiplication')
cy.get('.tiptap').should('contain', '1 × 1 multiplication')
cy.get('.tiptap').type('1 x 1 multiplication').should('contain', '1 × 1 multiplication')
})
})

View File

@ -4,121 +4,128 @@ context('/src/Extensions/Typography/Vue/', () => {
})
beforeEach(() => {
cy.resetEditor()
})
it('should keep dates as they are', () => {
cy.get('.tiptap').realType('1/4/2024')
cy.get('.tiptap').should('contain', '1/4/2024')
})
it('should make a fraction only with spaces afterwards', () => {
cy.get('.tiptap').realType('1/4')
cy.get('.tiptap').should('contain', '1/4')
cy.get('.tiptap').type('{selectall}{backspace}')
cy.get('.tiptap').realType('1/4 ')
cy.get('.tiptap').should('contain', '¼')
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
})
it('should make an em dash from two dashes', () => {
cy.get('.tiptap').realType('-- emDash')
cy.get('.tiptap').should('contain', '— emDash')
cy.get('.tiptap')
.type('-- emDash')
.should('contain', '— emDash')
})
it('should make an ellipsis from three dots', () => {
cy.get('.tiptap').realType('... ellipsis')
cy.get('.tiptap').should('contain', '… ellipsis')
cy.get('.tiptap')
.type('... ellipsis')
.should('contain', '… ellipsis')
})
it('should make a correct open double quote', () => {
cy.get('.tiptap').realType('"openDoubleQuote"')
cy.get('.tiptap').should('contain', '“openDoubleQuote')
cy.get('.tiptap')
.type('"openDoubleQuote"')
.should('contain', '“openDoubleQuote')
})
it('should make a correct close double quote', () => {
cy.get('.tiptap').realType('"closeDoubleQuote"')
cy.get('.tiptap').should('contain', 'closeDoubleQuote”')
cy.get('.tiptap')
.type('"closeDoubleQuote"')
.should('contain', 'closeDoubleQuote”')
})
it('should make a correct open single quote', () => {
cy.get('.tiptap').realType("'openSingleQuote'")
cy.get('.tiptap').should('contain', 'openSingleQuote')
cy.get('.tiptap')
.type("'openSingleQuote'")
.should('contain', 'openSingleQuote')
})
it('should make a correct close single quote', () => {
cy.get('.tiptap').realType("'closeSingleQuote'")
cy.get('.tiptap').should('contain', 'closeSingleQuote')
cy.get('.tiptap')
.type("'closeSingleQuote'")
.should('contain', 'closeSingleQuote')
})
it('should make a left arrow', () => {
cy.get('.tiptap').realType('<- leftArrow')
cy.get('.tiptap').should('contain', '← leftArrow')
cy.get('.tiptap')
.type('<- leftArrow')
.should('contain', '← leftArrow')
})
it('should make a right arrow', () => {
cy.get('.tiptap').realType('-> rightArrow')
cy.get('.tiptap').should('contain', '→ rightArrow')
cy.get('.tiptap')
.type('-> rightArrow')
.should('contain', '→ rightArrow')
})
it('should make a copyright sign', () => {
cy.get('.tiptap').realType('(c) copyright')
cy.get('.tiptap').should('contain', '© copyright')
cy.get('.tiptap')
.type('(c) copyright')
.should('contain', '© copyright')
})
it('should make a registered trademark sign', () => {
cy.get('.tiptap').realType('(r) registeredTrademark')
cy.get('.tiptap').should('contain', '® registeredTrademark')
cy.get('.tiptap')
.type('(r) registeredTrademark')
.should('contain', '® registeredTrademark')
})
it('should make a trademark sign', () => {
cy.get('.tiptap').realType('(tm) trademark')
cy.get('.tiptap').should('contain', '™ trademark')
cy.get('.tiptap')
.type('(tm) trademark')
.should('contain', '™ trademark')
})
it('should make a one half', () => {
cy.get('.tiptap').realType('1/2 oneHalf')
cy.get('.tiptap').should('contain', '½ oneHalf')
cy.get('.tiptap')
.type('1/2 oneHalf')
.should('contain', '½ oneHalf')
})
it('should make a plus/minus sign', () => {
cy.get('.tiptap').realType('+/- plusMinus')
cy.get('.tiptap').should('contain', '± plusMinus')
cy.get('.tiptap')
.type('+/- plusMinus')
.should('contain', '± plusMinus')
})
it('should make a not equal sign', () => {
cy.get('.tiptap').realType('!= notEqual')
cy.get('.tiptap').should('contain', '≠ notEqual')
cy.get('.tiptap')
.type('!= notEqual')
.should('contain', '≠ notEqual')
})
it('should make a laquo', () => {
cy.get('.tiptap').realType('<< laquorow')
cy.get('.tiptap').should('contain', '« laquo')
cy.get('.tiptap')
.type('<< laquorow')
.should('contain', '« laquo')
})
it('should make a raquo', () => {
cy.get('.tiptap').realType('>> raquorow')
cy.get('.tiptap').should('contain', '» raquo')
cy.get('.tiptap')
.type('>> raquorow')
.should('contain', '» raquo')
})
it('should make a multiplication sign from an asterisk', () => {
cy.get('.tiptap').realType('1*1 multiplication')
cy.get('.tiptap').should('contain', '1×1 multiplication')
cy.get('.tiptap')
.type('1*1 multiplication')
.should('contain', '1×1 multiplication')
})
it('should make a multiplication sign from an x', () => {
cy.get('.tiptap').realType('1x1 multiplication')
cy.get('.tiptap').should('contain', '1×1 multiplication')
cy.get('.tiptap')
.type('1x1 multiplication')
.should('contain', '1×1 multiplication')
})
it('should make a multiplication sign from an asterisk with spaces', () => {
cy.get('.tiptap').realType('1 * 1 multiplication')
cy.get('.tiptap').should('contain', '1 × 1 multiplication')
cy.get('.tiptap')
.type('1 * 1 multiplication')
.should('contain', '1 × 1 multiplication')
})
it('should make a multiplication sign from an x with spaces', () => {
cy.get('.tiptap').realType('1 x 1 multiplication')
cy.get('.tiptap').should('contain', '1 × 1 multiplication')
cy.get('.tiptap')
.type('1 x 1 multiplication')
.should('contain', '1 × 1 multiplication')
})
})

View File

@ -4,11 +4,12 @@ context('/src/Extensions/TypographyWithOverrides/React/', () => {
})
beforeEach(() => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
})
it('should use correct override for rightArrow', () => {
cy.get('.tiptap').realType('-> Hello!')
cy.get('.tiptap').should('contain', '=====> Hello!')
cy.get('.tiptap').type('-> Hello!').should('contain', '=====> Hello!')
})
})

View File

@ -4,11 +4,12 @@ context('/src/Extensions/TypographyWithOverrides/Vue/', () => {
})
beforeEach(() => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
})
it('should use correct override for rightArrow', () => {
cy.get('.tiptap').realType('-> Hello!')
cy.get('.tiptap').should('contain', '=====> Hello!')
cy.get('.tiptap').type('-> Hello!').should('contain', '=====> Hello!')
})
})

View File

@ -4,7 +4,9 @@ context('/src/GuideContent/ReadOnly/React/', () => {
})
beforeEach(() => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
})
it('should be read-only', () => {

View File

@ -4,7 +4,9 @@ context('/src/GuideContent/ReadOnly/Vue/', () => {
})
beforeEach(() => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
})
it('should be read-only', () => {

View File

@ -72,12 +72,10 @@ context('/src/Marks/Bold/React/', () => {
})
it('should make a bold text from the default markdown shortcut', () => {
cy.get('.tiptap').realType('**Bold**')
cy.get('.tiptap').find('strong').should('contain', 'Bold')
cy.get('.tiptap').type('**Bold**').find('strong').should('contain', 'Bold')
})
it('should make a bold text from the alternative markdown shortcut', () => {
cy.get('.tiptap').realType('__Bold__')
cy.get('.tiptap').find('strong').should('contain', 'Bold')
cy.get('.tiptap').type('__Bold__').find('strong').should('contain', 'Bold')
})
})

View File

@ -77,15 +77,15 @@ context('/src/Marks/Bold/Vue/', () => {
it('should make a bold text from the default markdown shortcut', () => {
cy.get('.tiptap')
.realType('**Bold**')
cy.get('.tiptap').find('strong')
.type('**Bold**')
.find('strong')
.should('contain', 'Bold')
})
it('should make a bold text from the alternative markdown shortcut', () => {
cy.get('.tiptap')
.realType('__Bold__')
cy.get('.tiptap').find('strong')
.type('__Bold__')
.find('strong')
.should('contain', 'Bold')
})
})

View File

@ -55,7 +55,6 @@ context('/src/Marks/Code/React/', () => {
})
it('should make inline code from the markdown shortcut', () => {
cy.get('.tiptap').realType('`Example`')
cy.get('.tiptap').find('code').should('contain', 'Example')
cy.get('.tiptap').type('`Example`').find('code').should('contain', 'Example')
})
})

View File

@ -64,8 +64,7 @@ context('/src/Marks/Code/Vue/', () => {
it('should make inline code from the markdown shortcut', () => {
cy.get('.tiptap')
.realType('`Example`')
cy.get('.tiptap')
.type('`Example`')
.find('code')
.should('contain', 'Example')
})

View File

@ -61,14 +61,4 @@ context('/src/Marks/Italic/React/', () => {
.find('em')
.should('not.exist')
})
it('should make a italic text from the default markdown shortcut', () => {
cy.get('.tiptap').realType('*Italic*')
cy.get('.tiptap').find('em').should('contain', 'Italic')
})
it('should make a italic text from the alternative markdown shortcut', () => {
cy.get('.tiptap').realType('_Italic_')
cy.get('.tiptap').find('em').should('contain', 'Italic')
})
})

View File

@ -68,20 +68,4 @@ context('/src/Marks/Italic/Vue/', () => {
.find('em')
.should('not.exist')
})
it('should make a italic text from the default markdown shortcut', () => {
cy.get('.tiptap')
.realType('*Italic*')
cy.get('.tiptap')
.find('em')
.should('contain', 'Italic')
})
it('should make a italic text from the alternative markdown shortcut', () => {
cy.get('.tiptap')
.realType('_Italic_')
cy.get('.tiptap')
.find('em')
.should('contain', 'Italic')
})
})

View File

@ -71,8 +71,7 @@ context('/src/Marks/Strike/React/', () => {
.should('not.exist')
})
it.only('should make a striked text from the markdown shortcut', () => {
cy.get('.tiptap').realType('~~Strike~~')
cy.get('.tiptap').find('s').should('contain', 'Strike')
it('should make a striked text from the markdown shortcut', () => {
cy.get('.tiptap').type('~~Strike~~').find('s').should('contain', 'Strike')
})
})

View File

@ -79,8 +79,7 @@ context('/src/Marks/Strike/Vue/', () => {
it('should make a striked text from the markdown shortcut', () => {
cy.get('.tiptap')
.realType('~~Strike~~')
cy.get('.tiptap')
.type('~~Strike~~')
.find('s')
.should('contain', 'Strike')
})

View File

@ -80,7 +80,6 @@ context('/src/Nodes/Blockquote/React/', () => {
})
it('should make a blockquote from markdown shortcuts', () => {
cy.get('.tiptap').realType('> Quote')
cy.get('.tiptap').find('blockquote').should('contain', 'Quote')
cy.get('.tiptap').type('> Quote').find('blockquote').should('contain', 'Quote')
})
})

View File

@ -97,8 +97,7 @@ context('/src/Nodes/Blockquote/Vue/', () => {
it('should make a blockquote from markdown shortcuts', () => {
cy.get('.tiptap')
.realType('> Quote')
cy.get('.tiptap')
.type('> Quote')
.find('blockquote')
.should('contain', 'Quote')
})

View File

@ -49,7 +49,9 @@ context('/src/Nodes/BulletList/React/', () => {
})
it('should leave the list with double enter', () => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
cy.get('.tiptap').type('- List Item 1{enter}{enter}Paragraph')
@ -66,9 +68,11 @@ context('/src/Nodes/BulletList/React/', () => {
})
it('should make a bullet list from an asterisk', () => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
cy.get('.tiptap').realType('* List Item 1{enter}List Item 2')
cy.get('.tiptap').type('* List Item 1{enter}List Item 2')
cy.get('.tiptap').find('li:nth-child(1)').should('contain', 'List Item 1')
@ -76,9 +80,11 @@ context('/src/Nodes/BulletList/React/', () => {
})
it('should make a bullet list from a dash', () => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
cy.get('.tiptap').realType('- List Item 1{enter}List Item 2')
cy.get('.tiptap').type('- List Item 1{enter}List Item 2')
cy.get('.tiptap').find('li:nth-child(1)').should('contain', 'List Item 1')
@ -86,9 +92,11 @@ context('/src/Nodes/BulletList/React/', () => {
})
it('should make a bullet list from a plus', () => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
cy.get('.tiptap').realType('+ List Item 1{enter}List Item 2')
cy.get('.tiptap').type('+ List Item 1{enter}List Item 2')
cy.get('.tiptap').find('li:nth-child(1)').should('contain', 'List Item 1')
@ -96,9 +104,11 @@ context('/src/Nodes/BulletList/React/', () => {
})
it('should remove the bullet list after pressing backspace', () => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
cy.get('.tiptap').realType('* {backspace}Example')
cy.get('.tiptap').type('* {backspace}Example')
cy.get('.tiptap').find('p').should('contain', '* Example')
})

View File

@ -62,7 +62,9 @@ context('/src/Nodes/BulletList/Vue/', () => {
})
it('should leave the list with double enter', () => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
cy.get('.tiptap')
.type('- List Item 1{enter}{enter}Paragraph')
@ -85,10 +87,12 @@ context('/src/Nodes/BulletList/Vue/', () => {
})
it('should make a bullet list from an asterisk', () => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
cy.get('.tiptap')
.realType('* List Item 1{enter}List Item 2')
.type('* List Item 1{enter}List Item 2')
cy.get('.tiptap')
.find('li:nth-child(1)')
@ -100,10 +104,12 @@ context('/src/Nodes/BulletList/Vue/', () => {
})
it('should make a bullet list from a dash', () => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
cy.get('.tiptap')
.realType('- List Item 1{enter}List Item 2')
.type('- List Item 1{enter}List Item 2')
cy.get('.tiptap')
.find('li:nth-child(1)')
@ -115,10 +121,12 @@ context('/src/Nodes/BulletList/Vue/', () => {
})
it('should make a bullet list from a plus', () => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
cy.get('.tiptap')
.realType('+ List Item 1{enter}List Item 2')
.type('+ List Item 1{enter}List Item 2')
cy.get('.tiptap')
.find('li:nth-child(1)')
@ -130,10 +138,12 @@ context('/src/Nodes/BulletList/Vue/', () => {
})
it('should remove the bullet list after pressing backspace', () => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
cy.get('.tiptap')
.realType('* {backspace}Example')
.type('* {backspace}Example')
cy.get('.tiptap')
.find('p')

View File

@ -76,8 +76,7 @@ context('/src/Nodes/CodeBlock/React/', () => {
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
cy.get('.tiptap').realType('``` Code')
cy.get('.tiptap').find('pre>code').should('contain', 'Code')
cy.get('.tiptap').type('``` Code').find('pre>code').should('contain', 'Code')
})
})
@ -85,8 +84,7 @@ context('/src/Nodes/CodeBlock/React/', () => {
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
cy.get('.tiptap').realType('~~~ Code')
cy.get('.tiptap').find('pre>code').should('contain', 'Code')
cy.get('.tiptap').type('~~~ Code').find('pre>code').should('contain', 'Code')
})
})
@ -95,8 +93,8 @@ context('/src/Nodes/CodeBlock/React/', () => {
editor.commands.clearContent()
cy.get('.tiptap')
.realType('```js Code')
cy.get('.tiptap').find('pre>code.language-js')
.type('```js Code')
.find('pre>code.language-js')
.should('contain', 'Code')
})
})
@ -106,8 +104,8 @@ context('/src/Nodes/CodeBlock/React/', () => {
editor.commands.clearContent()
cy.get('.tiptap')
.realType('~~~js Code')
cy.get('.tiptap').find('pre>code.language-js')
.type('~~~js Code')
.find('pre>code.language-js')
.should('contain', 'Code')
})
})
@ -116,8 +114,7 @@ context('/src/Nodes/CodeBlock/React/', () => {
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
cy.get('.tiptap').realType('```{enter}Code')
cy.get('.tiptap').find('pre>code').should('contain', 'Code')
cy.get('.tiptap').type('```{enter}Code').find('pre>code').should('contain', 'Code')
})
})
@ -125,7 +122,7 @@ context('/src/Nodes/CodeBlock/React/', () => {
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
cy.get('.tiptap').realType('``` {backspace}')
cy.get('.tiptap').type('``` {backspace}')
cy.get('.tiptap pre').should('not.exist')
})
@ -137,7 +134,7 @@ context('/src/Nodes/CodeBlock/React/', () => {
cy.get('.tiptap pre').should('not.exist')
cy.get('.tiptap').realType('Paragraph{enter}``` A{backspace}{backspace}')
cy.get('.tiptap').type('Paragraph{enter}``` A{backspace}{backspace}')
cy.get('.tiptap pre').should('not.exist')
})
@ -149,7 +146,7 @@ context('/src/Nodes/CodeBlock/React/', () => {
cy.get('.tiptap pre').should('not.exist')
cy.get('.tiptap').realType('Paragraph{enter}{enter}``` A{backspace}{backspace}')
cy.get('.tiptap').type('Paragraph{enter}{enter}``` A{backspace}{backspace}')
cy.get('.tiptap pre').should('not.exist')
})
@ -161,7 +158,7 @@ context('/src/Nodes/CodeBlock/React/', () => {
cy.get('.tiptap pre').should('not.exist')
cy.get('.tiptap').realType('``` A{leftarrow}{backspace}')
cy.get('.tiptap').type('``` A{leftArrow}{backspace}')
cy.get('.tiptap pre').should('not.exist')
})

View File

@ -87,8 +87,8 @@ context('/src/Nodes/CodeBlock/Vue/', () => {
editor.commands.clearContent()
cy.get('.tiptap')
.realType('``` Code')
cy.get('.tiptap').find('pre>code')
.type('``` Code')
.find('pre>code')
.should('contain', 'Code')
})
})
@ -98,8 +98,8 @@ context('/src/Nodes/CodeBlock/Vue/', () => {
editor.commands.clearContent()
cy.get('.tiptap')
.realType('~~~ Code')
cy.get('.tiptap').find('pre>code')
.type('~~~ Code')
.find('pre>code')
.should('contain', 'Code')
})
})
@ -109,8 +109,8 @@ context('/src/Nodes/CodeBlock/Vue/', () => {
editor.commands.clearContent()
cy.get('.tiptap')
.realType('```js Code')
cy.get('.tiptap').find('pre>code.language-js')
.type('```js Code')
.find('pre>code.language-js')
.should('contain', 'Code')
})
})
@ -120,8 +120,8 @@ context('/src/Nodes/CodeBlock/Vue/', () => {
editor.commands.clearContent()
cy.get('.tiptap')
.realType('~~~js Code')
cy.get('.tiptap').find('pre>code.language-js')
.type('~~~js Code')
.find('pre>code.language-js')
.should('contain', 'Code')
})
})
@ -131,8 +131,8 @@ context('/src/Nodes/CodeBlock/Vue/', () => {
editor.commands.clearContent()
cy.get('.tiptap')
.realType('```{enter}Code')
cy.get('.tiptap').find('pre>code')
.type('```{enter}Code')
.find('pre>code')
.should('contain', 'Code')
})
})
@ -142,7 +142,7 @@ context('/src/Nodes/CodeBlock/Vue/', () => {
editor.commands.clearContent()
cy.get('.tiptap')
.realType('``` {backspace}')
.type('``` {backspace}')
cy.get('.tiptap pre')
.should('not.exist')
@ -157,7 +157,7 @@ context('/src/Nodes/CodeBlock/Vue/', () => {
.should('not.exist')
cy.get('.tiptap')
.realType('Paragraph{enter}``` A{backspace}{backspace}')
.type('Paragraph{enter}``` A{backspace}{backspace}')
cy.get('.tiptap pre')
.should('not.exist')
@ -172,7 +172,7 @@ context('/src/Nodes/CodeBlock/Vue/', () => {
.should('not.exist')
cy.get('.tiptap')
.realType('Paragraph{enter}{enter}``` A{backspace}{backspace}')
.type('Paragraph{enter}{enter}``` A{backspace}{backspace}')
cy.get('.tiptap pre')
.should('not.exist')
@ -187,7 +187,7 @@ context('/src/Nodes/CodeBlock/Vue/', () => {
.should('not.exist')
cy.get('.tiptap')
.type('``` A{leftarrow}{backspace}')
.type('``` A{leftArrow}{backspace}')
cy.get('.tiptap pre')
.should('not.exist')

View File

@ -86,23 +86,26 @@ context('/src/Nodes/Heading/React/', () => {
})
it('should make a h1 from the default markdown shortcut', () => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
cy.get('.tiptap').realType('# Headline')
cy.get('.tiptap').find('h1').should('contain', 'Headline')
cy.get('.tiptap').type('# Headline').find('h1').should('contain', 'Headline')
})
it('should make a h2 from the default markdown shortcut', () => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
cy.get('.tiptap').realType('## Headline')
cy.get('.tiptap').find('h2').should('contain', 'Headline')
cy.get('.tiptap').type('## Headline').find('h2').should('contain', 'Headline')
})
it('should make a h3 from the default markdown shortcut', () => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
cy.get('.tiptap').realType('### Headline')
cy.get('.tiptap').find('h3').should('contain', 'Headline')
cy.get('.tiptap').type('### Headline').find('h3').should('contain', 'Headline')
})
})

View File

@ -108,29 +108,35 @@ context('/src/Nodes/Heading/Vue/', () => {
})
it('should make a h1 from the default markdown shortcut', () => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
cy.get('.tiptap')
.realType('# Headline')
cy.get('.tiptap').find('h1')
.type('# Headline')
.find('h1')
.should('contain', 'Headline')
})
it('should make a h2 from the default markdown shortcut', () => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
cy.get('.tiptap')
.realType('## Headline')
cy.get('.tiptap').find('h2')
.type('## Headline')
.find('h2')
.should('contain', 'Headline')
})
it('should make a h3 from the default markdown shortcut', () => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
cy.get('.tiptap')
.realType('### Headline')
cy.get('.tiptap').find('h3')
.type('### Headline')
.find('h3')
.should('contain', 'Headline')
})
})

View File

@ -37,7 +37,7 @@ context('/src/Nodes/HorizontalRule/React/', () => {
cy.get('.tiptap hr').should('not.exist')
cy.get('.tiptap').realType('---')
cy.get('.tiptap').type('---')
cy.get('.tiptap hr').should('exist')
})
@ -49,7 +49,7 @@ context('/src/Nodes/HorizontalRule/React/', () => {
cy.get('.tiptap hr').should('not.exist')
cy.get('.tiptap').realType('___ ')
cy.get('.tiptap').type('___ ')
cy.get('.tiptap hr').should('exist')
})

View File

@ -42,7 +42,7 @@ context('/src/Nodes/HorizontalRule/Vue/', () => {
.should('not.exist')
cy.get('.tiptap')
.realType('---')
.type('---')
cy.get('.tiptap hr')
.should('exist')
@ -57,7 +57,7 @@ context('/src/Nodes/HorizontalRule/Vue/', () => {
.should('not.exist')
cy.get('.tiptap')
.realType('___ ')
.type('___ ')
cy.get('.tiptap hr')
.should('exist')

View File

@ -56,9 +56,11 @@ context('/src/Nodes/OrderedList/React/', () => {
})
it('should leave the list with double enter', () => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
cy.get('.tiptap').realType('1. List Item 1{enter}{enter}Paragraph')
cy.get('.tiptap').type('1. List Item 1{enter}{enter}Paragraph')
cy.get('.tiptap').find('li').its('length').should('eq', 1)
@ -66,9 +68,11 @@ context('/src/Nodes/OrderedList/React/', () => {
})
it('should make a ordered list from a number', () => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
cy.get('.tiptap').realType('1. List Item 1{enter}List Item 2')
cy.get('.tiptap').type('1. List Item 1{enter}List Item 2')
cy.get('.tiptap').find('li:nth-child(1)').should('contain', 'List Item 1')
@ -76,18 +80,22 @@ context('/src/Nodes/OrderedList/React/', () => {
})
it('should make a ordered list from a number other than number one', () => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
cy.get('.tiptap').realType('2. List Item 1{enter}List Item 2')
cy.get('.tiptap').type('2. List Item 1{enter}List Item 2')
cy.get('.tiptap').find('li:nth-child(1)').should('contain', 'List Item 1')
cy.get('.tiptap').find('li:nth-child(2)').should('contain', 'List Item 2')
})
it('should remove the ordered list after pressing backspace', () => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
cy.get('.tiptap').realType('1. {backspace}Example')
cy.get('.tiptap').type('1. {backspace}Example')
cy.get('.tiptap').find('p').should('contain', '1. Example')
})

View File

@ -69,10 +69,12 @@ context('/src/Nodes/OrderedList/Vue/', () => {
})
it('should leave the list with double enter', () => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
cy.get('.tiptap')
.realType('1. List Item 1{enter}{enter}Paragraph')
.type('1. List Item 1{enter}{enter}Paragraph')
cy.get('.tiptap')
.find('li')
@ -85,10 +87,12 @@ context('/src/Nodes/OrderedList/Vue/', () => {
})
it('should make a ordered list from a number', () => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
cy.get('.tiptap')
.realType('1. List Item 1{enter}List Item 2')
.type('1. List Item 1{enter}List Item 2')
cy.get('.tiptap')
.find('li:nth-child(1)')
@ -100,20 +104,24 @@ context('/src/Nodes/OrderedList/Vue/', () => {
})
it('should make a ordered list from a number other than number one', () => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
cy.get('.tiptap')
.realType('2. List Item 1{enter}List Item 2')
.type('2. List Item 1{enter}List Item 2')
cy.get('.tiptap').find('li:nth-child(1)').should('contain', 'List Item 1')
cy.get('.tiptap').find('li:nth-child(2)').should('contain', 'List Item 2')
})
it('should remove the ordered list after pressing backspace', () => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
cy.get('.tiptap')
.realType('1. {backspace}Example')
.type('1. {backspace}Example')
cy.get('.tiptap')
.find('p')

View File

@ -4,7 +4,9 @@ context('/src/Nodes/Paragraph/React/', () => {
})
beforeEach(() => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
})
it('should parse paragraphs correctly', () => {

View File

@ -4,7 +4,9 @@ context('/src/Nodes/Paragraph/Vue/', () => {
})
beforeEach(() => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
})
it('should parse paragraphs correctly', () => {

View File

@ -4,7 +4,9 @@ context('/src/Nodes/Table/React/', () => {
})
beforeEach(() => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
})
it('creates a table (1x1)', () => {

View File

@ -4,7 +4,9 @@ context('/src/Nodes/Table/Vue/', () => {
})
beforeEach(() => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
})
it('creates a table (1x1)', () => {

View File

@ -64,9 +64,11 @@ context('/src/Nodes/TaskList/React/', () => {
})
it('should leave the list with double enter', () => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
cy.get('.tiptap').realType('[ ] List Item 1{enter}{enter}Paragraph')
cy.get('.tiptap').type('[ ] List Item 1{enter}{enter}Paragraph')
cy.get('.tiptap').find('li').its('length').should('eq', 1)
@ -74,9 +76,11 @@ context('/src/Nodes/TaskList/React/', () => {
})
it('should make a task list from square brackets', () => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
cy.get('.tiptap').realType('[ ] List Item 1{enter}List Item 2')
cy.get('.tiptap').type('[ ] List Item 1{enter}List Item 2')
cy.get('.tiptap')
.find('li:nth-child(1)')
@ -90,9 +94,11 @@ context('/src/Nodes/TaskList/React/', () => {
})
it('should make a task list from checked square brackets', () => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
cy.get('.tiptap').realType('[x] List Item 1{enter}List Item 2')
cy.get('.tiptap').type('[x] List Item 1{enter}List Item 2')
cy.get('.tiptap')
.find('li:nth-child(1)')

View File

@ -69,10 +69,12 @@ context('/src/Nodes/TaskList/Vue/', () => {
})
it('should leave the list with double enter', () => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
cy.get('.tiptap')
.realType('[ ] List Item 1{enter}{enter}Paragraph')
.type('[ ] List Item 1{enter}{enter}Paragraph')
cy.get('.tiptap')
.find('li')
@ -85,10 +87,12 @@ context('/src/Nodes/TaskList/Vue/', () => {
})
it('should make a task list from square brackets', () => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
cy.get('.tiptap')
.realType('[ ] List Item 1{enter}List Item 2')
.type('[ ] List Item 1{enter}List Item 2')
cy.get('.tiptap')
.find('li:nth-child(1)')
@ -102,10 +106,12 @@ context('/src/Nodes/TaskList/Vue/', () => {
})
it('should make a task list from checked square brackets', () => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
cy.get('.tiptap')
.realType('[x] List Item 1{enter}List Item 2')
.type('[x] List Item 1{enter}List Item 2')
cy.get('.tiptap')
.find('li:nth-child(1)')

View File

@ -4,7 +4,9 @@ context('/src/Nodes/Text/React/', () => {
})
beforeEach(() => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
})
it('text should be wrapped in a paragraph by default', () => {

View File

@ -4,7 +4,9 @@ context('/src/Nodes/Text/Vue/', () => {
})
beforeEach(() => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
})
it('text should be wrapped in a paragraph by default', () => {

478
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -52,7 +52,6 @@
"@typescript-eslint/parser": "^5.62.0",
"babel-loader": "^9.1.3",
"cypress": "^10.11.0",
"cypress-real-events": "^1.13.0",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^8.57.0",
"eslint-config-airbnb-base": "^15.0.0",

View File

@ -216,6 +216,17 @@ export function inputRulesPlugin(props: { editor: Editor; rules: InputRule[] }):
},
props: {
handleTextInput(view, from, to, text) {
return run({
editor,
from,
to,
text,
rules,
plugin,
})
},
handleDOMEvents: {
compositionend: view => {
setTimeout(() => {
@ -235,20 +246,6 @@ export function inputRulesPlugin(props: { editor: Editor; rules: InputRule[] }):
return false
},
keyup(view, event) {
if (event.key.length === 1) {
return run({
editor,
from: view.state.selection.from,
to: view.state.selection.from,
text: '',
rules,
plugin,
})
}
return false
},
},
// add support for input rules to trigger on enter

View File

@ -1,5 +1,3 @@
import 'cypress-real-events'
// ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
@ -97,11 +95,3 @@ Cypress.Commands.add(
return subject
},
)
Cypress.Commands.add('resetEditor', () => {
cy
.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
.click()
})