Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict-local
* @format
*/

import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment';

import * as Fantom from '@react-native/fantom';

Check warning on line 13 in packages/react-native/Libraries/Components/ProgressBarAndroid/__tests__/ProgressBarAndroid-itest.js

View workflow job for this annotation

GitHub Actions / test_js (24)

Requires should be sorted alphabetically, with at least one line between imports/requires and code

Check warning on line 13 in packages/react-native/Libraries/Components/ProgressBarAndroid/__tests__/ProgressBarAndroid-itest.js

View workflow job for this annotation

GitHub Actions / test_js (22)

Requires should be sorted alphabetically, with at least one line between imports/requires and code

Check warning on line 13 in packages/react-native/Libraries/Components/ProgressBarAndroid/__tests__/ProgressBarAndroid-itest.js

View workflow job for this annotation

GitHub Actions / test_js (20.19.4)

Requires should be sorted alphabetically, with at least one line between imports/requires and code
import * as React from 'react';
// $FlowFixMe[missing-platform-support]
import ProgressBarAndroid from '../ProgressBarAndroid.android';

describe('<ProgressBarAndroid>', () => {
describe('props', () => {
describe('styleAttr and indeterminate', () => {
it('renders with styleAttr="Horizontal" and indeterminate={true}', () => {
const root = Fantom.createRoot();

Fantom.runTask(() => {
root.render(
<ProgressBarAndroid styleAttr="Horizontal" indeterminate={true} />,
);
});

expect(root.getRenderedOutput().toJSX()).toEqual(
<rn-androidProgressBar />,
);
});

it('renders with default props', () => {
const root = Fantom.createRoot();

Fantom.runTask(() => {
root.render(
<ProgressBarAndroid styleAttr="Normal" indeterminate={true} />,
);
});

expect(root.getRenderedOutput().toJSX()).toEqual(
<rn-androidProgressBar />,
);
});

it('renders with styleAttr="Normal"', () => {
const root = Fantom.createRoot();

Fantom.runTask(() => {
root.render(
<ProgressBarAndroid styleAttr="Normal" indeterminate={true} />,
);
});

expect(root.getRenderedOutput().toJSX()).toEqual(
<rn-androidProgressBar />,
);
});

it('renders with styleAttr="Horizontal" and determinate progress', () => {
const root = Fantom.createRoot();

Fantom.runTask(() => {
root.render(
<ProgressBarAndroid
styleAttr="Horizontal"
indeterminate={false}
progress={0.5}
/>,
);
});

expect(root.getRenderedOutput().toJSX()).toEqual(
<rn-androidProgressBar />,
);
});
});

describe('animating', () => {
it('defaults to true', () => {
const root = Fantom.createRoot();

Fantom.runTask(() => {
root.render(
<ProgressBarAndroid styleAttr="Horizontal" indeterminate={true} />,
);
});

expect(root.getRenderedOutput().toJSX()).toEqual(
<rn-androidProgressBar />,
);
});

it('renders when animating is false', () => {
const root = Fantom.createRoot();

Fantom.runTask(() => {
root.render(
<ProgressBarAndroid
styleAttr="Horizontal"
indeterminate={true}
animating={false}
/>,
);
});

expect(root.getRenderedOutput().toJSX()).toEqual(
<rn-androidProgressBar />,
);
});
});

describe('testID', () => {
it('is propagated to the native component', () => {
const root = Fantom.createRoot();

Fantom.runTask(() => {
root.render(
<ProgressBarAndroid
styleAttr="Horizontal"
indeterminate={true}
testID="my-progress-bar"
/>,
);
});

expect(root.getRenderedOutput({props: ['testID']}).toJSX()).toEqual(
<rn-androidProgressBar testID="my-progress-bar" />,
);
});
});
});
});

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict-local
* @format
*/

import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment';

import * as Fantom from '@react-native/fantom';
import * as React from 'react';
import {SafeAreaView, Text, View} from 'react-native';

describe('<SafeAreaView>', () => {
it('renders with children', () => {
const root = Fantom.createRoot();

Fantom.runTask(() => {
root.render(
<SafeAreaView collapsable={false}>
<View collapsable={false}>
<Text>Hello World!</Text>
</View>
</SafeAreaView>,
);
});

expect(root.getRenderedOutput({props: []}).toJSX()).toEqual(
<rn-view>
<rn-view>
<rn-paragraph>Hello World!</rn-paragraph>
</rn-view>
</rn-view>,
);
});
});

This file was deleted.

Loading
Loading