Skip to content
This repository was archived by the owner on Feb 10, 2023. It is now read-only.

Commit 94b6965

Browse files
authored
Merge pull request #69 from cquiroz/common
Updated react common
2 parents 25464e3 + c7314ef commit 94b6965

File tree

4 files changed

+58
-3
lines changed

4 files changed

+58
-3
lines changed

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ lazy val facade =
131131
libraryDependencies ++= Seq(
132132
"com.github.japgolly.scalajs-react" %%% "core" % scalaJsReact,
133133
"com.github.japgolly.scalajs-react" %%% "extra" % scalaJsReact,
134-
"io.github.cquiroz.react" %%% "common" % "0.3.5",
134+
"io.github.cquiroz.react" %%% "common" % "0.3.6",
135135
"com.github.japgolly.scalajs-react" %%% "test" % scalaJsReact % Test,
136136
"com.lihaoyi" %%% "utest" % "0.7.2" % Test,
137137
"org.typelevel" %%% "cats-core" % "2.1.0" % Test

facade/src/main/scala/react/semanticui/package.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import js.annotation.JSImport
55
import js.|
66
import japgolly.scalajs.react._
77
import japgolly.scalajs.react.raw.React
8-
import japgolly.scalajs.react.vdom.VdomNode
8+
import japgolly.scalajs.react.vdom._
99

1010
package semanticui {
1111
sealed trait As {

facade/src/test/scala/react/semanticui/elements/image/ImageTests.scala

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package react.semanticui.elements.image
22

33
import utest._
44
import japgolly.scalajs.react.test._
5+
import japgolly.scalajs.react.vdom.html_<^._
56
import react.semanticui.elements.icon.Icon
67

78
object ImageTests extends TestSuite {
@@ -13,6 +14,15 @@ object ImageTests extends TestSuite {
1314
assert(mountNode.innerHTML == """<img class="ui image">""")
1415
}
1516
}
17+
'renderInside - {
18+
val image = <.div(Image(src = "http://fig1.jpg", className = "draggable"))
19+
ReactTestUtils.withNewBodyElement { mountNode =>
20+
image.renderIntoDOM(mountNode)
21+
assert(
22+
mountNode.innerHTML == """<div><img src="http://fig1.jpg" class="ui image draggable"></div>"""
23+
)
24+
}
25+
}
1626
'renderAs - {
1727
val image = Image(as = "a", href = "abc")
1828
ReactTestUtils.withNewBodyElement { mountNode =>

facade/src/test/scala/react/semanticui/modules/sidebar/SidebarTests.scala

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ import japgolly.scalajs.react.test._
55
import japgolly.scalajs.react.vdom.html_<^._
66
import japgolly.scalajs.react.ScalaComponent
77
import japgolly.scalajs.react._
8-
import react.semanticui.collections.menu.Menu
8+
import react.semanticui.collections.menu._
9+
import react.semanticui.elements.icon._
910
import react.semanticui.As
11+
import react.common._
1012

1113
object SidebarTests extends TestSuite {
1214
val DoubleComp = ScalaComponent
@@ -48,5 +50,48 @@ object SidebarTests extends TestSuite {
4850
assert(m.outerHtmlScrubbed == """<div class="ui inverted ui left sidebar menu">Abc</div>""")
4951
}
5052
}
53+
'example - {
54+
val sidebar =
55+
<.div(
56+
Menu(
57+
attached = MenuAttached.Top,
58+
compact = true,
59+
borderless = true,
60+
tabular = MenuTabular.Right
61+
)(
62+
MenuItem(as = "a")(
63+
Icon("bars"),
64+
"Formerly known as OT"
65+
)
66+
),
67+
SidebarPushable(className = "maingrid")(
68+
Sidebar(
69+
as = As.Menu(
70+
Menu(
71+
inverted = true,
72+
vertical = true,
73+
icon = MenuIcon.Labeled
74+
)
75+
),
76+
width = SidebarWidth.Thin,
77+
animation = SidebarAnimation.Push,
78+
direction = SidebarDirection.Left,
79+
visible = true
80+
)(
81+
MenuItem(as = "a")(Icon("home"), "P I"),
82+
MenuItem(as = "a")(Icon("home"), "P II")
83+
),
84+
SidebarPusher(dimmed = true)(
85+
<.div("Main")
86+
)
87+
)
88+
)
89+
ReactTestUtils.withNewBodyElement { mountNode =>
90+
sidebar.renderIntoDOM(mountNode)
91+
assert(
92+
mountNode.innerHTML == """<div><div class="ui borderless compact top attached right tabular menu"><a class="item"><i aria-hidden="true" class="bars icon"></i>Formerly known as OT</a></div><div class="pushable maingrid"><div class="ui inverted vertical labeled icon ui push left thin visible sidebar menu"><a class="item"><i aria-hidden="true" class="home icon"></i>P I</a><a class="item"><i aria-hidden="true" class="home icon"></i>P II</a></div><div class="pusher dimmed"><div>Main</div></div></div></div>"""
93+
)
94+
}
95+
}
5196
}
5297
}

0 commit comments

Comments
 (0)