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
e56a82f6
Commit
e56a82f6
authored
Nov 27, 2014
by
Jérome Perrin
Committed by
Ioannis Papagiannopoulos
Dec 18, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
graph editor: test for dialog edition
parent
f5ecf8ad
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
17 deletions
+50
-17
dream/platform/src/jsplumb/jsplumb.js
dream/platform/src/jsplumb/jsplumb.js
+5
-1
dream/platform/src/jsplumb/test.js
dream/platform/src/jsplumb/test.js
+45
-16
No files found.
dream/platform/src/jsplumb/jsplumb.js
View file @
e56a82f6
...
...
@@ -528,13 +528,17 @@
return
fieldset_gadget
[
0
];
})
.
push
(
function
(
fieldset_gadget
)
{
return
RSVP
.
any
([
// Expose the dialog handling promise so that we can wait for it in
// test.
gadget
.
props
.
dialog_promise
=
RSVP
.
any
([
save_promise
(
fieldset_gadget
,
node_id
),
delete_promise
]);
return
gadget
.
props
.
dialog_promise
;
})
.
push
(
function
()
{
node_edit_popup
.
popup
(
'
close
'
);
delete
gadget
.
props
.
dialog_promise
;
});
}
...
...
dream/platform/src/jsplumb/test.js
View file @
e56a82f6
/*global rJS, JSON, QUnit, jQuery, RSVP, console*/
/*global rJS, JSON, QUnit, jQuery, RSVP, console
, setTimeout
*/
(
function
(
rJS
,
JSON
,
QUnit
,
RSVP
,
$
)
{
"
use strict
"
;
...
...
@@ -262,20 +262,49 @@
stop
();
function
runTest
()
{
return
jsplumb_gadget
.
getContent
().
then
(
function
()
{
$
(
"
div[title='Node 1']
"
).
simulate
(
"
dblclick
"
);
return
jsplumb_gadget
.
getContent
().
then
(
function
()
{
// click on a node to see display the popup
$
(
"
div[title='Node 1']
"
).
simulate
(
'
dblclick
'
);
// XXX popup not displayed
// Promises that handle the dialog actions are not available
// immediately after clicking.
var
promise
=
RSVP
.
Promise
(
function
(
resolve
)
{
var
fillDialog
=
function
()
{
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
(
fillDialog
,
1000
);
}
// check displayed values
equal
(
$
(
"
input[name='id']
"
).
val
(),
"
N1
"
);
equal
(
$
(
"
input[name='name']
"
).
val
(),
"
Node 1
"
);
equal
(
$
(
"
input[name='shape']
"
).
val
(),
"
square
"
);
// change the name
$
(
"
input[name='name']
"
).
val
(
"
Modified Name
"
);
// and save
$
(
"
input[value='Validate']
"
).
click
();
})
.
then
(
function
()
{
return
jsplumb_gadget
.
getContent
();
})
.
then
(
function
(
content
)
{
// resolve our test promise once the dialog handling promise is
// finished.
jsplumb_gadget
.
props
.
dialog_promise
.
then
(
resolve
);
};
fillDialog
();
}
);
return
promise
.
then
(
function
()
{
return
jsplumb_gadget
.
getContent
().
then
(
function
(
content
)
{
var
graph
=
JSON
.
parse
(
content
).
graph
,
node
=
graph
.
node
.
N1
;
equal
(
node
.
name
,
"
Modified Name
"
);
// check the data is well modified.
equal
(
"
Modified Name
"
,
node
.
name
);
});
});
});
}
...
...
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