Skip to content

Commit 522b20a

Browse files
andrewdacenkofacebook-github-bot
authored andcommitted
Add tests for defaultSource and height (facebook#53058)
Summary: Changelog: [Internal] As title Differential Revision: D79566292
1 parent 141c956 commit 522b20a

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
@@ -123,6 +123,44 @@ describe('<Image>', () => {
123123
);
124124
});
125125
});
126+
127+
describe('defaultSource', () => {
128+
it('can provide a default image to display', () => {
129+
const root = Fantom.createRoot();
130+
131+
Fantom.runTask(() => {
132+
root.render(
133+
<Image
134+
defaultSource={require('./img/img1.png')}
135+
source={LOGO_SOURCE}
136+
/>,
137+
);
138+
});
139+
140+
expect(
141+
root.getRenderedOutput({props: ['defaultSource']}).toJSX(),
142+
).toEqual(
143+
<rn-image
144+
defaultSource-type="remote"
145+
defaultSource-uri="file://drawable-mdpi/packages_reactnative_libraries_image___tests___img_img1.png"
146+
/>,
147+
);
148+
});
149+
});
150+
151+
describe('height', () => {
152+
it('provides height for image', () => {
153+
const root = Fantom.createRoot();
154+
155+
Fantom.runTask(() => {
156+
root.render(<Image height={100} source={LOGO_SOURCE} />);
157+
});
158+
159+
expect(root.getRenderedOutput({props: ['height']}).toJSX()).toEqual(
160+
<rn-image height="100.000000" />,
161+
);
162+
});
163+
});
126164
});
127165

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

0 commit comments

Comments
 (0)