-
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.
- Loading branch information
1 parent
32b25f8
commit d444729
Showing
41 changed files
with
4,667 additions
and
8,569 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,11 @@ | ||
--- | ||
"components": minor | ||
"design-system": minor | ||
"example": minor | ||
"example-wordpress": minor | ||
"@lighting-beetle/lighter-hooks": minor | ||
"@lighting-beetle/lighter-styleguide": minor | ||
"@lighting-beetle/next-lighter-config": minor | ||
--- | ||
|
||
Updated deps |
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,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
npm run pre-commit |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,86 +1,90 @@ | ||
import * as React from "react"; | ||
import { render, screen } from "@testing-library/react"; | ||
import "@testing-library/jest-dom/extend-expect"; | ||
import Icon, { IconProvider } from "."; | ||
/** | ||
* @jest-environment jsdom | ||
*/ | ||
|
||
describe("Icon", () => { | ||
it("render SVG", () => { | ||
import * as React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import '@testing-library/jest-dom/extend-expect'; | ||
import Icon, { IconProvider } from '.'; | ||
|
||
describe('Icon', () => { | ||
it('render SVG', () => { | ||
render(<Icon name="home" />); | ||
|
||
const icon = screen.getByTitle("home").parentNode; | ||
const icon = screen.getByTitle('home').parentNode; | ||
|
||
expect(icon).toBeInTheDocument(); | ||
expect(icon).toHaveClass("icon", "icon--home"); | ||
expect(icon.querySelector("use")).toHaveAttribute( | ||
"xlink:href", | ||
"/icons-sprite.svg#home" | ||
expect(icon).toHaveClass('icon', 'icon--home'); | ||
expect(icon.querySelector('use')).toHaveAttribute( | ||
'xlink:href', | ||
'/icons-sprite.svg#home' | ||
); | ||
}); | ||
|
||
it("render decorative SVG", () => { | ||
it('render decorative SVG', () => { | ||
render(<Icon name="home" />); | ||
|
||
const icon = screen.getByTitle("home").parentNode; | ||
const icon = screen.getByTitle('home').parentNode; | ||
|
||
expect(icon).toHaveAttribute("aria-hidden", "true"); | ||
expect(icon).toHaveAttribute('aria-hidden', 'true'); | ||
}); | ||
|
||
it("render meaningful SVG", () => { | ||
it('render meaningful SVG', () => { | ||
render(<Icon name="home" alt="This is home icon" />); | ||
|
||
expect(screen.getByRole("img")).toBeInTheDocument(); | ||
expect(screen.getByTitle("This is home icon")).toBeInTheDocument(); | ||
expect(screen.getByRole('img')).toBeInTheDocument(); | ||
expect(screen.getByTitle('This is home icon')).toBeInTheDocument(); | ||
}); | ||
|
||
it("render in correct size", () => { | ||
it('render in correct size', () => { | ||
render(<Icon name="home" size="l" />); | ||
|
||
const icon = screen.getByTitle("home").parentNode; | ||
const icon = screen.getByTitle('home').parentNode; | ||
|
||
expect(icon).toHaveClass("icon--l"); | ||
expect(icon).toHaveClass('icon--l'); | ||
}); | ||
|
||
it("render custom sprite path", () => { | ||
it('render custom sprite path', () => { | ||
render(<Icon name="home" spritePath="/sprite.svg" />); | ||
|
||
const icon = screen.getByTitle("home").parentNode; | ||
const icon = screen.getByTitle('home').parentNode; | ||
|
||
expect(icon.querySelector("use")).toHaveAttribute( | ||
"xlink:href", | ||
"/sprite.svg#home" | ||
expect(icon.querySelector('use')).toHaveAttribute( | ||
'xlink:href', | ||
'/sprite.svg#home' | ||
); | ||
}); | ||
|
||
it("render custom class", () => { | ||
it('render custom class', () => { | ||
render(<Icon name="home" className="test" />); | ||
|
||
const icon = screen.getByTitle("home").parentNode; | ||
const icon = screen.getByTitle('home').parentNode; | ||
|
||
expect(icon).toHaveClass("test"); | ||
expect(icon).toHaveClass('test'); | ||
}); | ||
|
||
it("render custom attribute", () => { | ||
it('render custom attribute', () => { | ||
render(<Icon name="home" data-testid="test" />); | ||
|
||
const icon = screen.getByTestId("test"); | ||
const icon = screen.getByTestId('test'); | ||
|
||
expect(icon).toBeInTheDocument(); | ||
}); | ||
}); | ||
|
||
describe("IconProivder", () => { | ||
it("render custom sprite path", () => { | ||
describe('IconProivder', () => { | ||
it('render custom sprite path', () => { | ||
render( | ||
<IconProvider spritePath="/sprite.svg"> | ||
<Icon name="home" /> | ||
</IconProvider> | ||
); | ||
|
||
const icon = screen.getByTitle("home").parentNode; | ||
const icon = screen.getByTitle('home').parentNode; | ||
|
||
expect(icon.querySelector("use")).toHaveAttribute( | ||
"xlink:href", | ||
"/sprite.svg#home" | ||
expect(icon.querySelector('use')).toHaveAttribute( | ||
'xlink:href', | ||
'/sprite.svg#home' | ||
); | ||
}); | ||
}); |
Oops, something went wrong.