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
fcfcc51b
Commit
fcfcc51b
authored
Nov 27, 2014
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Graph editor: test for removing a node
parent
406840df
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
11 deletions
+41
-11
dream/platform/src/jsplumb/test.js
dream/platform/src/jsplumb/test.js
+41
-11
No files found.
dream/platform/src/jsplumb/test.js
View file @
fcfcc51b
...
@@ -385,18 +385,48 @@
...
@@ -385,18 +385,48 @@
function
runTest
()
{
function
runTest
()
{
return
jsplumb_gadget
.
getContent
().
then
(
function
()
{
return
jsplumb_gadget
.
getContent
().
then
(
function
()
{
$
(
"
div[title='Node 1']
"
).
simulate
(
"
dblclick
"
);
equal
(
1
,
$
(
"
div[title='Node 1']
"
).
length
,
"
node 1 is visible
"
);
equal
(
1
,
$
(
"
._jsPlumb_connector
"
).
length
,
"
there is one connection
"
);
// XXX popup not displayed
$
(
"
input[value='Delete']
"
).
click
();
// click on node 1 to see display the popup
})
$
(
"
div[title='Node 1']
"
).
simulate
(
"
dblclick
"
);
.
then
(
function
()
{
return
jsplumb_gadget
.
getContent
();
// Promises that handle the dialog actions are not available
})
// immediately after clicking.
.
then
(
function
(
content
)
{
var
promise
=
RSVP
.
Promise
(
function
(
resolve
)
{
var
graph
=
JSON
.
parse
(
content
).
graph
;
var
waitForDialogAndDelete
=
function
()
{
equal
(
1
,
Object
.
keys
(
graph
.
node
).
length
);
if
(
!
jsplumb_gadget
.
props
.
dialog_promise
)
{
// Dialog not ready. Let's retry later.
// XXX this condition is actually incorrect. We need to wait
// for the event listener to have been registered for the
// dialog buttons. This setTimeout is good enough for now.
return
setTimeout
(
waitForDialogAndDelete
,
1000
);
}
$
(
"
input[value='Delete']
"
).
click
();
// resolve our test promise once the dialog handling promise is
// finished.
jsplumb_gadget
.
props
.
dialog_promise
.
then
(
resolve
);
};
waitForDialogAndDelete
();
}
);
return
promise
.
then
(
function
()
{
return
jsplumb_gadget
.
getContent
().
then
(
function
(
content
)
{
var
graph
=
JSON
.
parse
(
content
).
graph
;
equal
(
1
,
Object
.
keys
(
graph
.
node
).
length
,
"
node is removed from data
"
);
equal
(
0
,
Object
.
keys
(
graph
.
edge
).
length
,
"
edge referencing this node is also removed
"
);
equal
(
0
,
$
(
"
div[title='Node 1']
"
).
length
,
"
DOM element for node is removed
"
);
equal
(
0
,
$
(
"
._jsPlumb_connector
"
).
length
,
"
DOM element for edge is removed
"
);
});
});
});
});
}
}
g
.
declareGadget
(
"
./index.html
"
,
{
g
.
declareGadget
(
"
./index.html
"
,
{
...
...
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