Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
2 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
src/__tests__/regression.classes-styles-re-render.377.test.js
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,38 @@ | ||
import React from "react"; | ||
import { Text, StyleSheet } from "react-native"; | ||
import HTML from "../index"; | ||
import Renderer from "react-test-renderer"; | ||
|
||
/** | ||
* https://github.com/archriss/react-native-render-html/issues/377 | ||
*/ | ||
describe("HTML component", () => { | ||
const colorYellow = { | ||
color: "yellow", | ||
}; | ||
const colorGreen = { | ||
color: "green", | ||
}; | ||
const tagsStylesInstance1 = { | ||
highlight: colorYellow, | ||
}; | ||
const tagsStylesInstance2 = { | ||
highlight: colorGreen, | ||
}; | ||
it("should pass regression #343 regarding classesStyles prop", () => { | ||
const testRenderer = Renderer.create( | ||
<HTML | ||
html={'<p class="highlight">hello world</p>'} | ||
classesStyles={tagsStylesInstance1} | ||
/> | ||
); | ||
testRenderer.update( | ||
<HTML | ||
html={'<p class="highlight">hello world</p>'} | ||
classesStyles={tagsStylesInstance2} | ||
/> | ||
); | ||
const text = testRenderer.root.findByType(Text); | ||
expect(StyleSheet.flatten(text.props.style)).toMatchObject(colorGreen); | ||
}); | ||
}); |
32 changes: 32 additions & 0 deletions
32
src/__tests__/regression.tags-styles-re-render.343.test.js
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,32 @@ | ||
import React from "react"; | ||
import { Text, StyleSheet } from "react-native"; | ||
import HTML from "../index"; | ||
import Renderer from "react-test-renderer"; | ||
|
||
/** | ||
* https://github.com/archriss/react-native-render-html/issues/343 | ||
*/ | ||
describe("HTML component", () => { | ||
const letterSpacing2 = { | ||
letterSpacing: 2, | ||
}; | ||
const letterSpacing3 = { | ||
letterSpacing: 3 | ||
}; | ||
const tagsStylesInstance1 = { | ||
a: letterSpacing2, | ||
}; | ||
const tagsStylesInstance2 = { | ||
a: letterSpacing3, | ||
}; | ||
it("should pass regression #343 regarding tagsStyles prop", () => { | ||
const testRenderer = Renderer.create( | ||
<HTML html={"<a>hello world</a>"} tagsStyles={tagsStylesInstance1} /> | ||
); | ||
testRenderer.update( | ||
<HTML html={"<a>hello world</a>"} tagsStyles={tagsStylesInstance2} /> | ||
); | ||
const text = testRenderer.root.findByType(Text); | ||
expect(StyleSheet.flatten(text.props.style)).toMatchObject(letterSpacing3); | ||
}); | ||
}); |