11/** @jsx React.DOM */
2- var React = require ( 'react/addons' ) ,
3- TestUtils = React . addons . TestUtils ,
4- Draggable = require ( '../lib/main' ) ;
2+ var React = require ( 'react/addons' ) ;
3+ var TestUtils = React . addons . TestUtils ;
4+ var Draggable = require ( '../lib/main' ) ;
55
66describe ( 'react-draggable' , function ( ) {
77 describe ( 'props' , function ( ) {
@@ -23,49 +23,51 @@ describe('react-draggable', function () {
2323 function handleStop ( ) { }
2424
2525 var drag = TestUtils . renderIntoDocument (
26- < Draggable
27- axis = "y"
28- handle = ".handle"
29- cancel = ".cancel"
30- zIndex = { 1000 }
31- onStart = { handleStart }
32- onDrag = { handleDrag }
33- onStop = { handleStop } >
34- < div >
35- < div className = "handle" />
36- < div className = "cancel" />
37- </ div >
38- </ Draggable >
39- ) ;
26+ < Draggable
27+ axis = "y"
28+ handle = ".handle"
29+ cancel = ".cancel"
30+ grid = { [ 10 , 10 ] }
31+ zIndex = { 1000 }
32+ onStart = { handleStart }
33+ onDrag = { handleDrag }
34+ onStop = { handleStop } >
35+ < div >
36+ < div className = "handle" />
37+ < div className = "cancel" />
38+ </ div >
39+ </ Draggable >
40+ ) ;
4041
4142 expect ( drag . props . axis ) . toEqual ( 'y' ) ;
4243 expect ( drag . props . handle ) . toEqual ( '.handle' ) ;
4344 expect ( drag . props . cancel ) . toEqual ( '.cancel' ) ;
45+ expect ( drag . props . grid ) . toEqual ( [ 10 , 10 ] ) ;
4446 expect ( drag . props . zIndex ) . toEqual ( 1000 ) ;
4547 expect ( drag . props . onStart ) . toEqual ( handleStart ) ;
4648 expect ( drag . props . onDrag ) . toEqual ( handleDrag ) ;
4749 expect ( drag . props . onStop ) . toEqual ( handleStop ) ;
4850 } ) ;
4951
5052 it ( 'should call onStart when dragging begins' , function ( ) {
51- var called = false ,
52- drag = TestUtils . renderIntoDocument (
53- < Draggable onStart = { function ( ) { called = true ; } } >
54- < div />
55- </ Draggable >
56- ) ;
53+ var called = false ;
54+ var drag = TestUtils . renderIntoDocument (
55+ < Draggable onStart = { function ( ) { called = true ; } } >
56+ < div />
57+ </ Draggable >
58+ ) ;
5759
5860 TestUtils . Simulate . mouseDown ( drag . getDOMNode ( ) ) ;
5961 expect ( called ) . toEqual ( true ) ;
6062 } ) ;
6163
6264 it ( 'should call onStop when dragging ends' , function ( ) {
63- var called = false ,
64- drag = TestUtils . renderIntoDocument (
65- < Draggable onStop = { function ( ) { called = true ; } } >
66- < div />
67- </ Draggable >
68- ) ;
65+ var called = false ;
66+ var drag = TestUtils . renderIntoDocument (
67+ < Draggable onStop = { function ( ) { called = true ; } } >
68+ < div />
69+ </ Draggable >
70+ ) ;
6971
7072 TestUtils . Simulate . mouseDown ( drag . getDOMNode ( ) ) ;
7173 TestUtils . Simulate . mouseUp ( drag . getDOMNode ( ) ) ;
@@ -83,13 +85,13 @@ describe('react-draggable', function () {
8385
8486 it ( 'should only initialize dragging onmousedown of handle' , function ( ) {
8587 var drag = TestUtils . renderIntoDocument (
86- < Draggable handle = ".handle" >
87- < div >
88- < div className = "handle" > Handle</ div >
89- < div className = "content" > Lorem ipsum...</ div >
90- </ div >
91- </ Draggable >
92- ) ;
88+ < Draggable handle = ".handle" >
89+ < div >
90+ < div className = "handle" > Handle</ div >
91+ < div className = "content" > Lorem ipsum...</ div >
92+ </ div >
93+ </ Draggable >
94+ ) ;
9395
9496 TestUtils . Simulate . mouseDown ( drag . getDOMNode ( ) . querySelector ( '.content' ) ) ;
9597 expect ( drag . state . dragging ) . toEqual ( false ) ;
@@ -100,13 +102,13 @@ describe('react-draggable', function () {
100102
101103 it ( 'should not initialize dragging onmousedown of cancel' , function ( ) {
102104 var drag = TestUtils . renderIntoDocument (
103- < Draggable cancel = ".cancel" >
104- < div >
105- < div className = "cancel" > Cancel</ div >
106- < div className = "content" > Lorem ipsum...</ div >
107- </ div >
108- </ Draggable >
109- ) ;
105+ < Draggable cancel = ".cancel" >
106+ < div >
107+ < div className = "cancel" > Cancel</ div >
108+ < div className = "content" > Lorem ipsum...</ div >
109+ </ div >
110+ </ Draggable >
111+ ) ;
110112
111113 TestUtils . Simulate . mouseDown ( drag . getDOMNode ( ) . querySelector ( '.cancel' ) ) ;
112114 expect ( drag . state . dragging ) . toEqual ( false ) ;
0 commit comments