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
Changes from 1 commit
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
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