-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GraphiQL component:
forcedTheme
(#3407)
* GraphiQL component: `showThemeSettings` changeset change prop to enforceTheme clean change prop name cypress theme tests delete onEditForceTheme fix some new changeset fix fix Update packages/graphiql/cypress/e2e/theme.cy.ts Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> Update packages/graphiql/cypress/e2e/theme.cy.ts Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> Update packages/graphiql/cypress/e2e/theme.cy.ts Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> Update packages/graphiql/resources/renderExample.js Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> Update packages/graphiql/src/components/GraphiQL.tsx Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> Update packages/graphiql/src/components/GraphiQL.tsx Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> Update packages/graphiql/cypress/e2e/theme.cy.ts Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> Update .changeset/famous-shirts-mate.md Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> Update packages/graphiql/cypress/e2e/theme.cy.ts Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> Update packages/graphiql/cypress/e2e/theme.cy.ts Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> Update packages/graphiql/cypress/e2e/theme.cy.ts Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> * Update packages/graphiql/src/components/GraphiQL.tsx Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com> * Update packages/graphiql/src/components/GraphiQL.tsx Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com> * simplify * fix cypress --------- Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com> Co-authored-by: Dimitri POSTOLOV <dmytropostolov@gmail.com>
- Loading branch information
1 parent
c126878
commit 115c1c0
Showing
5 changed files
with
85 additions
and
33 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'graphiql': minor | ||
--- | ||
|
||
Add a new prop to GraphiQL component: `forcedTheme` to force the theme and hide the theme switcher. |
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,17 @@ | ||
describe('Theme', () => { | ||
it('Switches to light theme when `forcedTheme` is light', () => { | ||
cy.visit('/?query={test}&forcedTheme=light'); | ||
cy.get('body').should('have.class', 'graphiql-light'); | ||
}); | ||
|
||
it('Switches to dark theme when `forcedTheme` is dark', () => { | ||
cy.visit('/?query={test}&forcedTheme=dark'); | ||
cy.get('body').should('have.class', 'graphiql-dark'); | ||
}); | ||
|
||
it('Defaults to light theme when `forcedTheme` value is invalid', () => { | ||
cy.visit('/?query={test}&forcedTheme=invalid'); | ||
cy.get('[data-value=settings]').click(); | ||
cy.get('.graphiql-dialog-section-title').eq(1).should('have.text', 'Theme'); // Check for the presence of the theme dialog | ||
}); | ||
}); |
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