mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-04-08 17:08:04 -04:00
Add basic unit tests
This commit is contained in:
6
.travis.yml
Normal file
6
.travis.yml
Normal file
@@ -0,0 +1,6 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.8"
|
||||
install: npm install
|
||||
before_script: grunt
|
||||
script: grunt mochaWebdriver:test
|
||||
22
Gruntfile.js
22
Gruntfile.js
@@ -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']);
|
||||
|
||||
|
||||
7
dist/opensourcepos.js
vendored
7
dist/opensourcepos.js
vendored
@@ -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);
|
||||
}
|
||||
|
||||
19
dist/opensourcepos.min.js
vendored
19
dist/opensourcepos.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -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
11
test/create_item.js
Normal 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);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user