-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Conflicts: # src/Form/_variables.scss # src/Icon/_variables.scss
- Loading branch information
Showing
25 changed files
with
2,621 additions
and
2,014 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,26 @@ | ||
import React from 'react'; | ||
import renderer from 'react-test-renderer'; | ||
|
||
import Button, { ButtonGroup } from './index'; | ||
|
||
describe('<ButtonGroup />', () => { | ||
describe('correct rendering', () => { | ||
it('renders without props', () => { | ||
const tree = renderer.create(( | ||
<ButtonGroup /> | ||
)).toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
|
||
it('renders with children', () => { | ||
const tree = renderer.create(( | ||
<ButtonGroup size="lg"> | ||
<Button variant="primary">Left</Button> | ||
<Button variant="primary">Middle</Button> | ||
<Button variant="primary">Right</Button> | ||
</ButtonGroup> | ||
)).toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
}); | ||
}); |
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,15 @@ | ||
import React from 'react'; | ||
import renderer from 'react-test-renderer'; | ||
|
||
import { ButtonToolbar } from './index'; | ||
|
||
describe('<ButtonToolbar />', () => { | ||
describe('correct rendering', () => { | ||
it('renders without props', () => { | ||
const tree = renderer.create(( | ||
<ButtonToolbar /> | ||
)).toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
}); | ||
}); |
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,37 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`<ButtonGroup /> correct rendering renders with children 1`] = ` | ||
<div | ||
className="btn-group btn-group-lg" | ||
role="group" | ||
> | ||
<button | ||
className="btn btn-primary" | ||
disabled={false} | ||
type="button" | ||
> | ||
Left | ||
</button> | ||
<button | ||
className="btn btn-primary" | ||
disabled={false} | ||
type="button" | ||
> | ||
Middle | ||
</button> | ||
<button | ||
className="btn btn-primary" | ||
disabled={false} | ||
type="button" | ||
> | ||
Right | ||
</button> | ||
</div> | ||
`; | ||
|
||
exports[`<ButtonGroup /> correct rendering renders without props 1`] = ` | ||
<div | ||
className="btn-group btn-group-md" | ||
role="group" | ||
/> | ||
`; |
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,8 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`<ButtonToolbar /> correct rendering renders without props 1`] = ` | ||
<div | ||
className="btn-toolbar" | ||
role="toolbar" | ||
/> | ||
`; |
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,52 @@ | ||
@import "variables"; | ||
|
||
.pgn__color-picker { | ||
box-shadow: 0 0 3px 1px $gray-300; | ||
border: none; | ||
background: | ||
linear-gradient(to bottom right, | ||
rgb(255, 0, 0) 0%, | ||
rgb(255, 154, 0) 17%, | ||
rgb(208, 222, 33) 33%, | ||
rgb(79, 220, 74) 40%, | ||
rgb(28, 127, 238) 75%, | ||
rgb(95, 21, 242) 86%, | ||
rgb(186, 12, 248) 100% | ||
); | ||
|
||
&.pgn__color-picker-sm { | ||
height: $picker-size-sm; | ||
width: $picker-size-sm; | ||
} | ||
|
||
&.pgn__color-picker-md { | ||
height: $picker-size-md; | ||
width: $picker-size-md; | ||
} | ||
} | ||
|
||
.pgn__color-modal { | ||
background: $white; | ||
padding-bottom: .1rem; | ||
margin-bottom: 1rem; | ||
} | ||
|
||
.pgn__color-error { | ||
font-size: 70%; | ||
} | ||
|
||
.pgn__hex-form { | ||
display: flex; | ||
max-width: 180px; | ||
margin: 5px; | ||
|
||
h5 { | ||
margin: 10px; | ||
} | ||
|
||
.form-field { | ||
@media (min-width: map-get($grid-breakpoints, "sm")) { | ||
margin-inline-end: 0; | ||
} | ||
} | ||
} |
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,42 @@ | ||
import React from 'react'; | ||
import renderer from 'react-test-renderer'; | ||
import userEvent from '@testing-library/user-event'; | ||
import { render, fireEvent, screen } from '@testing-library/react'; | ||
import { act } from 'react-dom/test-utils'; | ||
import '@testing-library/jest-dom'; | ||
import ColorPicker from './index'; | ||
|
||
describe('renders correctly', () => { | ||
const color = ''; | ||
const setColor = jest.fn(); | ||
it('successfully renders', () => { | ||
const tree = renderer.create(<ColorPicker color={color} setColor={setColor} />).toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
it('renders with defaults', () => { | ||
const { container } = render(<ColorPicker color={color} setColor={setColor} />); | ||
expect(container.firstChild.firstChild).toHaveClass('pgn__color-picker-md'); | ||
}); | ||
it('renders with the passed variables ', () => { | ||
const className = 'testClassName'; | ||
const { container } = render( | ||
<ColorPicker color={color} setColor={setColor} className={className} size="lg" />, | ||
); | ||
expect(container.firstChild.firstChild).toHaveClass(className); | ||
expect(container.firstChild.firstChild).toHaveClass('pgn__color-picker-lg'); | ||
}); | ||
}); | ||
describe('picker works as expected', () => { | ||
const color = 'wassap'; | ||
const setColor = jest.fn(); | ||
it('validates hex color', async () => { | ||
render(<ColorPicker color={color} setColor={setColor} />); | ||
await act(async () => { | ||
userEvent.click(screen.getByRole('button')); | ||
}); | ||
expect(screen.queryByText('Colors must be in hexadecimal format.')).toBeInTheDocument(); | ||
const input = screen.getByTestId('hex-input'); | ||
fireEvent.change(input, { target: { value: '#32116c' } }); | ||
expect(screen.queryByText('Colors must be in hexadecimal format.')).not.toBeInTheDocument(); | ||
}); | ||
}); |
Oops, something went wrong.