-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #190 from bollwyvl/amd
Using QUnit for AMD testing
- Loading branch information
Showing
6 changed files
with
65 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ | |
], | ||
"dependencies": { | ||
"requirejs": "~2.1.16", | ||
"mermaid": "~0.4.0" | ||
"mermaid": "~0.4.0", | ||
"qunit": "~1.18.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters