@@ -5,15 +5,15 @@ package lucuma.react
55
66package draggable
77
8- import japgolly .scalajs .react .*
8+ import japgolly .scalajs .react .Callback
99import japgolly .scalajs .react .test .*
1010import japgolly .scalajs .react .vdom .html_<^ .*
1111import org .scalajs .dom .MouseEvent
1212import utest .*
1313
14- object DraggableTests extends TestSuite {
14+ class DraggableTests extends TestSuite {
1515 val tests = Tests {
16- " render" - {
16+ test( " render" ) {
1717 val draggable = Draggable (Draggable .props(), < .div(" Abc" ))
1818 ReactTestUtils2 .withRendered(draggable) { m =>
1919 val html =
@@ -22,7 +22,7 @@ object DraggableTests extends TestSuite {
2222 assert(m.outerHTML() == html)
2323 }
2424 }
25- " supportAllowAnyClick" - {
25+ test( " supportAllowAnyClick" ) {
2626 Draggable (Draggable .props(), < .div(" Abc" )).props.allowAnyClick.toOption ==> Some (false )
2727 val draggable =
2828 Draggable (Draggable .props(allowAnyClick = true ), < .div(" Abc" ))
@@ -34,7 +34,7 @@ object DraggableTests extends TestSuite {
3434 }
3535 draggable.props.allowAnyClick.toOption ==> Some (true )
3636 }
37- " supportAxis" - {
37+ test( " supportAxis" ) {
3838 Draggable (Draggable .props(), < .div(" Abc" )).props.axis.toOption ==> Some (" both" )
3939 val draggable = Draggable (Draggable .props(axis = Axis .X ), < .div(" Abc" ))
4040 ReactTestUtils2 .withRendered(draggable) { m =>
@@ -45,10 +45,10 @@ object DraggableTests extends TestSuite {
4545 }
4646 draggable.props.axis.toOption ==> Some (" x" )
4747 }
48- " boundsDefault" - {
48+ test( " boundsDefault" ) {
4949 Draggable (Draggable .props(), < .div(" Abc" )).props.bounds.toOption ==> Some (false )
5050 }
51- " supportBounds1" - {
51+ test( " supportBounds1" ) {
5252 val draggable =
5353 Draggable (Draggable .props(bounds = FalseBounds ), < .div(" Abc" ))
5454 ReactTestUtils2 .withRendered(draggable) { m =>
@@ -59,7 +59,7 @@ object DraggableTests extends TestSuite {
5959 }
6060 draggable.props.bounds.toOption ==> Some (false )
6161 }
62- " supportBounds2" - {
62+ test( " supportBounds2" ) {
6363 val draggable =
6464 Draggable (Draggable .props(bounds = " bounds" ), < .div(" Abc" ))
6565 ReactTestUtils2 .withRendered(draggable) { m =>
@@ -70,7 +70,7 @@ object DraggableTests extends TestSuite {
7070 }
7171 draggable.props.bounds.toOption ==> Some (" bounds" )
7272 }
73- " supportBounds3" - {
73+ test( " supportBounds3" ) {
7474 val draggable =
7575 Draggable (Draggable .props(bounds = DraggableBounds (1 , 2 , 3 , 4 )), < .div(" Abc" ))
7676 ReactTestUtils2 .withRendered(draggable) { m =>
@@ -82,7 +82,7 @@ object DraggableTests extends TestSuite {
8282 draggable.props.bounds.toOption
8383 .map(_.asInstanceOf [DraggableBounds ].left) ==> Some (1 )
8484 }
85- " supportCancel" - {
85+ test( " supportCancel" ) {
8686 Draggable (Draggable .props(), < .div(" Abc" )).props.cancel.toOption ==> None
8787 val draggable =
8888 Draggable (Draggable .props(cancel = " cancel" ), < .div(" Abc" ))
@@ -94,7 +94,7 @@ object DraggableTests extends TestSuite {
9494 }
9595 draggable.props.cancel.toOption ==> Some (" cancel" )
9696 }
97- " supportDefaultClassName" - {
97+ test( " supportDefaultClassName" ) {
9898 Draggable (Draggable .props(), < .div(" Abc" )).props.defaultClassName.toOption ==> Some (
9999 " react-draggable"
100100 )
@@ -108,7 +108,7 @@ object DraggableTests extends TestSuite {
108108 }
109109 draggable.props.defaultClassName.toOption ==> Some (" draggable" )
110110 }
111- " supportDefaultClassNameDragging" - {
111+ test( " supportDefaultClassNameDragging" ) {
112112 Draggable (Draggable .props(), < .div(" Abc" )).props.defaultClassNameDragging.toOption ==> Some (
113113 " react-draggable-dragging"
114114 )
@@ -122,7 +122,7 @@ object DraggableTests extends TestSuite {
122122 }
123123 draggable.props.defaultClassNameDragging.toOption ==> Some (" draggable" )
124124 }
125- " supportDefaultClassNameDragged" - {
125+ test( " supportDefaultClassNameDragged" ) {
126126 Draggable (Draggable .props(), < .div(" Abc" )).props.defaultClassNameDragged.toOption ==> Some (
127127 " react-draggable-dragged"
128128 )
@@ -136,7 +136,7 @@ object DraggableTests extends TestSuite {
136136 }
137137 draggable.props.defaultClassNameDragged.toOption ==> Some (" draggable" )
138138 }
139- " supportDefaultPosition" - {
139+ test( " supportDefaultPosition" ) {
140140 Draggable (Draggable .props(), < .div(" Abc" )).props.defaultPosition.toOption
141141 .map(_.x) ==> Some (0 )
142142 Draggable (Draggable .props(), < .div(" Abc" )).props.defaultPosition.toOption
@@ -152,7 +152,7 @@ object DraggableTests extends TestSuite {
152152 draggable.props.defaultPosition.toOption.map(_.x) ==> Some (1 )
153153 draggable.props.defaultPosition.toOption.map(_.y) ==> Some (2 )
154154 }
155- " supportDisabled" - {
155+ test( " supportDisabled" ) {
156156 Draggable (Draggable .props(), < .div(" Abc" )).props.disabled.toOption ==> Some (false )
157157 val draggable = Draggable (Draggable .props(disabled = true ), < .div(" Abc" ))
158158 ReactTestUtils2 .withRendered(draggable) { m =>
@@ -163,7 +163,7 @@ object DraggableTests extends TestSuite {
163163 }
164164 draggable.props.disabled.toOption ==> Some (true )
165165 }
166- " supportGrid" - {
166+ test( " supportGrid" ) {
167167 Draggable (Draggable .props(), < .div(" Abc" )).props.grid.toOption ==> None
168168 val draggable =
169169 Draggable (Draggable .props(grid = Grid (1 , 2 )), < .div(" Abc" ))
@@ -176,7 +176,7 @@ object DraggableTests extends TestSuite {
176176 draggable.props.grid.toOption.map(_.apply(0 )) ==> Some (1 )
177177 draggable.props.grid.toOption.map(_.apply(1 )) ==> Some (2 )
178178 }
179- " supportHandle" - {
179+ test( " supportHandle" ) {
180180 Draggable (Draggable .props(), < .div(" Abc" )).props.handle.toOption ==> None
181181 val draggable =
182182 Draggable (Draggable .props(handle = " handle" ), < .div(" Abc" ))
@@ -188,24 +188,24 @@ object DraggableTests extends TestSuite {
188188 }
189189 draggable.props.handle.toOption ==> Some (" handle" )
190190 }
191- " supportOffsetParent" - {
191+ test( " supportOffsetParent" ) {
192192 Draggable (Draggable .props(), < .div(" Abc" )).props.offsetParent.toOption ==> None
193193 }
194- " supportOnMouseDown" -
194+ test( " supportOnMouseDown" ) :
195195 Draggable (Draggable .props(onMouseDown = (_ : MouseEvent ) => Callback .empty), < .div(" Abc" ))
196- " supportOnStart" -
196+ test( " supportOnStart" ) :
197197 Draggable (Draggable .props(onStart = (_ : MouseEvent , _ : DraggableData ) => Callback .empty),
198198 < .div(" Abc" )
199199 )
200- " supportOnDrag" -
200+ test( " supportOnDrag" ) :
201201 Draggable (Draggable .props(onDrag = (_ : MouseEvent , _ : DraggableData ) => Callback .empty),
202202 < .div(" Abc" )
203203 )
204- " supportOnStop" -
204+ test( " supportOnStop" ) :
205205 Draggable (Draggable .props(onStop = (_ : MouseEvent , _ : DraggableData ) => Callback .empty),
206206 < .div(" Abc" )
207207 )
208- " supportPosition" - {
208+ test( " supportPosition" ) {
209209 Draggable (Draggable .props(), < .div(" Abc" )).props.position.toOption ==> None
210210 val draggable =
211211 Draggable (Draggable .props(position = ControlPosition (1 , 2 )), < .div(" Abc" ))
@@ -218,7 +218,7 @@ object DraggableTests extends TestSuite {
218218 draggable.props.position.toOption.map(_.x) ==> Some (1 )
219219 draggable.props.position.toOption.map(_.y) ==> Some (2 )
220220 }
221- " supportPositionOffset" - {
221+ test( " supportPositionOffset" ) {
222222 Draggable (Draggable .props(), < .div(" Abc" )).props.positionOffset.toOption ==> None
223223 val draggable =
224224 Draggable (Draggable .props(positionOffset = PositionOffsetControlPosition (" 10%" , " 20%" )),
0 commit comments