Skip to content

Commit

Permalink
Merge pull request #1200 from UdashFramework/scala-2.13.13
Browse files Browse the repository at this point in the history
Scala 2.13.13
  • Loading branch information
sebaciv committed Mar 5, 2024
2 parents d1fe4a8 + 6eed6f0 commit 7f63901
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 52 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
fail-fast: false
matrix:
scala: [ 2.13.12 ]
scala: [ 2.13.13 ]
command: [ udash-jvm/test, udash-js/test, guide-selenium/test ]
steps:
- uses: actions/checkout@v3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ object UdashBootstrap {
final val True: ReadableProperty[Boolean] = true.toProperty
final val ColorSecondary: ReadableProperty[BootstrapStyles.Color] = BootstrapStyles.Color.Secondary.toProperty
private final val NoneProperty = scala.None.toProperty
def None[A]: ReadableProperty[Option[A]] = NoneProperty.asInstanceOf[ReadableProperty[Option[A]]]
def None[A]: ReadableProperty[Option[A]] = NoneProperty

/** Loads FontAwesome styles. */
def loadFontAwesome(): Element =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,13 @@ class UdashCarouselTest extends AsyncUdashCoreFrontendTest {
var changedEvent: CarouselEvent[UdashCarouselSlide, ReadableProperty[UdashCarouselSlide]] = null
carousel.listen {
case ev@CarouselEvent(_, _, _, false) =>
changeEvent = ev.asInstanceOf[CarouselEvent[UdashCarouselSlide, ReadableProperty[UdashCarouselSlide]]]
changeEvent = ev
case ev@CarouselEvent(_, _, _, true) =>
changedEvent = ev.asInstanceOf[CarouselEvent[UdashCarouselSlide, ReadableProperty[UdashCarouselSlide]]]
changedEvent = ev
}
carousel.goTo(5)
retrying(changeEvent shouldBe CarouselEvent(carousel, 5, CarouselEvent.Direction.Left, false))
retrying(changedEvent shouldBe CarouselEvent(carousel, 5, CarouselEvent.Direction.Left, true))
retrying(changeEvent shouldBe CarouselEvent(carousel, 5, CarouselEvent.Direction.Left, changed = false))
retrying(changedEvent shouldBe CarouselEvent(carousel, 5, CarouselEvent.Direction.Left, changed = true))
retrying(carousel.activeSlide.get shouldBe 5)
}

Expand Down
10 changes: 5 additions & 5 deletions core/.js/src/test/scala/io/udash/bindings/TagsBindingTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1686,11 +1686,11 @@ class TagsBindingTest extends UdashFrontendTest with Bindings { bindings: Bindin
done.listenStructure(p => patches += p)

todos.set(Seq(
Todo("A", false),
Todo("B", false),
Todo("C", false),
Todo("D", false),
Todo("E", false)
Todo("A", completed = false),
Todo("B", completed = false),
Todo("C", completed = false),
Todo("D", completed = false),
Todo("E", completed = false),
))

patches.size should be(0)
Expand Down
10 changes: 5 additions & 5 deletions core/src/test/scala/io/udash/properties/SeqPropertyTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -706,11 +706,11 @@ class SeqPropertyTest extends UdashCoreTest {
filtered.listen(_ => ())

val s = Seq(
D("A", false),
D("B", false),
D("C", false),
D("D", false),
D("E", false)
D("A", b = false),
D("B", b = false),
D("C", b = false),
D("D", b = false),
D("E", b = false),
)

ts.set(s)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,16 @@ import io.udash._
import io.udash.auth.{UnauthenticatedException, UnauthorizedException}
import io.udash.bootstrap.utils.BootstrapStyles
import io.udash.css.CssView
import io.udash.web.commons.components.{CodeBlock, ForceBootstrap}
import io.udash.utils.URLEncoder
import io.udash.web.commons.components.ForceBootstrap
import io.udash.web.commons.styles.GlobalStyles
import io.udash.web.guide._
import io.udash.web.guide.demos.AutoDemo
import io.udash.web.guide.styles.partials.GuideStyles
import io.udash.web.guide.views.References
import io.udash.web.guide.{Context, _}
import org.scalajs.dom
import scalatags.JsDom

import scala.scalajs.js

case object FrontendRoutingViewFactory extends ViewFactory[FrontendRoutingState] {
override def create(): (View, Presenter[FrontendRoutingState]) = {
val url = Property.blank[String]
Expand All @@ -23,13 +22,16 @@ case object FrontendRoutingViewFactory extends ViewFactory[FrontendRoutingState]
}

class FrontendRoutingPresenter(url: Property[String]) extends Presenter[FrontendRoutingState] {

import Context.applicationInstance

override def handleState(state: FrontendRoutingState) = {
url.set(applicationInstance.currentUrl.value)
}
}

class FrontendRoutingView(url: Property[String]) extends View with CssView {

import Context._
import JsDom.all._
import com.avsystem.commons.SharedExtensions.universalOps
Expand Down Expand Up @@ -219,14 +221,12 @@ class FrontendRoutingView(url: Property[String]) extends View with CssView {
size = BootstrapStyles.SpacingSize.Normal
))(input(
BootstrapStyles.Form.control, id := "url-demo-link-input", value := "",
placeholder := "Type something in this field and look at the URL...", onkeyup :+= ((event: dom.Event) => {
placeholder := "Type something in this field and look at the URL...", onkeyup :+= { (event: dom.Event) =>
applicationInstance.goTo(FrontendRoutingState(
Some(js.Dynamic.global
.encodeURIComponent(event.target.asInstanceOf[dom.html.Input].value)
.asInstanceOf[String])
Some(URLEncoder.encode(event.target.asInstanceOf[dom.html.Input].value, spaceAsPlus = false))
))
true
})
}
)),
p("This view was created with: ", span(id := "url-demo-link-init")(applicationInstance.currentUrl.value))
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ final class DemoComponent(implicit application: Application[RoutingState]) exten
)
}.toSeq
),
produce(application.currentStateProperty) { state =>
state.opt.collect { case state: IndexState => code(state.codeDemo).setup(Prism.highlightAllUnder) }.getOrElse[Element](div().render)
produce(application.currentStateProperty) {
case state: IndexState => code(state.codeDemo).setup(Prism.highlightAllUnder)
case _ => div().render
}
)
).render
}
}
4 changes: 2 additions & 2 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import sbt.*
import sbt.Keys.scalaVersion

object Dependencies {
val versionOfScala = "2.13.12" //update .github/workflows/ci.yml as well
val versionOfScala = "2.13.13" //update .github/workflows/ci.yml as well

val jqueryWrapperVersion = "3.3.0"

Expand All @@ -14,7 +14,7 @@ object Dependencies {
val scalaCssVersion = "1.0.0"

val servletVersion = "4.0.1"
val avsCommonsVersion = "2.13.3"
val avsCommonsVersion = "2.14.0"

val atmosphereJSVersion = "3.1.3"
val atmosphereVersion = "2.7.10"
Expand Down
4 changes: 2 additions & 2 deletions rest/src/main/scala/io/udash/rest/openapi/OpenApi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ final case class Schema(
@td uniqueItems: Boolean = false,

@td properties: Map[String, RefOr[Schema]] = Map.empty,
@td additionalProperties: AdditionalProperties = AdditionalProperties.Flag(true),
@td additionalProperties: AdditionalProperties = AdditionalProperties.Flag(value = true),
@td maxProperties: OptArg[Int] = OptArg.Empty,
@td minProperties: OptArg[Int] = OptArg.Empty,
@td required: List[String] = Nil,
Expand Down Expand Up @@ -295,7 +295,7 @@ object Schema extends HasGenObjectCodec[Schema] {
def enumMapOf(keys: List[String], value: RefOr[Schema]): Schema =
Schema(`type` = DataType.Object,
properties = keys.iterator.map(k => (k, value)).toMap,
additionalProperties = AdditionalProperties.Flag(false)
additionalProperties = AdditionalProperties.Flag(value = false)
)

def nullable(schema: RefOr[Schema]): Schema = schema match {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ final case class OpenApiParamInfo[T](

@bincompat private[rest] def this(
name: String, whenAbsentInfo: Opt[WhenAbsentInfo[T]], flags: ParamFlags, restSchema: RestSchema[T]
) = this(name, whenAbsentInfo, false, flags, restSchema)
) = this(name, whenAbsentInfo, optional = false, flags, restSchema)
}

final case class OpenApiParameter[T](
Expand Down
20 changes: 3 additions & 17 deletions rpc/src/test/scala/io/udash/rpc/RpcMessagesTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -74,20 +74,6 @@ trait RpcMessagesTestScenarios extends UdashSharedTest with Utils {
deserialized3 should be(sealedException)
}

// "serialize and deserialize exception stacktrace" in {
// val serialized = write[RpcResponse](exception)
// val deserialized = read[RpcResponse](serialized)
// deserialized.asInstanceOf[RpcResponseException].exception.getStackTrace should be(exception.exception.getStackTrace)
//
// val serialized2 = write[RpcResponse](runtimeException)
// val deserialized2 = read[RpcResponse](serialized2)
// deserialized2.asInstanceOf[RpcResponseException].exception.getStackTrace should be(runtimeException.exception.getStackTrace)
//
// val serialized3 = write[RpcResponse](sealedException)
// val deserialized3 = read[RpcResponse](serialized3)
// deserialized3.asInstanceOf[RpcResponseException].exception.getStackTrace should be(sealedException.exception.getStackTrace)
// }

"serialize and deserialize rpc failure msg" in {
val serialized = write[RpcFailure](rpcFail)
val deserialized = read[RpcFailure](serialized)
Expand Down Expand Up @@ -120,16 +106,16 @@ trait RpcMessagesTestScenarios extends UdashSharedTest with Utils {
}

"serialize and deserialize simple case classes" in {
val test: TestCC = TestCC(5, 123L, 432, true, "bla", 'a' :: 'b' :: Nil)
val test: TestCC = TestCC(5, 123L, 432, b = true, "bla", 'a' :: 'b' :: Nil)
val serialized = write[TestCC](test)
val deserialized = read[TestCC](serialized)

deserialized should be(test)
}

"serialize and deserialize nested case classes" in {
val test: TestCC = TestCC(5, 123L, 432, true, "bla", 'a' :: 'b' :: Nil)
val test2: TestCC = TestCC(-35, 1L, 432, true, "blsddf sdg \"{,}[,]\"a", 'a' :: 'b' :: Nil)
val test: TestCC = TestCC(5, 123L, 432, b = true, "bla", 'a' :: 'b' :: Nil)
val test2: TestCC = TestCC(-35, 1L, 432, b = true, "blsddf sdg \"{,}[,]\"a", 'a' :: 'b' :: Nil)
val nested: NestedTestCC = NestedTestCC(-123, test, test2)
val serialized = write(nested)
val deserialized = read[NestedTestCC](serialized)
Expand Down
4 changes: 2 additions & 2 deletions utils/.js/src/main/scala/io/udash/logging/UdashLogger.scala
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package io.udash.logging

import org.scalajs.dom
import org.scalajs.dom.Console

import scala.scalajs.js
import scala.scalajs.js.Dynamic.global

class UdashLogger(clazz: Class[_]) extends CrossLogger {
private val console: Console = global.console.asInstanceOf[Console]
private val console: Console = dom.console

private def printWithParams(method: (js.Any, Seq[js.Any]) => Unit)(message: String, params: Any*): Unit =
method(message, params.map(_.asInstanceOf[js.Any]))
Expand Down

0 comments on commit 7f63901

Please sign in to comment.