diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..42dd1d9 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,3 @@ +sudo: false +language: node_js +node_js: 0.12 diff --git a/package.json b/package.json index 2b86929..98cb4a2 100644 --- a/package.json +++ b/package.json @@ -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" } } diff --git a/spec/LTileLayerIiifSpec.js b/spec/LTileLayerIiifSpec.js new file mode 100644 index 0000000..0406bbf --- /dev/null +++ b/spec/LTileLayerIiifSpec.js @@ -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'); + }); +}); diff --git a/spec/karma.conf.js b/spec/karma.conf.js new file mode 100644 index 0000000..4cec93e --- /dev/null +++ b/spec/karma.conf.js @@ -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 + }) +}