Skip to content

Commit

Permalink
test: rm unused test
Browse files Browse the repository at this point in the history
  • Loading branch information
nperez0111 committed Jan 21, 2025
1 parent f964e4e commit 7e8b6de
Showing 1 changed file with 2 additions and 123 deletions.
125 changes: 2 additions & 123 deletions demos/src/Experiments/IsolatingClear/React/index.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
context('/src/Examples/Default/React/', () => {
context('/src/Experiments/IsolatingClear/React/', () => {
beforeEach(() => {
cy.visit('/src/Examples/Default/React/')
cy.visit('/src/Experiments/IsolatingClear/React/')
})

beforeEach(() => {
Expand All @@ -18,125 +18,4 @@ context('/src/Examples/Default/React/', () => {
.find('p')
.should('contain', 'Example Text')
})

const buttonMarks = [
{ label: 'Bold', tag: 'strong' },
{ label: 'Italic', tag: 'em' },
{ label: 'Strike', tag: 's' },
]

buttonMarks.forEach(m => {
it(`should disable ${m.label} when the code tag is enabled for cursor`, () => {
cy.get('.tiptap').type('{selectall}Hello world')
cy.get('button').contains('Code').click()
cy.get('button').contains(m.label).should('be.disabled')
})

it(`should enable ${m.label} when the code tag is disabled for cursor`, () => {
cy.get('.tiptap').type('{selectall}Hello world')
cy.get('button').contains('Code').click()
cy.get('button').contains('Code').click()
cy.get('button').contains(m.label).should('not.be.disabled')
})

it(`should disable ${m.label} when the code tag is enabled for selection`, () => {
cy.get('.tiptap').type('{selectall}Hello world{selectall}')
cy.get('button').contains('Code').click()
cy.get('button').contains(m.label).should('be.disabled')
})

it(`should enable ${m.label} when the code tag is disabled for selection`, () => {
cy.get('.tiptap').type('{selectall}Hello world{selectall}')
cy.get('button').contains('Code').click()
cy.get('button').contains('Code').click()
cy.get('button').contains(m.label).should('not.be.disabled')
})

it(`should apply ${m.label} when the button is pressed`, () => {
cy.get('.tiptap').type('{selectall}Hello world')
cy.get('button').contains('Paragraph').click()
cy.get('.tiptap').type('{selectall}')
cy.get('button').contains(m.label).click()
cy.get(`.tiptap ${m.tag}`).should('exist').should('have.text', 'Hello world')
})
})

it('should clear marks when the button is pressed', () => {
cy.get('.tiptap').type('{selectall}Hello world')
cy.get('button').contains('Paragraph').click()
cy.get('.tiptap').type('{selectall}')
cy.get('button').contains('Bold').click()
cy.get('.tiptap strong').should('exist').should('have.text', 'Hello world')
cy.get('button').contains('Clear marks').click()
cy.get('.tiptap strong').should('not.exist')
})

it('should clear nodes when the button is pressed', () => {
cy.get('.tiptap').type('{selectall}Hello world')
cy.get('button').contains('Bullet list').click()
cy.get('.tiptap ul').should('exist').should('have.text', 'Hello world')
cy.get('.tiptap').type('{enter}A second item{enter}A third item{selectall}')
cy.get('button').contains('Clear nodes').click()
cy.get('.tiptap ul').should('not.exist')
cy.get('.tiptap p').should('have.length', 4)
})

const buttonNodes = [
{ label: 'H1', tag: 'h1' },
{ label: 'H2', tag: 'h2' },
{ label: 'H3', tag: 'h3' },
{ label: 'H4', tag: 'h4' },
{ label: 'H5', tag: 'h5' },
{ label: 'H6', tag: 'h6' },
{ label: 'Bullet list', tag: 'ul' },
{ label: 'Ordered list', tag: 'ol' },
{ label: 'Code block', tag: 'pre code' },
{ label: 'Blockquote', tag: 'blockquote' },
]

buttonNodes.forEach(n => {
it(`should set ${n.label} when the button is pressed`, () => {
cy.get('button').contains('Paragraph').click()
cy.get('.tiptap').type('{selectall}Hello world{selectall}')

cy.get('button').contains(n.label).click()
cy.get(`.tiptap ${n.tag}`).should('exist').should('have.text', 'Hello world')
cy.get('button').contains(n.label).click()
cy.get(`.tiptap ${n.tag}`).should('not.exist')
})
})

it('should add a hr when on the same line as a node', () => {
cy.get('.tiptap').type('{rightArrow}')
cy.get('button').contains('Horizontal rule').click()
cy.get('.tiptap hr').should('exist')
cy.get('.tiptap h1').should('exist')
})

it('should add a hr when on a new line', () => {
cy.get('.tiptap').type('{rightArrow}{enter}')
cy.get('button').contains('Horizontal rule').click()
cy.get('.tiptap hr').should('exist')
cy.get('.tiptap h1').should('exist')
})

it('should add a br', () => {
cy.get('.tiptap').type('{rightArrow}')
cy.get('button').contains('Hard break').click()
cy.get('.tiptap br').should('exist')
})

it('should undo', () => {
cy.get('.tiptap').type('{selectall}{backspace}')
cy.get('button').contains('Undo').click()
cy.get('.tiptap').should('contain', 'Example Text')
})

it('should redo', () => {
cy.get('.tiptap').type('{selectall}{backspace}')
cy.get('button').contains('Undo').click()
cy.get('.tiptap').should('contain', 'Example Text')
cy.get('button').contains('Redo').click()
cy.get('.tiptap').should('not.contain', 'Example Text')
})
})

0 comments on commit 7e8b6de

Please sign in to comment.