Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
dream
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
dream
Commits
06f8842e
Commit
06f8842e
authored
Nov 25, 2014
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test for drag & drop
parent
e0f254a5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
45 deletions
+52
-45
dream/platform/src/jsplumb/test.js
dream/platform/src/jsplumb/test.js
+52
-45
No files found.
dream/platform/src/jsplumb/test.js
View file @
06f8842e
...
...
@@ -114,15 +114,18 @@
}
},
sample_data_graph
=
JSON
.
stringify
(
{
class_definition
:
sample_class_definition
,
graph
:
sample_graph
}),
{
class_definition
:
sample_class_definition
,
graph
:
sample_graph
}
),
sample_data_empty_graph
=
JSON
.
stringify
(
{
class_definition
:
sample_class_definition
,
graph
:
{
node
:
{},
edge
:
{}}
});
{
class_definition
:
sample_class_definition
,
graph
:
{
node
:
{},
edge
:
{}}
}
);
QUnit
.
config
.
testTimeout
=
5000
;
rJS
(
window
).
ready
(
function
(
g
)
{
test
(
"
Sample graph can be loaded and output is equal to input
"
,
function
()
{
test
(
"
Sample graph can be loaded and output is equal to input
"
,
function
()
{
var
jsplumb_gadget
;
stop
();
g
.
declareGadget
(
"
./index.html
"
,
{
...
...
@@ -145,30 +148,19 @@
test
(
"
New node can be drag & dropped
"
,
function
()
{
var
jsplumb_gadget
;
stop
();
g
.
declareGadget
(
"
./index.html
"
,
{
element
:
document
.
querySelector
(
"
#qunit-fixture
"
)
})
.
then
(
function
(
new_gadget
)
{
jsplumb_gadget
=
new_gadget
;
return
jsplumb_gadget
.
render
(
sample_data_empty_graph
);
})
/* XXX if we start service then we wait for ever
.then(function () {
return jsplumb_gadget.startService();
}) */
.
then
(
function
()
{
function
runTest
()
{
return
jsplumb_gadget
.
getContent
().
then
(
function
()
{
// fake a drop event
var
event
=
new
CustomEvent
(
'
drop
'
,{
stopPropagation
:
function
()
{
return
;},
dataTransfer
:{
var
e
=
new
Event
(
'
drop
'
);
e
.
dataTransfer
=
{
getData
:
function
(
type
){
// make sure we are called properly
equal
(
type
,
'
application/json
'
);
return
'
Example.Node
'
;
return
JSON
.
stringify
(
"
Example.Node
"
)
;
}
}
});
jsplumb_gadget
.
props
.
element
.
dispatchEvent
(
event
);
};
jsplumb_gadget
.
props
.
main
.
dispatchEvent
(
e
);
})
.
then
(
function
()
{
return
jsplumb_gadget
.
getContent
();
...
...
@@ -178,6 +170,21 @@
equal
(
1
,
Object
.
keys
(
graph
.
node
).
length
);
node
=
graph
.
node
[
Object
.
keys
(
graph
.
node
)[
0
]];
equal
(
'
Example.Node
'
,
node
.
_class
);
});
}
g
.
declareGadget
(
"
./index.html
"
,
{
element
:
document
.
querySelector
(
"
#qunit-fixture
"
)
})
.
then
(
function
(
new_gadget
)
{
jsplumb_gadget
=
new_gadget
;
jsplumb_gadget
.
render
(
sample_data_empty_graph
);
})
.
then
(
function
()
{
return
RSVP
.
any
([
jsplumb_gadget
.
startService
(),
runTest
()
]);
})
.
fail
(
console
.
error
.
bind
(
this
))
.
always
(
start
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment