-
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.
* chore: add unit tests * fix: eslint path * update unit tests
- Loading branch information
1 parent
3508c4e
commit b540d86
Showing
15 changed files
with
574 additions
and
200 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 @@ | ||
20.12.2 |
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,44 @@ | ||
module.exports = { | ||
extends: ['airbnb', 'airbnb-typescript'], | ||
plugins: ['@typescript-eslint'], | ||
parserOptions: { | ||
ecmaFeatures: { | ||
jsx: true, | ||
experimentalObjectRestSpread: true, | ||
}, | ||
project: './tsconfig.json', | ||
}, | ||
rules: { | ||
'no-underscore-dangle': 0, | ||
'import/no-extraneous-dependencies': 0, | ||
'react/require-extension': 0, | ||
'react/jsx-filename-extension': 0, | ||
'react/destructuring-assignment': 0, | ||
'react/default-props-match-prop-types': 0, | ||
'react/jsx-props-no-spreading': 0, | ||
'react/static-property-placement': 0, | ||
'react/jsx-uses-react': 'off', | ||
'react/react-in-jsx-scope': 'off', | ||
'arrow-body-style': 0, | ||
'prefer-arrow-callback': 0, | ||
'func-names': 0, | ||
'react/forbid-prop-types': 0, | ||
'comma-dangle': 0, | ||
'react/sort-comp': 0, | ||
'react/prop-types': 0, | ||
'arrow-parens': 0, | ||
'import/extensions': [ | ||
'error', | ||
'always', | ||
{ | ||
js: 'never', | ||
jsx: 'never', | ||
ts: 'never', | ||
tsx: 'never', | ||
}, | ||
], | ||
}, | ||
env: { | ||
jest: true, | ||
}, | ||
}; |
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 @@ | ||
import '@testing-library/jest-dom'; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`AspectRatio Component should render correctly 1`] = ` | ||
<div | ||
class="react-aspect-ratio-placeholder" | ||
style="--aspect-ratio: (1);" | ||
> | ||
Content | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { render } from '@testing-library/react'; | ||
import AspectRatio from '.'; | ||
|
||
describe('AspectRatio Component', () => { | ||
it('should render correctly', () => { | ||
const { container } = render(<AspectRatio>Content</AspectRatio>); | ||
expect(container.firstChild).toMatchSnapshot(); | ||
}); | ||
|
||
it('should apply default class name', () => { | ||
const { container } = render(<AspectRatio>Content</AspectRatio>); | ||
expect(container.firstChild).toHaveClass('react-aspect-ratio-placeholder'); | ||
}); | ||
|
||
it('should apply custom class name', () => { | ||
const customClassName = 'custom-class'; | ||
const { container } = render(<AspectRatio className={customClassName}>Content</AspectRatio>); | ||
expect(container.firstChild).toHaveClass(customClassName); | ||
}); | ||
|
||
it('should apply custom style', () => { | ||
const customStyle = { backgroundColor: 'red' }; | ||
const { container } = render(<AspectRatio style={customStyle}>Content</AspectRatio>); | ||
expect(container.firstChild).toHaveStyle(customStyle); | ||
}); | ||
|
||
it('should apply custom ratio', () => { | ||
const customRatio = 1.5; | ||
const { container } = render(<AspectRatio ratio={customRatio}>Content</AspectRatio>); | ||
expect(container.firstChild).toHaveStyle({ '--aspect-ratio': `(${customRatio})` }); | ||
}); | ||
}); |
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,10 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`AspectRatio Component should render correctly 1`] = ` | ||
<div | ||
class="react-aspect-ratio-placeholder" | ||
style="--aspect-ratio: (1);" | ||
> | ||
Content | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { render } from '@testing-library/react'; | ||
import AspectRatio from '.'; | ||
|
||
describe('AspectRatio Component', () => { | ||
it('should render correctly', () => { | ||
const { container } = render(<AspectRatio>Content</AspectRatio>); | ||
expect(container.firstChild).toMatchSnapshot(); | ||
}); | ||
|
||
it('should apply default class name', () => { | ||
const { container } = render(<AspectRatio>Content</AspectRatio>); | ||
expect(container.firstChild).toHaveClass('react-aspect-ratio-placeholder'); | ||
}); | ||
|
||
it('should apply custom class name', () => { | ||
const customClassName = 'custom-class'; | ||
const { container } = render(<AspectRatio className={customClassName}>Content</AspectRatio>); | ||
expect(container.firstChild).toHaveClass(customClassName); | ||
}); | ||
|
||
it('should apply custom style', () => { | ||
const customStyle = { backgroundColor: 'red' }; | ||
const { container } = render(<AspectRatio style={customStyle}>Content</AspectRatio>); | ||
expect(container.firstChild).toHaveStyle(customStyle); | ||
}); | ||
|
||
it('should apply custom ratio', () => { | ||
const customRatio = 1.5; | ||
const { container } = render(<AspectRatio ratio={customRatio}>Content</AspectRatio>); | ||
expect(container.firstChild).toHaveStyle({ '--aspect-ratio': `(${customRatio})` }); | ||
}); | ||
}); |
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.