Skip to content

Commit

Permalink
Use the local jQuery file
Browse files Browse the repository at this point in the history
  • Loading branch information
Gregor Gramlich committed Jan 15, 2012
1 parent 45a7858 commit 3b2651c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
8 changes: 3 additions & 5 deletions Jakefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ task('runspecs', [], function () {
var specFolder = 'spec';
process.argv.push(specFolder);
loadJsDomAndJQuery(function (window) {
global.window = window;
global.theWindow = window;
global.$ = window.jQuery;

require('jasmine-node/lib/jasmine-node/cli.js');
Expand All @@ -21,11 +21,9 @@ function loadJsDomAndJQuery(callback) {

jsdom.env({
html: "<html><body></body></html>",
documentRoot: __dirname,
scripts: [
// TODO: find a way to use local jquery
// (maybe the node-jQuery package)
// TODO: load jasmine-jquery.js
'http://code.jquery.com/jquery-1.5.min.js'
'lib/jquery/jquery-1.7.1.js',
]
}, function (err, window) {
callback(window);
Expand Down
5 changes: 5 additions & 0 deletions spec/sampleSpec.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
if (typeof window === 'undefined') {
window = global.theWindow;
}

describe('just a sample without html to get started', function () {
it ('should calculate 1 + 1', function () {
expect(1 + 1).toBe(2);
Expand All @@ -7,6 +11,7 @@ describe('just a sample without html to get started', function () {
describe('jQuery variable', function () {
it ('should be defined', function () {
expect($).toBeDefined();
expect($).toBe(window.jQuery);
});
});

0 comments on commit 3b2651c

Please sign in to comment.