mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-12 03:49:43 +02:00
adding failing test for requirejs
This commit is contained in:
@@ -14,6 +14,9 @@ var insert = require('gulp-insert');
|
|||||||
var jshint = require('gulp-jshint');
|
var jshint = require('gulp-jshint');
|
||||||
var stylish = require('jshint-stylish');
|
var stylish = require('jshint-stylish');
|
||||||
|
|
||||||
|
var qunit = require('gulp-qunit');
|
||||||
|
var bower = require('gulp-bower');
|
||||||
|
|
||||||
// Using gulp-jshint and jshint-stylish
|
// Using gulp-jshint and jshint-stylish
|
||||||
gulp.task('lint', function() {
|
gulp.task('lint', function() {
|
||||||
return gulp.src(['./src/**/*.js', '!**/parser/*.js'])
|
return gulp.src(['./src/**/*.js', '!**/parser/*.js'])
|
||||||
@@ -21,7 +24,7 @@ gulp.task('lint', function() {
|
|||||||
.pipe(jshint.reporter(stylish));
|
.pipe(jshint.reporter(stylish));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('test',['coverage','tape','jasmine']);
|
gulp.task('test',['coverage','tape','jasmine','qunit']);
|
||||||
|
|
||||||
gulp.task('jasmine',['jison','lint'], function () {
|
gulp.task('jasmine',['jison','lint'], function () {
|
||||||
return gulp.src(['src/**/*.spec.js'])
|
return gulp.src(['src/**/*.spec.js'])
|
||||||
@@ -45,3 +48,13 @@ gulp.task('coverage', function (cb) {
|
|||||||
.on('end', cb);
|
.on('end', cb);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
gulp.task('qunit', ['usageTestsBower'], function() {
|
||||||
|
return gulp.src('test/usageTests/requireTest.html')
|
||||||
|
.pipe(qunit());
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task('usageTestsBower', function() {
|
||||||
|
return bower({cwd: 'test/usageTests'})
|
||||||
|
.pipe(gulp.dest('test/usageTests/bower_components'));
|
||||||
|
});
|
||||||
|
@@ -45,7 +45,7 @@
|
|||||||
"express": "^4.12.4",
|
"express": "^4.12.4",
|
||||||
"foundation": "^4.2.1-1",
|
"foundation": "^4.2.1-1",
|
||||||
"front-matter": "^0.2.0",
|
"front-matter": "^0.2.0",
|
||||||
"gulp": "~3.8.9",
|
"gulp-bower": "0.0.10",
|
||||||
"gulp-browserify": "^0.5.0",
|
"gulp-browserify": "^0.5.0",
|
||||||
"gulp-bump": "^0.1.11",
|
"gulp-bump": "^0.1.11",
|
||||||
"gulp-concat": "~2.4.1",
|
"gulp-concat": "~2.4.1",
|
||||||
@@ -61,20 +61,21 @@
|
|||||||
"gulp-jshint": "^1.9.0",
|
"gulp-jshint": "^1.9.0",
|
||||||
"gulp-less": "^3.0.1",
|
"gulp-less": "^3.0.1",
|
||||||
"gulp-livereload": "^3.8.0",
|
"gulp-livereload": "^3.8.0",
|
||||||
|
"gulp-qunit": "~1.2.1",
|
||||||
"gulp-rename": "~1.2.0",
|
"gulp-rename": "~1.2.0",
|
||||||
"gulp-shell": "^0.2.10",
|
"gulp-shell": "^0.2.10",
|
||||||
"gulp-tag-version": "^1.2.1",
|
"gulp-tag-version": "^1.2.1",
|
||||||
"gulp-uglify": "~1.0.1",
|
"gulp-uglify": "~1.0.1",
|
||||||
|
"gulp": "~3.8.9",
|
||||||
"he": "^0.5.0",
|
"he": "^0.5.0",
|
||||||
"hogan.js": "^3.0.2",
|
"hogan.js": "^3.0.2",
|
||||||
"jasmine": "~2.0.1",
|
"jasmine": "~2.0.1",
|
||||||
"jison": "~0.4.15",
|
"jison": "~0.4.15",
|
||||||
"jshint-stylish": "^1.0.0",
|
"jshint-stylish": "^1.0.0",
|
||||||
"karma": "~0.12.20",
|
|
||||||
"karma-chrome-launcher": "~0.1.5",
|
"karma-chrome-launcher": "~0.1.5",
|
||||||
"karma-jasmine": "~0.2.1",
|
"karma-jasmine": "~0.2.1",
|
||||||
"karma-requirejs": "~0.2.2",
|
"karma-requirejs": "~0.2.2",
|
||||||
"lodash": "^2.4.1",
|
"karma": "~0.12.20",
|
||||||
"lodash._escapestringchar": "^2.4.1",
|
"lodash._escapestringchar": "^2.4.1",
|
||||||
"lodash._objecttypes": "^2.4.1",
|
"lodash._objecttypes": "^2.4.1",
|
||||||
"lodash._reinterpolate": "^2.4.1",
|
"lodash._reinterpolate": "^2.4.1",
|
||||||
@@ -82,6 +83,7 @@
|
|||||||
"lodash.defaults": "^2.4.1",
|
"lodash.defaults": "^2.4.1",
|
||||||
"lodash.templatesettings": "^2.4.1",
|
"lodash.templatesettings": "^2.4.1",
|
||||||
"lodash.values": "^2.4.1",
|
"lodash.values": "^2.4.1",
|
||||||
|
"lodash": "^2.4.1",
|
||||||
"marked": "^0.3.2",
|
"marked": "^0.3.2",
|
||||||
"mock-browser": "^0.90.27",
|
"mock-browser": "^0.90.27",
|
||||||
"path": "^0.4.9",
|
"path": "^0.4.9",
|
||||||
|
@@ -15,6 +15,7 @@
|
|||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"requirejs": "~2.1.16",
|
"requirejs": "~2.1.16",
|
||||||
"mermaid": "~0.4.0"
|
"mermaid": "~0.4.0",
|
||||||
|
"qunit": "~1.18.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,22 +1,28 @@
|
|||||||
require.config({
|
require.config({
|
||||||
baseUrl: '.',
|
|
||||||
paths: {
|
paths: {
|
||||||
// the left side is the module ID,
|
mermaid: '../../dist/mermaid'
|
||||||
// the right side is the path to
|
},
|
||||||
// the jQuery file, relative to baseUrl.
|
shim: {
|
||||||
// Also, the path should NOT include
|
mermaid: {
|
||||||
// the '.js' file extension. This example
|
exports: 'mermaid'
|
||||||
// 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'
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Start the main app logic.
|
require([], function (){
|
||||||
requirejs(['simple','mermaid'],
|
QUnit.module('requireTest.html');
|
||||||
function (simple) {
|
|
||||||
//jQuery, canvas and the app/sub module are all
|
QUnit.test('using mermaid in requirejs', function (assert){
|
||||||
//loaded and can be used here now.
|
var done = assert.async();
|
||||||
|
require(['mermaid'], function (mermaid) {
|
||||||
|
assert.ok(mermaid, 'mermaid is not null');
|
||||||
mermaid.init();
|
mermaid.init();
|
||||||
|
assert.equal(window.d3.selectAll('path')[0].length, 8,
|
||||||
|
'drew 8 paths');
|
||||||
|
done();
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
QUnit.load();
|
||||||
|
QUnit.start();
|
||||||
|
});
|
||||||
|
@@ -2,41 +2,26 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<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 data-main="reqJsApp.js" src="bower_components/requirejs/require.js"></script>
|
||||||
<script>
|
|
||||||
var mermaid_config = {
|
|
||||||
startOnLoad:true
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</head>
|
</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>
|
</html>
|
||||||
|
Reference in New Issue
Block a user