-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into rp--open-payments-sdk
- Loading branch information
Showing
13 changed files
with
213 additions
and
92 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
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,30 @@ | ||
import '@testing-library/jest-dom' | ||
|
||
import { render, screen } from '@testing-library/react' | ||
import React from 'react' | ||
|
||
import { Slider } from '../slider' | ||
|
||
describe('Slider Component', () => { | ||
it('renders without crashing', () => { | ||
render(<Slider />) | ||
expect(screen.getByRole('slider')).toBeInTheDocument() | ||
}) | ||
|
||
it('handles disabled prop', () => { | ||
render(<Slider disabled={true} />) | ||
expect(screen.getByRole('slider')).toBeDisabled() | ||
}) | ||
|
||
it('displays error message when provided', () => { | ||
const errorMessage = 'Error message' | ||
render(<Slider errorMessage={errorMessage} />) | ||
expect(screen.getByText(errorMessage)).toBeInTheDocument() | ||
}) | ||
|
||
it('passes additional props to the input', () => { | ||
const testName = 'test-name' | ||
render(<Slider name={testName} />) | ||
expect(screen.getByRole('slider')).toHaveAttribute('name', testName) | ||
}) | ||
}) |
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,18 @@ | ||
import { storageApi } from '@/utils/storage' | ||
|
||
const getStorageKey = async (key: any) => { | ||
try { | ||
const data = await storageApi.get(key) | ||
return { | ||
type: 'SUCCESS', | ||
[key]: data?.[key], | ||
} | ||
} catch (error) { | ||
return { | ||
type: 'ERROR', | ||
error, | ||
} | ||
} | ||
} | ||
|
||
export default { callback: getStorageKey, type: 'GET_STORAGE_KEY' } |
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 getSendingPaymentPointerHandler from './getSendingPaymentPointerHandler' | ||
import getStorageData from './getStorageData' | ||
import getStorageKey from './getStorageKey' | ||
import isMonetizationReadyHandler from './isMonetizationReadyHandler' | ||
import runPaymentHandler from './runPaymentHandler' | ||
import setIncomingPointerHandler from './setIncomingPointerHandler' | ||
import setStorageKey from './setStorageKey' | ||
|
||
export { | ||
getSendingPaymentPointerHandler, | ||
getStorageData, | ||
getStorageKey, | ||
isMonetizationReadyHandler, | ||
runPaymentHandler, | ||
setIncomingPointerHandler, | ||
setStorageKey, | ||
} |
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,12 @@ | ||
import { storageApi } from '@/utils/storage' | ||
|
||
const setStorageKey = async ({ key, value }: { key: string; value: any }) => { | ||
try { | ||
await storageApi.set({ [key]: value }) | ||
return { type: 'SUCCESS' } | ||
} catch (error) { | ||
return { type: 'ERROR', error } | ||
} | ||
} | ||
|
||
export default { callback: setStorageKey, type: 'SET_STORAGE_KEY' } |
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.