-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(tabs): update Tabs to match style specs (#96)
- Loading branch information
Showing
7 changed files
with
201 additions
and
18 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 |
---|---|---|
|
@@ -2,5 +2,3 @@ | |
. "$(dirname "$0")/_/husky.sh" | ||
|
||
yarn lint-staged | ||
|
||
yarn test |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`<Tabs /> Test story renders snapshot 1`] = ` | ||
<div | ||
class="MuiTabs-root css-m4aju7" | ||
data-testid="tabs" | ||
> | ||
<div | ||
class="MuiTabs-scroller MuiTabs-fixed" | ||
style="overflow: hidden;" | ||
> | ||
<div | ||
class="MuiTabs-flexContainer" | ||
role="tablist" | ||
> | ||
<button | ||
aria-selected="true" | ||
class="MuiButtonBase-root MuiTab-root MuiTab-textColorInherit css-17gm9np Mui-selected" | ||
role="tab" | ||
tabindex="0" | ||
type="button" | ||
> | ||
<span | ||
class="MuiTab-wrapper" | ||
> | ||
Tab One | ||
</span> | ||
<span | ||
class="MuiTouchRipple-root" | ||
/> | ||
</button> | ||
<button | ||
aria-selected="false" | ||
class="MuiButtonBase-root MuiTab-root MuiTab-textColorInherit css-17gm9np" | ||
role="tab" | ||
tabindex="-1" | ||
type="button" | ||
> | ||
<span | ||
class="MuiTab-wrapper" | ||
> | ||
Tab Two | ||
</span> | ||
<span | ||
class="MuiTouchRipple-root" | ||
/> | ||
</button> | ||
</div> | ||
<span | ||
class="PrivateTabIndicator-root-1 PrivateTabIndicator-colorSecondary-3 css-1r8eawc" | ||
style="left: 0px; width: 0px;" | ||
/> | ||
</div> | ||
</div> | ||
`; |
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,31 @@ | ||
import { generateSnapshots } from "@chanzuckerberg/story-utils"; | ||
import { composeStory } from "@storybook/testing-react"; | ||
import { render, screen } from "@testing-library/react"; | ||
import React from "react"; | ||
import * as snapshotTestStoryFile from "./index.stories"; | ||
import Meta, { Test as TestStory } from "./index.stories"; | ||
|
||
// Returns a component that already contain all decorators from story level, meta level and global level. | ||
const Test = composeStory(TestStory, Meta); | ||
|
||
describe("<Tabs />", () => { | ||
generateSnapshots(snapshotTestStoryFile); | ||
|
||
it("renders Tabs component", () => { | ||
render(<Test />); | ||
|
||
const element = screen.getByTestId("tabs"); | ||
|
||
expect(element).not.toBeNull(); | ||
}); | ||
|
||
it("renders tab texts", () => { | ||
render(<Test />); | ||
|
||
const Label1 = screen.getByText(/Tab One/i); | ||
const Label2 = screen.getByText(/Tab Two/i); | ||
|
||
expect(Label1).toBeTruthy(); | ||
expect(Label2).toBeTruthy(); | ||
}); | ||
}); |
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