mirror of
https://github.com/konvajs/konva.git
synced 2025-09-21 04:27:56 +08:00
setup mocha-phantomjs, test runner, and a few Util tests
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -4,6 +4,7 @@ dist
|
|||||||
tests/js/unitTests.js
|
tests/js/unitTests.js
|
||||||
analysis
|
analysis
|
||||||
node_modules
|
node_modules
|
||||||
|
phantomjs.exe
|
||||||
|
|
||||||
# Numerous always-ignore extensions
|
# Numerous always-ignore extensions
|
||||||
*.diff
|
*.diff
|
||||||
|
@@ -8,7 +8,9 @@
|
|||||||
"grunt-contrib-uglify": "~0.2.2",
|
"grunt-contrib-uglify": "~0.2.2",
|
||||||
"grunt-contrib-concat": "~0.3.0",
|
"grunt-contrib-concat": "~0.3.0",
|
||||||
"grunt-replace": "~0.4.4",
|
"grunt-replace": "~0.4.4",
|
||||||
"grunt-contrib-clean": "~0.4.1"
|
"grunt-contrib-clean": "~0.4.1",
|
||||||
|
"mocha": "~1.12.0",
|
||||||
|
"chai": "~1.7.2"
|
||||||
},
|
},
|
||||||
"readmeFilename": "README.md",
|
"readmeFilename": "README.md",
|
||||||
"main": "Gruntfile.js",
|
"main": "Gruntfile.js",
|
||||||
|
22
test/runner.html
Normal file
22
test/runner.html
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Mocha Tests</title>
|
||||||
|
<link rel="stylesheet" href="../node_modules/mocha/mocha.css" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="mocha"></div>
|
||||||
|
<script src="../node_modules/mocha/mocha.js"></script>
|
||||||
|
<script src="../node_modules/chai/chai.js"></script>
|
||||||
|
<script src="../dist/kinetic-dev.js"></script>
|
||||||
|
<script>
|
||||||
|
mocha.ui('tdd');
|
||||||
|
var assert = chai.assert;
|
||||||
|
</script>
|
||||||
|
<script src="unit/Util-test.js"></script>
|
||||||
|
<script>
|
||||||
|
if (window.mochaPhantomJS) { mochaPhantomJS.run(); }
|
||||||
|
else { mocha.run(); }
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
21
test/unit/Util-test.js
Normal file
21
test/unit/Util-test.js
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
suite('Util', function(){
|
||||||
|
var util;
|
||||||
|
|
||||||
|
setup(function(){
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
suite('get()', function(){
|
||||||
|
var get = Kinetic.Util.get;
|
||||||
|
|
||||||
|
test('get integer', function(){
|
||||||
|
assert.equal(get(1, 2), 1);
|
||||||
|
});
|
||||||
|
test('default to integer', function(){
|
||||||
|
assert.equal(get(undefined, 2), 2);
|
||||||
|
});
|
||||||
|
test('default to object', function(){
|
||||||
|
assert.equal(get(undefined, {foo:'bar'}).foo, 'bar');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
Reference in New Issue
Block a user