adding failing test for requirejs

This commit is contained in:
Nicholas Bollweg
2015-07-22 00:36:31 -04:00
parent 1b7ad1fc38
commit 1a36ed9786
5 changed files with 63 additions and 56 deletions

View File

@@ -15,6 +15,7 @@
],
"dependencies": {
"requirejs": "~2.1.16",
"mermaid": "~0.4.0"
"mermaid": "~0.4.0",
"qunit": "~1.18.0"
}
}

View File

@@ -1,22 +1,28 @@
require.config({
baseUrl: '.',
paths: {
// the left side is the module ID,
// the right side is the path to
// the jQuery file, relative to baseUrl.
// Also, the path should NOT include
// the '.js' file extension. This example
// is using jQuery 1.9.0 located at
// js/lib/jquery-1.9.0.js, relative to
// the HTML page.
mermaid: 'bower_components/mermaid/dist/mermaid.full'
mermaid: '../../dist/mermaid'
},
shim: {
mermaid: {
exports: 'mermaid'
}
}
});
// Start the main app logic.
requirejs(['simple','mermaid'],
function (simple) {
//jQuery, canvas and the app/sub module are all
//loaded and can be used here now.
mermaid.init();
});
require([], function (){
QUnit.module('requireTest.html');
QUnit.test('using mermaid in requirejs', function (assert){
var done = assert.async();
require(['mermaid'], function (mermaid) {
assert.ok(mermaid, 'mermaid is not null');
mermaid.init();
assert.equal(window.d3.selectAll('path')[0].length, 8,
'drew 8 paths');
done();
});
});
QUnit.load();
QUnit.start();
});

View File

@@ -2,41 +2,26 @@
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="bower_components/qunit/qunit/qunit.css" />
<link rel="stylesheet" href="../../dist/mermaid.forest.css"/>
<script src="bower_components/qunit/qunit/qunit.js"></script>
<script>
QUnit.config.autostart = false;
</script>
<script data-main="reqJsApp.js" src="bower_components/requirejs/require.js"></script>
<script>
var mermaid_config = {
startOnLoad:true
}
</script>
</head>
<body>
TEST 0.4.1
<div class="mermaid">
graph TD;
sq[Square shape2] --> ci((Circle shape // Начало))
</div>
<h1>Shapes</h1>
<div class="mermaid">
info
</div>
<div class="mermaid">
graph LR
A[Square Rect] -- Link text --> B((Circle))
A --> C(Round Rect)
B --> D{Rhombus}
C --> D
</div>
<div class="mermaid">
graph TD;
sq[Square shape]-->ci((Circle shape));
od>Odd shape]---|Two line<br>edge comment|ro;
od2>Really long text in an Odd shape]-->od3>Really long text with linebreak<br>in an Odd shape];
di{Diamond is <br/> broken}-->ro(Rounded<br>square<br>shape);
di-->ro2(Rounded square shape);
e((Inner circle URL))-->f(,.?!+-*ز);
style e red;
</div>
</body>
<body>
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<div class="mermaid">
graph LR
A-->B
B-->C
C-->A
D-->C
</div>
</body>
</html>