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
3521ac6f
Commit
3521ac6f
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
Use qunit like it is supposed to be used
parent
e0dd40f9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
15 deletions
+17
-15
dream/platform/src/jsplumb/test.js
dream/platform/src/jsplumb/test.js
+17
-15
No files found.
dream/platform/src/jsplumb/test.js
View file @
3521ac6f
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
test
=
QUnit
.
test
,
test
=
QUnit
.
test
,
equal
=
QUnit
.
equal
,
equal
=
QUnit
.
equal
,
ok
=
QUnit
.
ok
,
ok
=
QUnit
.
ok
,
error_handler
=
function
(
e
)
{
console
.
error
(
e
);
ok
(
false
,
e
);
},
sample_class_definition
=
{
sample_class_definition
=
{
"
edge
"
:
{
"
edge
"
:
{
"
description
"
:
"
Base definition for edge
"
,
"
description
"
:
"
Base definition for edge
"
,
...
@@ -166,7 +167,7 @@
...
@@ -166,7 +167,7 @@
.
then
(
function
(
content
)
{
.
then
(
function
(
content
)
{
equal
(
content
,
sample_data_graph
);
equal
(
content
,
sample_data_graph
);
})
})
.
fail
(
console
.
error
.
bind
(
this
)
)
.
fail
(
error_handler
)
.
always
(
start
);
.
always
(
start
);
});
});
...
@@ -183,7 +184,8 @@
...
@@ -183,7 +184,8 @@
e
.
dataTransfer
=
{
e
.
dataTransfer
=
{
getData
:
function
(
type
){
getData
:
function
(
type
){
// make sure we are called properly
// make sure we are called properly
equal
(
type
,
'
application/json
'
);
equal
(
'
application/json
'
,
type
,
"
The drag&dropped element must have data type application/json
"
);
return
JSON
.
stringify
(
"
Example.Node
"
);
return
JSON
.
stringify
(
"
Example.Node
"
);
}
}
};
};
...
@@ -213,7 +215,7 @@
...
@@ -213,7 +215,7 @@
runTest
()
runTest
()
]);
]);
})
})
.
fail
(
console
.
error
.
bind
(
this
)
)
.
fail
(
error_handler
)
.
always
(
start
);
.
always
(
start
);
});
});
...
@@ -253,7 +255,7 @@
...
@@ -253,7 +255,7 @@
runTest
()
runTest
()
]);
]);
})
})
.
fail
(
console
.
error
.
bind
(
this
)
)
.
fail
(
error_handler
)
.
always
(
start
);
.
always
(
start
);
});
});
...
@@ -321,7 +323,7 @@
...
@@ -321,7 +323,7 @@
runTest
()
runTest
()
]);
]);
})
})
.
fail
(
console
.
error
.
bind
(
this
)
)
.
fail
(
error_handler
)
.
always
(
start
);
.
always
(
start
);
});
});
...
@@ -338,8 +340,8 @@
...
@@ -338,8 +340,8 @@
"
div[title='Node 2']
"
"
div[title='Node 2']
"
);
);
// At this point we have no edge
equal
(
0
,
Object
.
keys
(
JSON
.
parse
(
content
).
graph
.
edge
).
length
,
equal
(
Object
.
keys
(
JSON
.
parse
(
content
).
graph
.
edge
).
length
,
0
);
"
There are no edge at the beginning
"
);
jsplumb_gadget
.
props
.
jsplumb_instance
.
connect
(
jsplumb_gadget
.
props
.
jsplumb_instance
.
connect
(
{
source
:
node1
.
id
,
target
:
node2
.
id
}
{
source
:
node1
.
id
,
target
:
node2
.
id
}
...
@@ -351,14 +353,14 @@
...
@@ -351,14 +353,14 @@
})
})
.
then
(
function
(
content
)
{
.
then
(
function
(
content
)
{
var
edge
,
graph
=
JSON
.
parse
(
content
).
graph
;
var
edge
,
graph
=
JSON
.
parse
(
content
).
graph
;
equal
(
Object
.
keys
(
graph
.
node
).
length
,
2
);
equal
(
2
,
Object
.
keys
(
graph
.
node
).
length
,
"
We still have 2 nodes
"
);
equal
(
Object
.
keys
(
graph
.
edge
).
length
,
1
);
equal
(
1
,
Object
.
keys
(
graph
.
edge
).
length
,
"
We have 1 edge
"
);
edge
=
graph
.
edge
[
Object
.
keys
(
graph
.
edge
)[
0
]];
edge
=
graph
.
edge
[
Object
.
keys
(
graph
.
edge
)[
0
]];
// XXX how edge class would be set ? the first one from schema ?
// XXX how edge class would be set ? the first one from schema ?
//equal(
edge._class, "Example.Edge
");
//equal(
"Example.Edge", edge._class, "Edge class is correct
");
equal
(
edge
.
source
,
"
N1
"
);
equal
(
"
N1
"
,
edge
.
source
,
"
edge source is correct
"
);
equal
(
edge
.
destination
,
"
N2
"
);
equal
(
"
N2
"
,
edge
.
destination
,
"
edge destination is correct
"
);
});
});
}
}
...
@@ -375,7 +377,7 @@
...
@@ -375,7 +377,7 @@
runTest
()
runTest
()
]);
]);
})
})
.
fail
(
console
.
error
.
bind
(
this
)
)
.
fail
(
error_handler
)
.
always
(
start
);
.
always
(
start
);
});
});
...
@@ -386,7 +388,7 @@
...
@@ -386,7 +388,7 @@
function
runTest
()
{
function
runTest
()
{
return
jsplumb_gadget
.
getContent
().
then
(
function
()
{
return
jsplumb_gadget
.
getContent
().
then
(
function
()
{
equal
(
1
,
$
(
"
div[title='Node 1']
"
).
length
,
"
node 1 is visible
"
);
equal
(
1
,
$
(
"
div[title='Node 1']
"
).
length
,
"
node 1 is visible
"
);
equal
(
1
,
$
(
"
._jsPlumb_connector
"
).
length
,
"
there is
one
connection
"
);
equal
(
1
,
$
(
"
._jsPlumb_connector
"
).
length
,
"
there is
1
connection
"
);
// click on node 1 to see display the popup
// click on node 1 to see display the popup
$
(
"
div[title='Node 1']
"
).
simulate
(
"
dblclick
"
);
$
(
"
div[title='Node 1']
"
).
simulate
(
"
dblclick
"
);
...
@@ -442,7 +444,7 @@
...
@@ -442,7 +444,7 @@
runTest
()
runTest
()
]);
]);
})
})
.
fail
(
console
.
error
.
bind
(
this
)
)
.
fail
(
error_handler
)
.
always
(
start
);
.
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