File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
test/src/main/scala/japgolly/scalajs/react/test Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change 44* Changed overloaded ` classSet ` methods into ` classSet{,1}{,M} ` .
55* Added ` simulateKeyDownUp ` and ` simulateKeyDownPressUp ` to ` KeyboardEventData ` in the test module.
66* In rare circumstances, ` Simulation.run ` targets can go out of date. Targets are now stored by-name.
7+ * Added ` Sel.findFirstIn ` .
78
89# 0.6.0 ([ commit log] ( https://github.com/japgolly/scalajs-react/compare/v0.5.4...v0.6.0 ) )
910
Original file line number Diff line number Diff line change @@ -32,6 +32,14 @@ sealed abstract class Sel {
3232 case ∅ => Array ()
3333 }
3434
35+ final def findFirstIn (i : ComponentM ): ComponentM = {
36+ val a = findAllIn(i)
37+ if (a.isEmpty)
38+ sys.error(s " DOM not found for [ $this] " )
39+ else
40+ a.head
41+ }
42+
3543 final def findInE (i : ComponentM ): Either [String , ComponentM ] = {
3644 val a = findAllIn(i)
3745 a.length match {
@@ -78,7 +86,6 @@ object Sel {
7886 def apply (css : String ): Sel = {
7987 def lvl (s : String ): Sel =
8088 (id /: s.split(" (?=\\ .)" ).filter(_.nonEmpty))((q,a) => q & elem(a))
81- // .filter here ↗ due to https://github.com/scala-js/scala-js/issues/1171
8289 def elem (s : String ): Sel =
8390 if (s.isEmpty) ∅
8491 else if (s == " *" ) id
You can’t perform that action at this time.
0 commit comments