-
-
Notifications
You must be signed in to change notification settings - Fork 589
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add counter-regression test for #524
- Loading branch information
Showing
2 changed files
with
37 additions
and
3 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
packages/render-html/src/__tests__/regression.524.img-enable-exp-percent-width.test.tsx
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,33 @@ | ||
import React from 'react'; | ||
import RenderHTML from '../RenderHTML'; | ||
import { render } from '@testing-library/react-native'; | ||
|
||
/** | ||
* https://github.com/meliorence/react-native-render-html/issues/524 | ||
**/ | ||
describe('RenderHTML component', () => { | ||
describe('should pass regression regarding percent width', () => { | ||
it('dimensions should not be derived from aspect ratio', async () => { | ||
const renderersProps = { | ||
img: { | ||
enableExperimentalPercentWidth: true | ||
} | ||
}; | ||
const { findByTestId } = render( | ||
<RenderHTML | ||
debug={false} | ||
contentWidth={300} | ||
renderersProps={renderersProps} | ||
source={{ | ||
html: '<img style="width:100%" src="https://img.com/1920x1080" width="800" height="400"/>' | ||
}} | ||
/> | ||
); | ||
const img = await findByTestId('image-success'); | ||
expect(img).toHaveStyle({ | ||
width: 300, | ||
height: 400 | ||
}); | ||
}); | ||
}); | ||
}); |
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