Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade jQuery to 3.6.4 #33

Merged
merged 7 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Static types for the jQuery API for [Scala.js](http://www.scala-js.org/) program
Add the following dependency to your SBT build:

```scala
libraryDependencies += "io.udash" %%% "udash-jquery" % "3.0.4"
libraryDependencies += "io.udash" %%% "udash-jquery" % "3.2.0"
```

then import the jQuery package:
Expand Down
7 changes: 4 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ val commonJSSettings = Seq(
val githubDir = "https://raw.githubusercontent.com/UdashFramework/scala-js-jquery"
s"-P:scalajs:mapSourceURI:$localDir->$githubDir/v${version.value}/"
},
webpack / version := "5.75.0", // TODO: can be removed when sbt-scalajs-bundler > 0.21.1
)

val deploymentConfiguration = Seq(
Expand Down Expand Up @@ -80,11 +81,11 @@ lazy val root = project.in(file("."))
deploymentConfiguration,

libraryDependencies ++= Seq(
"org.scala-js" %%% "scalajs-dom" % "2.0.0",
"org.scala-js" %%% "scalajs-dom" % "2.7.0",
"org.scalatest" %%% "scalatest" % "3.2.9" % Test,
"com.lihaoyi" %%% "scalatags" % "0.10.0" % Test
),

Compile / npmDependencies += "jquery" -> "3.4.1",
jsDependencies += "org.webjars" % "jquery" % "3.4.1" / "3.4.1/jquery.js" minified s"3.4.1/jquery.min.js",
Compile / npmDependencies += "jquery" -> "3.6.4",
jsDependencies += "org.webjars" % "jquery" % "3.6.4" / "3.6.4/jquery.js" minified s"3.6.4/jquery.min.js",
)
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# suppress inspection "UnusedProperty"
sbt.version=1.5.5
sbt.version=1.9.2
4 changes: 2 additions & 2 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
logLevel := Level.Warn

addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.7.0")
addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.20.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.13.2")
addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.21.1")
addSbtPlugin("org.scala-js" % "sbt-jsdependencies" % "1.0.2")

// Deployment configuration
Expand Down
8 changes: 8 additions & 0 deletions src/main/scala/io/udash/wrappers/jquery/JQuery.scala
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ trait JQuery extends js.Object {
@JSName("eq")
def at(index: Int): JQuery = js.native

/** Reduce the set of matched elements to the even ones in the set, numbered from zero. <br/>
* See: <a href="http://api.jquery.com/even/">jQuery Docs</a> */
def even(): JQuery = js.native

/** Display the matched elements by fading them to opaque. <br/>
* See: <a href="http://api.jquery.com/fadeIn/">jQuery Docs</a> */
def fadeIn(duration: Int = js.native, easing: EasingFunction = js.native): JQuery = js.native
Expand Down Expand Up @@ -381,6 +385,10 @@ trait JQuery extends js.Object {
* See: <a href="http://api.jquery.com/not/">jQuery Docs</a> */
def not(el: Element*): JQuery = js.native

/** Reduce the set of matched elements to the odd ones in the set, numbered from zero. <br/>
* See: <a href="http://api.jquery.com/odd/">jQuery Docs</a> */
def odd(): JQuery = js.native
halotukozak marked this conversation as resolved.
Show resolved Hide resolved

/** Remove an event handler. <br/>
* See: <a href="http://api.jquery.com/off/">jQuery Docs</a> */
def off(): JQuery = js.native
Expand Down
28 changes: 28 additions & 0 deletions src/test/scala/io/udash/wrappers/jquery_test/TraversingTest.scala
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
package io.udash.wrappers.jquery_test

import org.scalajs.dom.HTMLSpanElement
halotukozak marked this conversation as resolved.
Show resolved Hide resolved
import org.scalatest.matchers.should.Matchers
import org.scalatest.wordspec.AnyWordSpec

import scala.scalajs.js
import scala.scalajs.js.Object.entries

class TraversingTest extends AnyWordSpec with Matchers {

import io.udash.wrappers.jquery._
Expand Down Expand Up @@ -166,5 +170,29 @@ class TraversingTest extends AnyWordSpec with Matchers {
root.children("a").first().length should be(0)
root.children("a").last().length should be(0)
}

"even/odd matching element" in {
val dom = div(
span("0"),
span("1"),
span("2"),
span("3"),
span("4"),
span("5"),
).render

val root = jQ(dom)
val evens = root.children("span").even()
val odds = root.children("span").odd()

entries(evens).collect {
case js.Tuple2(_: String, x: HTMLSpanElement) => x.textContent
}.toSeq shouldBe Seq("0", "2", "4")

entries(odds).collect {
case js.Tuple2(_: String, x: HTMLSpanElement) => x.textContent
}.toSeq shouldBe Seq("1", "3", "5")

halotukozak marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
Loading