-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1142 from jiji14/configurable-app-dashboard
Make the Dashboard tab configurable, and implement new components
- Loading branch information
Showing
35 changed files
with
1,327 additions
and
444 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
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 { render } from '@testing-library/react-native'; | ||
import { View } from 'react-native'; | ||
import Carousel from '../js/components/Carousel'; | ||
|
||
describe('Carousel component', () => { | ||
const child1 = <View testID="child1">Child 1</View>; | ||
const child2 = <View testID="child2">Child 2</View>; | ||
const cardWidth = 100; | ||
const cardMargin = 10; | ||
|
||
it('renders children correctly', () => { | ||
const { getByTestId } = render( | ||
<Carousel cardWidth={cardWidth} cardMargin={cardMargin}> | ||
{child1} | ||
{child2} | ||
</Carousel>, | ||
); | ||
|
||
const renderedChild1 = getByTestId('child1'); | ||
const renderedChild2 = getByTestId('child2'); | ||
|
||
expect(renderedChild1).toBeTruthy(); | ||
expect(renderedChild2).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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React from 'react'; | ||
import { render, screen } from '@testing-library/react-native'; | ||
import DateSelect from '../js/diary/list/DateSelect'; | ||
|
||
jest.mock('react-native-safe-area-context', () => ({ | ||
useSafeAreaInsets: () => ({ bottom: 30, left: 0, right: 0, top: 30 }), | ||
})); | ||
jest.spyOn(React, 'useState').mockImplementation((initialValue) => [initialValue, jest.fn()]); | ||
jest.spyOn(React, 'useEffect').mockImplementation((effect: () => void) => effect()); | ||
|
||
describe('DateSelect', () => { | ||
it('renders correctly', () => { | ||
const onChooseMock = jest.fn(); | ||
const { getByText } = render(<DateSelect mode="range" onChoose={onChooseMock} />); | ||
|
||
expect(screen.getByTestId('button-container')).toBeTruthy(); | ||
expect(screen.getByTestId('button')).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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { getTheme } from '../js/appTheme'; | ||
|
||
describe('getTheme', () => { | ||
it('should return the right theme with place', () => { | ||
const theme = getTheme('place'); | ||
expect(theme.colors.elevation.level1).toEqual('#cbe6ff'); | ||
}); | ||
|
||
it('should return the right theme with untracked', () => { | ||
const theme = getTheme('untracked'); | ||
expect(theme.colors.primary).toEqual('#8c4a57'); | ||
expect(theme.colors.primaryContainer).toEqual('#e3bdc2'); | ||
expect(theme.colors.elevation.level1).toEqual('#f8ebec'); | ||
}); | ||
|
||
it('should return the right theme with draft', () => { | ||
const theme = getTheme('draft'); | ||
expect(theme.colors.primary).toEqual('#616971'); | ||
expect(theme.colors.primaryContainer).toEqual('#b6bcc2'); | ||
expect(theme.colors.background).toEqual('#eef1f4'); | ||
}); | ||
}); |
Oops, something went wrong.