-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(e2e): add a test for dojo adapter
Closes #328
- Loading branch information
1 parent
99c72c9
commit f499f7b
Showing
5 changed files
with
122 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
define(function() { | ||
// return the module value | ||
return function (a, b) { | ||
return a + b; | ||
}; | ||
} | ||
); |
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 |
---|---|---|
@@ -0,0 +1,64 @@ | ||
module.exports = function(config) { | ||
config.set({ | ||
// base path, that will be used to resolve files and exclude | ||
basePath: '', | ||
|
||
frameworks: ['jasmine', 'dojo'], | ||
|
||
// list of files / patterns to load in the browser | ||
files: [ | ||
'main.js', | ||
|
||
// all the sources, tests | ||
{pattern: '*.js', included: false} | ||
], | ||
|
||
|
||
// test results reporter to use | ||
// possible values: dots || progress | ||
reporters: ['dots'], | ||
|
||
|
||
// web server port | ||
port: 9876, | ||
|
||
|
||
// cli runner port | ||
runnerPort: 9100, | ||
|
||
|
||
// enable / disable colors in the output (reporters and logs) | ||
colors: true, | ||
|
||
|
||
// level of logging | ||
// possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG | ||
logLevel: config.LOG_INFO, | ||
|
||
|
||
// enable / disable watching file and executing tests whenever any file changes | ||
autoWatch: true, | ||
|
||
|
||
// Start these browsers, currently available: | ||
// - Chrome | ||
// - ChromeCanary | ||
// - Firefox | ||
// - Opera | ||
// - Safari | ||
// - PhantomJS | ||
browsers: [process.env.TRAVIS ? 'Firefox' : 'Chrome'], | ||
|
||
|
||
// Continuous Integration mode | ||
// if true, it capture browsers, run tests and exit | ||
singleRun: false, | ||
|
||
plugins: [ | ||
'karma-dojo', | ||
'karma-jasmine', | ||
'karma-chrome-launcher', | ||
'karma-firefox-launcher' | ||
] | ||
}); | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
var allTestFiles = []; | ||
var TEST_REGEXP = /test.*\.js$/; | ||
|
||
Object.keys(window.__karma__.files).forEach(function(file) { | ||
if (TEST_REGEXP.test(file)) { | ||
allTestFiles.push(file); | ||
} | ||
}); | ||
|
||
var dojoConfig = { | ||
packages: [ | ||
{ name:"local" ,location:"/base"}, | ||
{ name: "dojo", location: "http://ajax.googleapis.com/ajax/libs/dojo/1.9.1/dojo" }, | ||
{ name: "dojox", location: "http://ajax.googleapis.com/ajax/libs/dojo/1.9.1/dojox" } | ||
], | ||
asynch: true | ||
}; | ||
|
||
|
||
/** | ||
* This function must be defined and is called back by the dojo adapter | ||
* @returns {string} a list of dojo spec/test modules to register with your testing framework | ||
*/ | ||
window.__karma__.dojoStart = function(){ | ||
return allTestFiles; | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
define(['local/dependency','dojo/_base/lang'], function(dep,lang) { | ||
|
||
// jasmine | ||
describe('something', function() { | ||
it('should pass', function() { | ||
expect(true).toBe(true); | ||
}); | ||
|
||
it('should sum', function() { | ||
expect(dep(1, 2)).toBe(3); | ||
}); | ||
|
||
it('should trim using a dojo AMD module',function(){ | ||
expect(lang.trim(" len4 ").length).toEqual(4); | ||
}); | ||
|
||
}); | ||
}); |