Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: replace references to StyledHeading for orbit-heading
- Loading branch information
Showing
10 changed files
with
287 additions
and
190 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
17 changes: 17 additions & 0 deletions
17
packages/orbit-components/cypress/integration/pages/heading-media-query-props.tsx
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 @@ | ||
import React from "react"; | ||
import { Heading } from "@kiwicom/orbit-components"; | ||
|
||
export default function HeadingMediaProps() { | ||
return ( | ||
<Heading | ||
type="title1" | ||
mediumMobile={{ type: "display" }} | ||
largeMobile={{ spaceAfter: "small", type: "title2" }} | ||
tablet={{ align: "center", type: "title4" }} | ||
desktop={{ type: "title5" }} | ||
largeDesktop={{ type: "title6" }} | ||
> | ||
Heading | ||
</Heading> | ||
); | ||
} |
81 changes: 81 additions & 0 deletions
81
packages/orbit-components/cypress/integration/pages/heading-media-query.test.ts
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,81 @@ | ||
import { defaultTokens } from "@kiwicom/orbit-design-tokens"; | ||
|
||
describe("Heading media query", () => { | ||
it("should have correct styles for small mobile", () => { | ||
cy.visit("/heading-media-props"); | ||
cy.viewport(defaultTokens.widthBreakpointMediumMobile - 10, 600); | ||
|
||
const element = cy.findByRole("heading"); | ||
element.should("have.css", "font-size", defaultTokens.fontSizeHeadingTitle1); | ||
element.should("have.css", "line-height", defaultTokens.lineHeightHeadingTitle1); | ||
element.should("have.css", "font-weight", defaultTokens.fontWeightHeadingTitle1); | ||
|
||
// Assertion of next media query style | ||
element.should("not.have.css", "font-size", defaultTokens.fontSizeHeadingDisplay); | ||
}); | ||
it("should have correct styles for medium mobile", () => { | ||
cy.visit("/heading-media-props"); | ||
cy.viewport(defaultTokens.widthBreakpointMediumMobile, 600); | ||
|
||
const element = cy.findByRole("heading"); | ||
element.should("have.css", "font-size", defaultTokens.fontSizeHeadingDisplay); | ||
element.should("have.css", "line-height", defaultTokens.lineHeightHeadingDisplay); | ||
element.should("have.css", "font-weight", defaultTokens.fontWeightHeadingDisplay); | ||
|
||
// Assertion of next media query style | ||
element.should("not.have.css", "font-size", defaultTokens.fontSizeHeadingTitle2); | ||
element.should("not.have.css", "margin-bottom", defaultTokens.spaceSmall); | ||
}); | ||
|
||
it("should have correct styles for large mobile", () => { | ||
cy.visit("/heading-media-props"); | ||
cy.viewport(defaultTokens.widthBreakpointLargeMobile, 600); | ||
|
||
const element = cy.findByRole("heading"); | ||
element.should("have.css", "font-size", defaultTokens.fontSizeHeadingTitle2); | ||
element.should("have.css", "line-height", defaultTokens.lineHeightHeadingTitle2); | ||
element.should("have.css", "font-weight", defaultTokens.fontWeightHeadingTitle2); | ||
element.should("have.css", "margin", `0px 0px ${defaultTokens.spaceXSmall}`); | ||
|
||
// Assertion of next media query style | ||
element.should("not.have.css", "font-size", defaultTokens.fontSizeHeadingTitle4); | ||
element.should("not.have.css", "text-align", "center"); | ||
}); | ||
|
||
it("should have correct styles for tablet", () => { | ||
cy.visit("/heading-media-props"); | ||
cy.viewport(defaultTokens.widthBreakpointTablet, 600); | ||
|
||
const element = cy.findByRole("heading"); | ||
element.should("have.css", "font-size", defaultTokens.fontSizeHeadingTitle4); | ||
element.should("have.css", "line-height", defaultTokens.lineHeightHeadingTitle4); | ||
element.should("have.css", "font-weight", defaultTokens.fontWeightHeadingTitle4); | ||
element.should("have.css", "text-align", "center"); | ||
|
||
// Assertion of next media query style | ||
element.should("not.have.css", "font-size", defaultTokens.fontSizeHeadingTitle5); | ||
}); | ||
|
||
it("should have correct styles for desktop", () => { | ||
cy.visit("/heading-media-props"); | ||
cy.viewport(defaultTokens.widthBreakpointDesktop, 600); | ||
|
||
const element = cy.findByRole("heading"); | ||
element.should("have.css", "font-size", defaultTokens.fontSizeHeadingTitle5); | ||
element.should("have.css", "line-height", defaultTokens.lineHeightHeadingTitle5); | ||
element.should("have.css", "font-weight", defaultTokens.fontWeightHeadingTitle5); | ||
|
||
// Assertion of next media query style | ||
element.should("not.have.css", "font-size", defaultTokens.fontSizeHeadingTitle6); | ||
}); | ||
|
||
it("should have correct styles for large desktop", () => { | ||
cy.visit("/heading-media-props"); | ||
cy.viewport(defaultTokens.widthBreakpointLargeDesktop, 600); | ||
|
||
const element = cy.findByRole("heading"); | ||
element.should("have.css", "font-size", defaultTokens.fontSizeHeadingTitle6); | ||
element.should("have.css", "line-height", defaultTokens.lineHeightHeadingTitle6); | ||
element.should("have.css", "font-weight", defaultTokens.fontWeightHeadingTitle6); | ||
}); | ||
}); |
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.