Skip to content

Commit

Permalink
refactorize tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kumilingus committed Apr 14, 2015
1 parent 04ba28f commit 0ed3b98
Show file tree
Hide file tree
Showing 18 changed files with 101 additions and 10,103 deletions.
3 changes: 3 additions & 0 deletions .bowerrc
@@ -0,0 +1,3 @@
{
"directory" : "lib"
}
3 changes: 2 additions & 1 deletion .gitignore
@@ -1,2 +1,3 @@
node_modules/
docs/
lib/*/*
npm-debug.log
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -5,7 +5,7 @@ test: ctest stest cstest

# client-side tests only
stest:
./node_modules/.bin/mocha test/nodejs/tests.js --reporter spec
./node_modules/.bin/mocha test/jointjs-nodejs/*.js --reporter spec
# server-side tests only
ctest:
grunt qunit
Expand Down
10 changes: 10 additions & 0 deletions bower.json
@@ -0,0 +1,10 @@
{
"name": "jointjs",
"private": true,
"devDependencies": {
"qunit": "~1.18.0",
"blanket": "~1.1.5",
"resemblejs": "~1.2.1",
"sinonjs": "~1.14.1"
}
}
2 changes: 1 addition & 1 deletion src/joint.dia.cell.js
Expand Up @@ -504,7 +504,7 @@ joint.dia.Cell = Backbone.Model.extend({

var pathArray = path.split('/');

if (pathArray.length === 0) {
if (pathArray.length === 1) {
// A top level property
return this.unset(path, opt);
}
Expand Down
50 changes: 0 additions & 50 deletions test/joint.dia/index.html

This file was deleted.

File renamed without changes.
31 changes: 31 additions & 0 deletions test/joint.dia/basic.js → test/jointjs/basic.js
Expand Up @@ -431,6 +431,37 @@ test('prop()', function() {
deepEqual(el.prop('a/b'), { d: 2 }, 'rewrite mode doesn\'t merge values');
});

test('removeProp()', function() {

expect(4);

var el = new joint.dia.Cell({
flat: 6,
nested: { a: 4, b: 5 }
});

el.removeProp('NonExisting');

deepEqual(el.attributes, {
id: el.id,
flat: 6,
nested: { a: 4, b: 5 }
}, 'Removing a non-existing property won\'t affect the model\'s attributes.');

el.removeProp('flat');

ok(!el.has('flat'), 'A flat property was unset from the model.');

el.removeProp('nested/a');

deepEqual(el.get('nested'), { b: 5 }, 'A nested property was unset from the model.');

el.on('change', function(cell, opt) {
ok(opt.OPT_PRESENT, 'Options are propagated to the underlying model method.');
});

el.removeProp('nested/b', { OPT_PRESENT: true });
});

test('toBack(), toFront()', function() {

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
53 changes: 53 additions & 0 deletions test/jointjs/index.html
@@ -0,0 +1,53 @@
<!DOCTYPE html>
<html>
<head>

<title>JointJS test suite</title>
<link rel="stylesheet" href="../../lib/qunit/qunit/qunit.css">
<link rel="stylesheet" href="../../joint.css">
</head>
<body>

<div id="qunit"></div>
<div id="qunit-fixture"></div>

<script src="../../lib/qunit/qunit/qunit.js"></script>
<script src="../../lib/blanket/dist/qunit/blanket.js"></script>
<script src="../../lib/sinonjs/sinon.js"></script>

<script src="../utils.js"></script>

<script src="../../lib/jquery.js"></script>
<script src="../../lib/lodash.js"></script>
<script src="../../lib/backbone.js"></script>

<script src="../../src/vectorizer.js"></script>
<script src="../../src/geometry.js"></script>

<script data-cover src="../../src/core.js"></script>
<script data-cover src="../../src/joint.dia.graph.js"></script>
<script data-cover src="../../src/joint.dia.cell.js"></script>
<script data-cover src="../../src/joint.dia.element.js"></script>
<script data-cover src="../../src/joint.dia.link.js"></script>
<script data-cover src="../../src/joint.dia.paper.js"></script>
<script data-cover src="../../plugins/joint.shapes.basic.js"></script>
<script data-cover src="../../plugins/routers/joint.routers.orthogonal.js"></script>
<script data-cover src="../../plugins/routers/joint.routers.manhattan.js"></script>
<script data-cover src="../../plugins/routers/joint.routers.metro.js"></script>
<script data-cover src="../../plugins/connectors/joint.connectors.normal.js"></script>
<script data-cover src="../../plugins/connectors/joint.connectors.rounded.js"></script>
<script data-cover src="../../plugins/connectors/joint.connectors.smooth.js"></script>
<script data-cover src="../../plugins/layout/DirectedGraph/joint.layout.DirectedGraph.js"></script>
<script data-cover src="../../plugins/joint.shapes.devs.js"></script>
<script data-cover src="../../plugins/joint.shapes.uml.js"></script>

<script src="./core.js"></script>
<script src="./basic.js"></script>
<script src="./links.js"></script>
<script src="./paper.js"></script>
<script src="./routers.js"></script>
<script src="./connectors.js"></script>
<script src="./embedding.js"></script>

</body>
</html>
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 0ed3b98

Please sign in to comment.