Skip to content

Commit 233d463

Browse files
andrewdacenkofacebook-github-bot
authored andcommitted
Add tests for defaultSource and height (#53058)
Summary: Changelog: [Internal] As title Reviewed By: rshest Differential Revision: D79566292
1 parent 138d0eb commit 233d463

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

packages/react-native/Libraries/Image/__tests__/Image-itest.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,44 @@ describe('<Image>', () => {
169169
);
170170
});
171171
});
172+
173+
describe('defaultSource', () => {
174+
it('can provide a default image to display', () => {
175+
const root = Fantom.createRoot();
176+
177+
Fantom.runTask(() => {
178+
root.render(
179+
<Image
180+
defaultSource={require('./img/img1.png')}
181+
source={LOGO_SOURCE}
182+
/>,
183+
);
184+
});
185+
186+
expect(
187+
root.getRenderedOutput({props: ['defaultSource']}).toJSX(),
188+
).toEqual(
189+
<rn-image
190+
defaultSource-type="remote"
191+
defaultSource-uri="file://drawable-mdpi/packages_reactnative_libraries_image___tests___img_img1.png"
192+
/>,
193+
);
194+
});
195+
});
196+
197+
describe('height', () => {
198+
it('provides height for image', () => {
199+
const root = Fantom.createRoot();
200+
201+
Fantom.runTask(() => {
202+
root.render(<Image height={100} source={LOGO_SOURCE} />);
203+
});
204+
205+
expect(root.getRenderedOutput({props: ['height']}).toJSX()).toEqual(
206+
<rn-image height="100.000000" />,
207+
);
208+
});
209+
});
172210
});
173211

174212
describe('ref', () => {

0 commit comments

Comments
 (0)