Skip to content

Commit

Permalink
Added first qunit test, ran by karma
Browse files Browse the repository at this point in the history
  • Loading branch information
verlok committed Mar 23, 2014
1 parent dbcda78 commit a783160
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 41 deletions.
5 changes: 4 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ module.exports = function(grunt) {
src: ['<%= uglify.dist.src %>']
}
},
karma: {

}
watch: {
gruntfile: {
files: '<%= jshint.gruntfile.src %>',
Expand All @@ -65,6 +68,6 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-watch');

// Default task.
grunt.registerTask('default', ['jshint', 'uglify']);
grunt.registerTask('default', ['jshint', 'uglify', 'karma']);

};
82 changes: 42 additions & 40 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,67 +1,69 @@
// Karma configuration
// Generated on Tue Mar 18 2014 03:46:20 GMT+0100 (CET)
// Generated on Sun Mar 23 2014 15:19:50 GMT+0100 (CET)

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

// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
// 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: ['qunit'],
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['qunit'],


// list of files / patterns to load in the browser
files: [

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


// list of files to exclude
exclude: [

],
// list of files to exclude
exclude: [
'*.min.js',
'Gruntfile.js'
],


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

},
// 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'],

// 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,

// web server port
port: 9876,

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

// 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,

// 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: false,

// 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: ['Chrome', 'IE'],

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

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

// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false
});
};
4 changes: 4 additions & 0 deletions test/jquery.min.js

Large diffs are not rendered by default.

29 changes: 29 additions & 0 deletions test/picturePolyfill.qunit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
module( "hello", {
setup: function() {
$('body').append('<picture data-alt="A beautiful responsive image" data-default-src="img/960x960.gif">\
<source srcset="img/480x480.gif, img/480x480x2.gif 2x"/>\
<source srcset="img/512x512.gif, img/512x512x2.gif 2x" media="(min-width: 481px)"/>\
<source srcset="img/720x720.gif, img/720x720x2.gif 2x" media="(min-width: 1025px)"/>\
<source srcset="img/960x960.gif, img/960x960x2.gif 2x" media="(min-width: 1441px)"/>\
<noscript>\
<img src="img/960x960.gif" alt="A beautiful responsive image"/>\
</noscript>\
</picture>\
<picture data-alt="A beautiful responsive image" data-default-src="img/960x960.gif">\
<source src="img/480x480.gif"/>\
<source src="img/512x512.gif" media="(min-width: 481px)"/>\
<source src="img/720x720.gif" media="(min-width: 1025px)"/>\
<source src="img/960x960.gif" media="(min-width: 1441px)"/>\
<noscript>\
<img src="img/960x960.gif" alt="A beautiful responsive image"/>\
</noscript>\
</picture>');
},
teardown: function() {
$('picture').remove();
}
});

test( "Script initialization", function() {
strictEqual( typeof window.picturePolyfill, 'function');
});

0 comments on commit a783160

Please sign in to comment.