Skip to content

Commit

Permalink
setup leaflet-iiif to use mocha js specs with karma as the runner
Browse files Browse the repository at this point in the history
  • Loading branch information
mejackreed committed Mar 16, 2016
1 parent e646c51 commit 34b3a84
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 1 deletion.
10 changes: 9 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@
"devDependencies": {
"grunt": "^0.4.5",
"grunt-contrib-connect": "^0.10.1",
"grunt-contrib-watch": "^0.6.1"
"grunt-contrib-watch": "^0.6.1",
"karma": "^0.13.22",
"karma-jasmine": "^0.3.7",
"karma-phantomjs-launcher": "^1.0.0",
"leaflet": "^0.7.7",
"phantomjs-prebuilt": "^2.1.5"
},
"scripts": {
"test": "./node_modules/.bin/karma start ./spec/karma.conf.js"
}
}
19 changes: 19 additions & 0 deletions spec/LTileLayerIiifSpec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
describe('L.TileLayer.Iiif', function() {
var div;
var map;

beforeEach(function() {
div = document.createElement('div');
div.style.width = '800px';
div.style.height = '600px';
div.style.visibility = 'hidden';

document.body.appendChild(div);

map = L.map(div);
});

it('initializes the map', function(){
expect(typeof (map)).toEqual('object');
});
});
70 changes: 70 additions & 0 deletions spec/karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// Karma configuration
// Generated on Wed Mar 16 2016 06:58:00 GMT-0700 (PDT)

module.exports = function(config) {
config.set({

// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',


// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine'],


// list of files / patterns to load in the browser
files: [
'./../node_modules/leaflet/dist/leaflet.js',
'./**/*.js'
],


// list of files to exclude
exclude: [
],


// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
},


// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress'],


// web server port
port: 9876,


// enable / disable colors in the output (reporters and logs)
colors: true,


// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,


// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,


// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['PhantomJS'],


// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: true,

// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity
})
}

0 comments on commit 34b3a84

Please sign in to comment.