Skip to content

Commit

Permalink
revert: "fix(core): handle macOS text expansion properly in InputRules (
Browse files Browse the repository at this point in the history
#5261)"

This reverts commit 88e310b.
  • Loading branch information
nperez0111 committed Sep 16, 2024
1 parent cf20679 commit e0c4db9
Show file tree
Hide file tree
Showing 50 changed files with 604 additions and 620 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,47 +4,44 @@ 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!')
.should('have.text', 'Hello World!')
})

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)
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
43 changes: 16 additions & 27 deletions demos/src/Examples/MarkdownShortcuts/React/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
})
Expand Down
43 changes: 16 additions & 27 deletions demos/src/Examples/MarkdownShortcuts/Vue/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
})
Expand Down
4 changes: 3 additions & 1 deletion demos/src/Examples/Minimal/React/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
4 changes: 3 additions & 1 deletion demos/src/Examples/Minimal/Vue/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
7 changes: 4 additions & 3 deletions demos/src/Examples/Savvy/React/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ context('/src/Examples/Savvy/React/', () => {
})

beforeEach(() => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
})

const tests = [
Expand All @@ -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])
})
})

Expand Down
7 changes: 4 additions & 3 deletions demos/src/Examples/Savvy/Vue/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ context('/src/Examples/Savvy/Vue/', () => {
})

beforeEach(() => {
cy.resetEditor()
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
})

const tests = [
Expand All @@ -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])
})
})
Expand Down
Loading

0 comments on commit e0c4db9

Please sign in to comment.