1
0
Fork 0

Adapted karma tests to use the combined file generated via grunt instead of a self concatenated file. The test is now much closer to reality and the files are not stored redundantly

This commit is contained in:
Michael Hackstein 2015-01-25 14:27:34 +00:00
parent 0516be7f64
commit e32f1ea081
6 changed files with 48 additions and 24 deletions

View File

@ -102,7 +102,7 @@
createModalHotkeys: function() {
//submit modal
$(this.el).bind('keydown', 'ctrl+return', function(){
$(this.el).bind('keydown', 'return', function(){
$('.modal-footer .button-success').click();
});
$("input", $(this.el)).bind('keydown', 'return', function(){

View File

@ -130,7 +130,7 @@
"app.js": {
"files": [
"frontend/build/app.min.js"
"frontend/build/app.js"
]
},

View File

@ -87,9 +87,6 @@
"test/specs/views/shellViewSpec.js",
"test/specs/views/userManagementViewSpec.js",
"test/specs/router/routerSpec.js",
"test/specs/router/clusterRouterSpec.js",
"test/specs/router/routerSpec.js",
"test/specs/router/versionCheckSpec.js"

View File

@ -421,6 +421,7 @@
buttons = [],
cbs = {
callback: function () {
throw "Should by a spy";
}
},
btn,
@ -429,17 +430,18 @@
e.which = 13;
e.keyCode = 13;
spyOn(cbs, "callback").andCallThrough();
spyOn(cbs, "callback");
btnObj = testee.createSuccessButton(title, cbs.callback);
buttons.push(btnObj);
testShow(buttons);
btn = $(".button-" + btnObj.type, $(div));
spyOn($.fn, "click");
spyOn($.fn, "click").andCallThrough();
$(testee.el).trigger(e);
expect($.fn.click).toHaveBeenCalled();
expect(cbs.callback).toHaveBeenCalled();
});
it("should call function bind function for view.el input", function () {
@ -447,8 +449,10 @@
btnObj = {},
title = "Save",
buttons = [],
textField = [],
cbs = {
callback: function () {
throw "Should be a spy";
}
},
btn,
@ -458,19 +462,22 @@
testee.enabledHotkey = false;
spyOn(cbs, "callback").andCallThrough();
spyOn(cbs, "callback");
btnObj = testee.createSuccessButton(title, cbs.callback);
buttons.push(btnObj);
textField.push(
testee.createTextEntry("dontcare", "ABC", "asd")
);
testShow(buttons);
$('.modal-body').html('<input type="text" id="dontcare" value="asd">ABC</input>');
testShow(buttons, textField);
btn = $(".button-" + btnObj.type, $(div));
spyOn($.fn, "click");
$("input").trigger(e);
spyOn($.fn, "click").andCallThrough();
$("#dontcare").trigger(e);
expect($.fn.click).toHaveBeenCalled();
expect(cbs.callback).toHaveBeenCalled();
});
it("should call function bind function for view.el select", function () {
@ -478,8 +485,10 @@
btnObj = {},
title = "Save",
buttons = [],
select = [],
cbs = {
callback: function () {
throw "Should be a spy";
}
},
btn,
@ -489,19 +498,25 @@
testee.enabledHotkey = false;
spyOn(cbs, "callback").andCallThrough();
spyOn(cbs, "callback");
btnObj = testee.createSuccessButton(title, cbs.callback);
buttons.push(btnObj);
select.push(
testee.createSelectEntry("dontcare", "Choose", false, undefined,
testee.createOptionEntry("option1")
)
);
testShow(buttons);
$('.modal-body').html('<select name="top5" size="3"><option>Heino</option></select>');
testShow(buttons, select);
btn = $(".button-" + btnObj.type, $(div));
spyOn($.fn, "click");
spyOn($.fn, "click").andCallThrough();
$("select").trigger(e);
expect($.fn.click).toHaveBeenCalled();
expect(cbs.callback).toHaveBeenCalled();
});
/*it("test focused button navigation (direction right)", function() {

View File

@ -33,8 +33,6 @@
"frontend/js/lib/jquery.uploadfile.js",
"frontend/js/lib/select2.min.js",
"frontend/js/lib/handlebars-1.0.rc.1.js",
"frontend/js/lib/underscore.js",
"frontend/js/lib/backbone.js",
"frontend/js/lib/jsoneditor-min.js",
"frontend/js/lib/d3.v3.min.js",
"frontend/js/lib/nv.d3.js",
@ -50,17 +48,19 @@
"frontend/js/lib/md5.js",
"frontend/src/ace.js"
],
js: [
graphViewer: [
"frontend/js/graphViewer/graph/*",
"frontend/js/graphViewer/ui/*",
"frontend/js/graphViewer/graphViewer.js",
"frontend/js/graphViewer/graphViewer.js"
],
modules: [
"frontend/js/arango/arango.js",
"frontend/js/arango/templateEngine.js",
"frontend/js/shell/browser.js",
"frontend/js/config/dygraphConfig.js",
"frontend/js/modules/underscore.js",
"frontend/js/modules/org/arangodb/aql/functions.js",
"frontend/js/modules/org/arangodb/graph/traversal.js",
"frontend/js/modules/org/arangodb/.js",
"frontend/js/modules/org/arangodb/arango-collection-common.js",
"frontend/js/modules/org/arangodb/arango-collection.js",
"frontend/js/modules/org/arangodb/arango-database.js",
@ -85,8 +85,9 @@
"frontend/js/bootstrap/module-internal.js",
"frontend/js/client/bootstrap/module-internal.js",
"frontend/js/client/client.js",
"frontend/js/bootstrap/module-console.js",
"frontend/js/arango/arango.js",
"frontend/js/bootstrap/module-console.js"
],
js: [
"frontend/js/models/*",
"frontend/js/collections/*",
"frontend/js/views/*",
@ -133,7 +134,8 @@
'frontend/build/app.js': [
'<%=project.shared.lib %>',
'<%=project.standalone.lib %>',
'<%=project.standalone.graphViewer %>',
'<%=project.standalone.modules %>',
'<%=project.standalone.js %>'
]
},
@ -147,6 +149,15 @@
}
}
},
jshint: {
options: {
laxbreak: true
},
default: [
'<%=project.standalone.js %>'
]
},
uglify: {
dist: {

View File

@ -7,6 +7,7 @@
"devDependencies": {
"grunt": "^0.4.5",
"grunt-concat-in-order": "^0.1.6",
"grunt-contrib-jshint": "^0.11.0",
"grunt-contrib-sass": "^0.8.1",
"grunt-contrib-uglify": "^0.7.0",
"grunt-contrib-watch": "^0.6.1",