forked from mermaid-js/mermaid
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request mermaid-js#296 from mermaid-js/daisyUI
Themes
- Loading branch information
Showing
22 changed files
with
354 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
describe('Test themes', () => { | ||
describe('Test light themes', () => { | ||
beforeEach(() => { | ||
cy.clearLocalStorage(); | ||
cy.visit('/edit', { | ||
onBeforeLoad(win) { | ||
cy.stub(win, 'matchMedia') | ||
.callThrough() | ||
.withArgs('(prefers-color-scheme: dark)') | ||
.returns({ | ||
matches: false | ||
}); | ||
} | ||
}); | ||
cy.contains('Change Theme').click(); | ||
}); | ||
|
||
it('should set light theme as default', () => { | ||
cy.contains('light').parent().should('have.class', 'bordered'); | ||
cy.contains('dark').parent().should('not.have.class', 'bordered'); | ||
cy.getLocalStorage('themeStore').snapshot(); | ||
}); | ||
|
||
it('should change themes when clicked', () => { | ||
cy.contains('light').parent().should('have.class', 'bordered'); | ||
cy.contains('cupcake').click(); | ||
cy.contains('cupcake').parent().should('have.class', 'bordered'); | ||
cy.contains('light').parent().should('not.have.class', 'bordered'); | ||
cy.contains('dark').parent().should('not.have.class', 'bordered'); | ||
cy.getLocalStorage('themeStore').snapshot(); | ||
}); | ||
}); | ||
|
||
describe('Test dark mode', () => { | ||
// eslint-disable-next-line mocha/no-hooks-for-single-case | ||
beforeEach(() => { | ||
cy.clearLocalStorage(); | ||
cy.visit('/edit', { | ||
onBeforeLoad(win) { | ||
cy.stub(win, 'matchMedia') | ||
.callThrough() | ||
.withArgs('(prefers-color-scheme: dark)') | ||
.returns({ | ||
matches: true | ||
}); | ||
} | ||
}); | ||
cy.contains('Change Theme').click(); | ||
}); | ||
|
||
it('should set dark theme as default', () => { | ||
cy.contains('light').parent().should('not.have.class', 'bordered'); | ||
cy.contains('dark').parent().should('have.class', 'bordered'); | ||
cy.getLocalStorage('themeStore').snapshot(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.