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

Commit

Permalink
Merge pull request #75 from cquiroz/next
Browse files Browse the repository at this point in the history
Upgrade to scala 2.13 and scalajs-react 1.5.0
  • Loading branch information
cquiroz authored Jan 9, 2020
2 parents b0d695c + 5ac6c71 commit a5ae010
Show file tree
Hide file tree
Showing 66 changed files with 186 additions and 226 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Changes

## 0.2.2
## 0.3.0

* Upgrade to scala 2.13
* Upgrade to scalajs-react 1.5.0
* Upgrade to react-semantic-ui 0.87.3
* Better types for toast
* List component
Expand Down
61 changes: 9 additions & 52 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
val reactJS = "16.7.0"
val scalaJsReact = "1.4.2"
val scalaJsReact = "1.5.0"
val SUI = "2.4.1"
val reactSUI = "0.87.3"
val Toasts = "0.6.5"
Expand Down Expand Up @@ -134,7 +134,7 @@ lazy val facade =
libraryDependencies ++= Seq(
"com.github.japgolly.scalajs-react" %%% "core" % scalaJsReact,
"com.github.japgolly.scalajs-react" %%% "extra" % scalaJsReact,
"io.github.cquiroz.react" %%% "common" % "0.3.7",
"io.github.cquiroz.react" %%% "common" % "0.4.0",
"com.github.japgolly.scalajs-react" %%% "test" % scalaJsReact % Test,
"com.lihaoyi" %%% "utest" % "0.7.2" % Test,
"org.typelevel" %%% "cats-core" % "2.1.0" % Test
Expand All @@ -144,58 +144,15 @@ lazy val facade =
)

lazy val commonSettings = Seq(
scalaVersion := "2.12.10",
scalaVersion := "2.13.1",
organization := "io.github.cquiroz.react",
sonatypeProfileName := "io.github.cquiroz",
description := "scala.js facade for react-semanticui",
publishArtifact in Test := false,
scalacOptions := Seq(
"-deprecation", // Emit warning and location for usages of deprecated APIs.
"-encoding",
"utf-8", // Specify character encoding used by source files.
"-explaintypes", // Explain type errors in more detail.
"-feature", // Emit warning and location for usages of features that should be imported explicitly.
"-language:existentials", // Existential types (besides wildcard types) can be written and inferred
"-language:experimental.macros", // Allow macro definition (besides implementation and application)
"-language:higherKinds", // Allow higher-kinded types
"-language:implicitConversions", // Allow definition of implicit functions called views
"-unchecked", // Enable additional warnings where generated code depends on assumptions.
"-Xcheckinit", // Wrap field accessors to throw an exception on uninitialized access.
"-Xfatal-warnings", // Fail the compilation if there are any warnings.
"-Xfuture", // Turn on future language features.
"-Xlint:adapted-args", // Warn if an argument list is modified to match the receiver.
"-Xlint:by-name-right-associative", // By-name parameter of right associative operator.
"-Xlint:constant", // Evaluation of a constant arithmetic expression results in an error.
"-Xlint:delayedinit-select", // Selecting member of DelayedInit.
"-Xlint:doc-detached", // A Scaladoc comment appears to be detached from its element.
"-Xlint:inaccessible", // Warn about inaccessible types in method signatures.
"-Xlint:infer-any", // Warn when a type argument is inferred to be `Any`.
"-Xlint:missing-interpolator", // A string literal appears to be missing an interpolator id.
"-Xlint:nullary-override", // Warn when non-nullary `def f()' overrides nullary `def f'.
"-Xlint:nullary-unit", // Warn when nullary methods return Unit.
"-Xlint:option-implicit", // Option.apply used implicit view.
"-Xlint:package-object-classes", // Class or object defined in package object.
"-Xlint:poly-implicit-overload", // Parameterized overloaded implicit methods are not visible as view bounds.
"-Xlint:private-shadow", // A private field (or class parameter) shadows a superclass field.
"-Xlint:stars-align", // Pattern sequence wildcard must align with sequence component.
"-Xlint:type-parameter-shadow", // A local type parameter shadows a type already in scope.
"-Xlint:unsound-match", // Pattern match may not be typesafe.
"-Yno-adapted-args", // Do not adapt an argument list (either by inserting () or creating a tuple) to match the receiver.
"-Ypartial-unification", // Enable partial unification in type constructor inference
"-Ywarn-extra-implicit", // Warn when more than one implicit parameter section is defined.
"-Ywarn-inaccessible", // Warn about inaccessible types in method signatures.
"-Ywarn-infer-any", // Warn when a type argument is inferred to be `Any`.
"-Ywarn-nullary-override", // Warn when non-nullary `def f()' overrides nullary `def f'.
"-Ywarn-nullary-unit", // Warn when nullary methods return Unit.
"-Ywarn-numeric-widen", // Warn when numerics are widened.
"-Ywarn-unused:implicits", // Warn if an implicit parameter is unused.
"-Ywarn-unused:imports", // Warn if an import selector is not referenced.
"-Ywarn-unused:locals", // Warn if a local definition is unused.
// "-Ywarn-unused:params", // Warn if a value parameter is unused.
"-Ywarn-unused:patvars", // Warn if a variable bound in a pattern is unused.
"-Ywarn-unused:privates", // Warn if a private member is unused.
"-Ywarn-value-discard", // Warn when non-Unit expression results are unused.
"-Yrangepos",
"-P:scalajs:sjsDefinedByDefault"
)
scalacOptions ~= (_.filterNot(Set(
// By necessity facades will have unused params
"-Wdead-code",
"-Wunused:params"
))),
scalacOptions += "-P:scalajs:sjsDefinedByDefault"
)
2 changes: 1 addition & 1 deletion demo/src/main/scala/react/semanticui/demo/SUIMain.scala
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ object Routing {
render(IconsComponent.apply)
| staticRoute("elements/labels", ElementPage(LabelsElement)) ~>
render(LabelsComponent.apply)
).notFound(redirectToPage(HomePage)(Redirect.Replace))
).notFound(redirectToPage(HomePage)(SetRouteVia.HistoryReplace))
.renderWith(layout)
.logToConsole
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import utest._

object ConfirmTests extends TestSuite {
val tests = Tests {
'render - {
test("render") {
//Modal cannot be tested without anmiationFrame
// val pusher = Confirm(content = "Abc")
// ReactTestUtils.withNewBodyElement { mountNode =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import japgolly.scalajs.react.test._

object GridColumnTests extends TestSuite {
val tests = Tests {
'render - {
test("render") {
val gridColumn = GridColumn()
ReactTestUtils.withNewBodyElement { mountNode =>
gridColumn.renderIntoDOM(mountNode)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import japgolly.scalajs.react.vdom.html_<^._

object GridRowTests extends TestSuite {
val tests = Tests {
'render - {
test("render") {
val gridRow = GridRow()
ReactTestUtils.withNewBodyElement { mountNode =>
gridRow.renderIntoDOM(mountNode)
assert(mountNode.innerHTML == """<div class="row"></div>""")
}
}
'renderChild - {
test("renderChild") {
val gridRow = GridRow(<.div("abc"))
ReactTestUtils.withNewBodyElement { mountNode =>
gridRow.renderIntoDOM(mountNode)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import japgolly.scalajs.react.test._

object GridTests extends TestSuite {
val tests = Tests {
'render - {
test("render") {
val grid = Grid()
ReactTestUtils.withNewBodyElement { mountNode =>
grid.renderIntoDOM(mountNode)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import japgolly.scalajs.react.test._

object MenuHeaderTests extends TestSuite {
val tests = Tests {
'render - {
test("render") {
val menuHeader = MenuHeader()
ReactTestUtils.withNewBodyElement { mountNode =>
menuHeader.renderIntoDOM(mountNode)
assert(mountNode.innerHTML == """<div class="header"></div>""")
}
}
'renderAs - {
test("renderAs") {
val menuHeader = MenuHeader(as = "a")
ReactTestUtils.withNewBodyElement { mountNode =>
menuHeader.renderIntoDOM(mountNode)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ import react.semanticui.elements.icon._

object MenuItemTests extends TestSuite {
val tests = Tests {
'render - {
test("render") {
val menuItem = MenuItem()
ReactTestUtils.withRenderedIntoDocument(menuItem) { m =>
assert(m.outerHtmlScrubbed() == """<div class="item"></div>""")
}
}
'renderAs - {
test("renderAs") {
val button = MenuItem(as = "a")
ReactTestUtils.withRenderedIntoDocument(button) { m =>
assert(m.outerHtmlScrubbed() == """<a class="item"></a>""")
}
}
'renderAs - {
test("renderAs") {
val button = MenuItem(as = "a", icon = Icon(name = "comment"))
ReactTestUtils.withRenderedIntoDocument(button) { m =>
assert(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import japgolly.scalajs.react.test._

object MenuMenuTests extends TestSuite {
val tests = Tests {
'render - {
test("render") {
val menumenu = MenuMenu()
ReactTestUtils.withNewBodyElement { mountNode =>
menumenu.renderIntoDOM(mountNode)
assert(mountNode.innerHTML == """<div class="menu"></div>""")
}
}
'renderAs - {
test("renderAs") {
val menumenu = MenuMenu(as = "a")
ReactTestUtils.withNewBodyElement { mountNode =>
menumenu.renderIntoDOM(mountNode)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import japgolly.scalajs.react.test._

object MenuTests extends TestSuite {
val tests = Tests {
'render - {
test("render") {
val menu = Menu()
ReactTestUtils.withRenderedIntoDocument(menu) { m =>
assert(m.outerHtmlScrubbed() == """<div class="ui menu"></div>""")
}
}
'renderAs - {
test("renderAs") {
val menu = Menu(as = "a")
ReactTestUtils.withRenderedIntoDocument(menu) { m =>
assert(m.outerHtmlScrubbed() == """<a class="ui menu"></a>""")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import japgolly.scalajs.react.vdom.html_<^._

object ButtonContentTests extends TestSuite {
val tests = Tests {
'render - {
test("render") {
val buttonContent = ButtonContent("abc")
ReactTestUtils.withNewBodyElement { mountNode =>
buttonContent.renderIntoDOM(mountNode)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import japgolly.scalajs.react.vdom.html_<^._

object ButtonGroupTests extends TestSuite {
val tests = Tests {
'render - {
test("render") {
val buttonGroup = ButtonGroup("abc")
ReactTestUtils.withNewBodyElement { mountNode =>
buttonGroup.renderIntoDOM(mountNode)
assert(mountNode.innerHTML == """<div class="ui buttons">abc</div>""")
}
}
'buttons - {
test("buttons") {
val buttonGroup =
ButtonGroup()(Button("1"), Button("2"))
ReactTestUtils.withNewBodyElement { mountNode =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import japgolly.scalajs.react.vdom.html_<^._

object ButtonOrTests extends TestSuite {
val tests = Tests {
'render - {
test("render") {
val buttonOr = ButtonOr()("abc")
ReactTestUtils.withNewBodyElement { mountNode =>
buttonOr.renderIntoDOM(mountNode)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,109 +12,109 @@ import react.semanticui._

object ButtonTests extends TestSuite {
val tests = Tests {
'render - {
test("render") {
val button = Button()
ReactTestUtils.withRenderedIntoDocument(button) { m =>
assert(m.outerHtmlScrubbed() == """<button class="ui button"></button>""")
}
}
'renderAs - {
test("renderAs") {
val button = Button(as = "a")
ReactTestUtils.withRenderedIntoDocument(button) { m =>
assert(m.outerHtmlScrubbed() == """<a class="ui button" role="button"></a>""")
}
}
'attached - {
test("attached") {
val button = Button(attached = ButtonAttached.Top)
ReactTestUtils.withRenderedIntoDocument(button) { m =>
assert(
m.outerHtmlScrubbed() == """<div class="ui top attached button" role="button" tabindex="0"></div>"""
)
}
}
'color - {
test("color") {
val button = Button(color = Blue)
ReactTestUtils.withRenderedIntoDocument(button) { m =>
assert(m.outerHtmlScrubbed() == """<button class="ui blue button"></button>""")
}
}
'active - {
test("active") {
val button = Button(active = true)
ReactTestUtils.withRenderedIntoDocument(button) { m =>
assert(m.outerHtmlScrubbed() == """<button class="ui active button"></button>""")
}
}
'icon - {
test("icon") {
val button = Button(icon = Icon(name = "comment"))
ReactTestUtils.withRenderedIntoDocument(button) { m =>
assert(
m.outerHtmlScrubbed() == """<button class="ui icon button"><i aria-hidden="true" class="comment icon"></i></button>"""
)
}
}
'label - {
test("label") {
val button = Button(label = Label("Label"))
ReactTestUtils.withRenderedIntoDocument(button) { m =>
assert(
m.outerHtmlScrubbed() == """<div class="ui labeled button"><button class="ui button" tabindex="0"> </button><div class="ui label">Label</div></div>"""
)
}
}
'iconAndText - {
test("iconAndText") {
val button = Button()(Icon(name = "comment"), "23")
ReactTestUtils.withRenderedIntoDocument(button) { m =>
assert(
m.outerHtmlScrubbed() == """<button class="ui button"><i aria-hidden="true" class="comment icon"></i>23</button>"""
)
}
}
'toggle - {
test("toggle") {
val button = Button(toggle = true)
ReactTestUtils.withRenderedIntoDocument(button) { m =>
assert(
m.outerHtmlScrubbed() == """<button class="ui toggle button" aria-pressed="false"></button>"""
)
}
}
'tabIndex - {
test("tabIndex") {
val button = Button(tabIndex = 2)
ReactTestUtils.withRenderedIntoDocument(button) { m =>
assert(m.outerHtmlScrubbed() == """<button class="ui button" tabindex="2"></button>""")
}
}
'floated - {
test("floated") {
val button = Button(floated = floats.Right)
ReactTestUtils.withRenderedIntoDocument(button) { m =>
assert(m.outerHtmlScrubbed() == """<button class="ui right floated button"></button>""")
}
}
'circular - {
test("circular") {
val button = Button(circular = true)
ReactTestUtils.withRenderedIntoDocument(button) { m =>
assert(m.outerHtmlScrubbed() == """<button class="ui circular button"></button>""")
}
}
'secondary - {
test("secondary") {
val button = Button(secondary = true, circular = true)
ReactTestUtils.withRenderedIntoDocument(button) { m =>
assert(
m.outerHtmlScrubbed() == """<button class="ui circular secondary button"></button>"""
)
}
}
'basic - {
test("basic") {
val button = Button(basic = true)
ReactTestUtils.withRenderedIntoDocument(button) { m =>
assert(m.outerHtmlScrubbed() == """<button class="ui basic button"></button>""")
}
}
'className - {
test("className") {
val button = Button(className = "extra")
ReactTestUtils.withRenderedIntoDocument(button) { m =>
assert(m.outerHtmlScrubbed() == """<button class="ui button extra"></button>""")
}
}
'size - {
test("size") {
val button = Button(size = Big)
ReactTestUtils.withRenderedIntoDocument(button) { m =>
assert(m.outerHtmlScrubbed() == """<button class="ui big button"></button>""")
Expand Down
Loading

0 comments on commit a5ae010

Please sign in to comment.