initial commit.
This commit is contained in:
10
components/__tests__/ThemedText-test.tsx
Normal file
10
components/__tests__/ThemedText-test.tsx
Normal file
@ -0,0 +1,10 @@
|
||||
import * as React from 'react';
|
||||
import renderer from 'react-test-renderer';
|
||||
|
||||
import { ThemedText } from '../ThemedText';
|
||||
|
||||
it(`renders correctly`, () => {
|
||||
const tree = renderer.create(<ThemedText>Snapshot test!</ThemedText>).toJSON();
|
||||
|
||||
expect(tree).toMatchSnapshot();
|
||||
});
|
24
components/__tests__/__snapshots__/ThemedText-test.tsx.snap
Normal file
24
components/__tests__/__snapshots__/ThemedText-test.tsx.snap
Normal file
@ -0,0 +1,24 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`renders correctly 1`] = `
|
||||
<Text
|
||||
style={
|
||||
[
|
||||
{
|
||||
"color": "#11181C",
|
||||
},
|
||||
{
|
||||
"fontSize": 16,
|
||||
"lineHeight": 24,
|
||||
},
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
]
|
||||
}
|
||||
>
|
||||
Snapshot test!
|
||||
</Text>
|
||||
`;
|
21
components/ui/ISpeakButton.tsx
Normal file
21
components/ui/ISpeakButton.tsx
Normal file
@ -0,0 +1,21 @@
|
||||
import { CachedTranslator } from "@/app/i18n/api"
|
||||
import { language_t } from "@/app/i18n/lang"
|
||||
|
||||
type ISpeakButtonProps = {
|
||||
country: string,
|
||||
language: string,
|
||||
}
|
||||
|
||||
function iSpeak(language : string) {
|
||||
return `I speak ${language}.`
|
||||
}
|
||||
|
||||
async function iSpeakTr(targetLang : string, sourceLang = "en") {
|
||||
const sourceStr = iSpeak(targetLang)
|
||||
const translator = new CachedTranslator(sourceLang, targetLang);
|
||||
return await translator.translate(sourceStr)
|
||||
}
|
||||
|
||||
const ISpeakButton = (props : ISpeakButtonProps) => {
|
||||
|
||||
}
|
Reference in New Issue
Block a user