Add basic unit tests

This commit is contained in:
jekkos
2015-04-01 17:53:07 +02:00
parent 8ff742085a
commit 39edf5ccdb
6 changed files with 40 additions and 31 deletions

6
.travis.yml Normal file
View File

@@ -0,0 +1,6 @@
language: node_js
node_js:
- "0.8"
install: npm install
before_script: grunt
script: grunt mochaWebdriver:test

View File

@@ -59,20 +59,13 @@ module.exports = function(grunt) {
dest: 'application/views/partial/header.php'
}
},
mochaSelenium: {
options : {
reporter: 'spec',
timeout: 30e3,
usePromises: true,
useSystemPhantom: true
},
phantomjs: {
src: ['test/*.js'],
options: {
// phantomjs must be in the $PATH when invoked
browserName: 'phantomjs'
}
}
mochaWebdriver: {
test : {
options: {
usePhantom: true,
},
src: ['test/**/*.js']
}
},
watch: {
files: ['<%= jshint.files %>'],
@@ -85,6 +78,7 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-script-link-tags');
grunt.loadNpmTasks('grunt-mocha-webdriver');
grunt.registerTask('default', ['tags:js', 'concat', 'uglify', 'tags:minjs']);

View File

@@ -14681,6 +14681,8 @@ function enable_delete(confirm_message,none_selected_message)
if(confirm(confirm_message))
{
do_delete($(this).attr('href'));
} else {
return false;
}
}
else
@@ -14714,10 +14716,7 @@ function do_delete(url)
$("#sortable_table tbody tr").length > 0 && update_sortable_table();
});
});
for(index in response.ids) {
update_row(response.ids[index],url.replace(/[^\/]+$/,'get_row'));
}
});
set_feedback(response.message,'success_message',false);
}

View File

File diff suppressed because one or more lines are too long

View File

@@ -16,15 +16,15 @@
"author": "jekkos",
"license": "MIT",
"devDependencies": {
"grunt": "^0.4.5",
"grunt": "~0.4.5",
"grunt-contrib-concat": "~0.5.1",
"grunt-contrib-jshint": "~0.6.3",
"grunt-contrib-uglify": "~0.8.0",
"grunt-contrib-watch": "~0.5.3",
"grunt-mocha-selenium": "~1.0.1",
"grunt-mocha-webdriver": "^1.1.2",
"grunt-script-link-tags": "~1.0.3",
"grunt-selenium-launcher": "^0.1.1",
"mocha": "^2.2.1",
"phantomjs": "^1.9.7-8"
"wd": "^0.3.11"
}
}

11
test/create_item.js Normal file
View File

@@ -0,0 +1,11 @@
var assert = require("assert"); // node.js core module
var wd = require('wd')
describe('A Mocha test run by grunt-mocha-webdriver', function () {
it('has a browser injected into it', function () {
assert.ok(this.browser);
});
it('has wd injected into it for customizing', function () {
assert.notEqual(wd, undefined);
});
});