-
Notifications
You must be signed in to change notification settings - Fork 2
/
WebViewDemoSpec.scala
45 lines (39 loc) · 1.27 KB
/
WebViewDemoSpec.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package showcase.app.community
import scommons.react.navigation._
import scommons.react.test._
import scommons.reactnative._
import scommons.reactnative.safearea.SafeArea._
import scommons.reactnative.safearea._
import scommons.reactnative.webview._
import showcase.app.community.WebViewDemo._
class WebViewDemoSpec extends TestSpec with TestRendererUtils {
it should "render component" in {
//given
val component = <(WebViewDemo())()()
//when
val result = testRender(component)
//then
implicit val theme: Theme = DefaultTheme
assertNativeComponent(result,
<.SafeAreaView(
^.mode := SafeAreaMode.padding, //default
^.edges := List(SafeAreaEdge.left, SafeAreaEdge.bottom, SafeAreaEdge.right),
^.rnStyle := styles.container
)(
<.Text(themeStyle(styles.title, themeTextStyle))("InlineWeb:"),
<.WebView(
^.originWhiteList := Seq("*"),
^.htmlSource := new HtmlResource {
override val html = "<h1>Hello world</h1>"
}
)(),
<.Text(themeStyle(styles.title, themeTextStyle))("WebView:"),
<.WebView(
^.source := new UriResource {
override val uri = "https://scommons.github.io/"
}
)()
)
)
}
}