Skip to content

Commit

Permalink
fix: remove unused spec for font family extension (#5886)
Browse files Browse the repository at this point in the history
* fix: add new spec to check for multiple font families and fix the demo

---------

Co-authored-by: Alex Casillas <[email protected]>
  • Loading branch information
alexvcasillas and Alex Casillas authored Nov 28, 2024
1 parent a8c8db6 commit f49ef7c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion demos/src/Extensions/FontFamily/React/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default () => {
Inter
</button>
<button
onClick={() => editor.chain().focus().setFontFamily('Comic Sans MS, Comic Sans').run()}
onClick={() => editor.chain().focus().setFontFamily('"Comic Sans MS", "Comic Sans"').run()}
className={
editor.isActive('textStyle', { fontFamily: '"Comic Sans MS", "Comic Sans"' })
? 'is-active'
Expand Down
13 changes: 7 additions & 6 deletions demos/src/Extensions/FontFamily/React/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,24 @@ context('/src/Extensions/FontFamily/React/', () => {
cy.get('.tiptap span').should('not.exist')
})

it('should work with font-family that have spaces in them', () => {
cy.get('[data-test-id="comic-sans"]')
it('should allow CSS variables as a font-family', () => {
cy.get('[data-test-id="css-variable"]')
.should('not.have.class', 'is-active')
.click()
.should('have.class', 'is-active')

cy.get('.tiptap').find('span').should('have.attr', 'style', 'font-family: Comic Sans MS, Comic Sans')
cy.get('.tiptap').find('span').should('have.attr', 'style', 'font-family: var(--title-font-family)')
})

it('should allow CSS variables as a font-family', () => {
cy.get('[data-test-id="css-variable"]')
it('should allow fonts containing multiple font families', () => {
cy.get('[data-test-id="comic-sans"]')
.should('not.have.class', 'is-active')
.click()
.should('have.class', 'is-active')

cy.get('.tiptap').find('span').should('have.attr', 'style', 'font-family: var(--title-font-family)')
cy.get('.tiptap').find('span').should('have.attr', 'style', 'font-family: "Comic Sans MS", "Comic Sans"')
})

it('should allow fonts containing a space and number as a font-family', () => {
cy.get('[data-test-id="exo2"]')
.should('not.have.class', 'is-active')
Expand Down

0 comments on commit f49ef7c

Please sign in to comment.