1
0
Fork 0

Fixed JSLint to work with karma now. Some JSLint errors still occur

This commit is contained in:
Michael Hackstein 2013-11-12 14:01:09 +01:00
parent 87555c84ab
commit 41ea74dca5
12 changed files with 707 additions and 132 deletions

View File

@ -0,0 +1,185 @@
// Karma configuration
// Generated on Thu Jul 04 2013 11:39:34 GMT+0200 (CEST)
module.exports = function(karma) {
karma.set({
// base path, that will be used to resolve files and exclude
basePath: '../../',
// frameworks to use
frameworks: ['jasmine'],
// list of files / patterns to load in the browser
files: [
'test/lib/jasmine-1.3.1/jasmine-html.js',
'test/lib/jslint.js',
'frontend/js/lib/jquery-1.8.3.js',
'frontend/js/lib/jquery-ui-1.9.2.custom.js',
'frontend/js/lib/jquery.dataTables.js',
'frontend/js/lib/jquery.autogrow.js',
'frontend/js/lib/jquery.jeditable.js',
'frontend/js/lib/jquery.jeditable.autogrow.js',
'frontend/js/lib/jquery.snippet.js',
'frontend/js/lib/jquery.gritter.js',
'frontend/js/lib/jquery.slideto.min.js',
'frontend/js/lib/jquery.wiggle.min.js',
'frontend/js/lib/jquery.ba-bbq.min.js',
'frontend/js/lib/handlebars-1.0.rc.1.js',
'frontend/js/lib/underscore.js',
'frontend/js/lib/backbone.js',
'frontend/js/lib/d3.v3.js',
'frontend/js/lib/nv.d3.js',
'frontend/js/lib/d3.fisheye.js',
'frontend/js/lib/ejs_0.9_alpha_1_production.js',
'frontend/js/lib/ColVis.js',
'frontend/js/lib/bootstrap.js',
'frontend/js/lib/bootstrap-pagination.js',
'frontend/src/ace.js',
'frontend/js/lib/jqconsole.min.js',
'frontend/js/lib/splitter.js',
'frontend/js/lib/swagger.js',
'frontend/js/lib/swagger-ui.js',
'frontend/js/lib/highlight.7.3.pack.js',
// arangodb
'frontend/js/arango/arango.js',
'frontend/js/arango/templateEngine.js',
'frontend/js/shell/browser.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',
'frontend/js/modules/org/arangodb/arango-query-cursor.js',
'frontend/js/modules/org/arangodb/arango-statement-common.js',
'frontend/js/modules/org/arangodb/arango-statement.js',
'frontend/js/modules/org/arangodb/arangosh.js',
'frontend/js/modules/org/arangodb/graph-common.js',
'frontend/js/modules/org/arangodb/graph.js',
'frontend/js/modules/org/arangodb/mimetypes.js',
'frontend/js/modules/org/arangodb/simple-query-common.js',
'frontend/js/modules/org/arangodb/simple-query.js',
'frontend/js/modules/org/arangodb/aql/functions.js',
'frontend/js/modules/org/arangodb/graph/traversal.js',
'frontend/js/modules/org/arangodb-common.js',
'frontend/js/modules/org/arangodb.js',
'frontend/js/bootstrap/errors.js',
'frontend/js/bootstrap/monkeypatches.js',
'frontend/js/bootstrap/module-internal.js',
'frontend/js/client/bootstrap/module-internal.js',
'frontend/js/client/client.js',
// Mocks
'test/mocks/disableEJS.js',
// Models
'frontend/js/models/arangoCollection.js',
'frontend/js/models/arangoDatabase.js',
'frontend/js/models/arangoDocument.js',
'frontend/js/models/arangoLog.js',
'frontend/js/models/arangoStatistics.js',
'frontend/js/models/arangoStatisticsDescription.js',
'frontend/js/models/foxx.js',
// Collections
'frontend/js/collections/arangoCollections.js',
'frontend/js/collections/arangoDocuments.js',
'frontend/js/collections/arangoDocument.js',
'frontend/js/collections/arangoDatabase.js',
'frontend/js/collections/arangoLogs.js',
'frontend/js/collections/arangoStatisticsCollection.js',
'frontend/js/collections/arangoStatisticsDescriptionCollection.js',
'frontend/js/collections/foxxCollection.js',
// Views
'frontend/js/views/navigationView.js',
'frontend/js/views/footerView.js',
'frontend/js/views/queryView.js',
'frontend/js/views/shellView.js',
'frontend/js/views/dashboardView.js',
'frontend/js/views/collectionsView.js',
'frontend/js/views/collectionView.js',
'frontend/js/views/newCollectionView.js',
'frontend/js/views/collectionsItemView.js',
'frontend/js/views/documentsView.js',
'frontend/js/views/documentView.js',
'frontend/js/views/documentSourceView.js',
'frontend/js/views/logsView.js',
'frontend/js/views/foxxActiveView.js',
'frontend/js/views/foxxActiveListView.js',
'frontend/js/views/foxxInstalledView.js',
'frontend/js/views/foxxInstalledListView.js',
'frontend/js/views/foxxEditView.js',
'frontend/js/views/foxxMountView.js',
'frontend/js/views/appDocumentationView.js',
'frontend/js/views/graphView.js',
'frontend/js/views/dbSelectionView.js',
//Templates
{pattern: 'frontend/js/templates/*.ejs', served:true, included:false, watched: true},
// Specs
'test/specs/arango/arangoSpec.js',
'test/specs/views/collectionViewSpec.js',
'test/specs/views/collectionsViewSpec.js',
'test/specs/views/foxxEditViewSpec.js',
'test/specs/views/dbSelectionViewSpec.js',
'test/specs/views/graphViewSpec.js',
'test/specJSLint/jsLintSpec.js'
],
// list of files to exclude
exclude: [
],
// test results reporter to use
// possible values: 'dots', 'progress', 'junit', 'growl', 'coverage'
reporters: ['progress'],
// web server port
port: 9876,
// cli runner port
runnerPort: 9100,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: karma.LOG_DISABLE || karma.LOG_ERROR || karma.LOG_WARN || karma.LOG_INFO || karma.LOG_DEBUG
logLevel: karma.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
// Start these browsers, currently available:
// - Chrome
// - ChromeCanary
// - Firefox
// - Opera
// - Safari (only Mac)
// - PhantomJS
// - IE (only Windows)
browsers: [],
// If browser does not capture in given timeout [ms], kill it
captureTimeout: 60000,
// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun: false
});
};

View File

@ -0,0 +1,185 @@
// Karma configuration
// Generated on Thu Jul 04 2013 11:39:34 GMT+0200 (CEST)
module.exports = function(karma) {
karma.set({
// base path, that will be used to resolve files and exclude
basePath: '../../',
// frameworks to use
frameworks: ['jasmine'],
// list of files / patterns to load in the browser
files: [
'frontend/js/lib/jquery-1.8.3.js',
'frontend/js/lib/jquery-ui-1.9.2.custom.js',
'frontend/js/lib/jquery.dataTables.js',
'frontend/js/lib/jquery.autogrow.js',
'frontend/js/lib/jquery.jeditable.js',
'frontend/js/lib/jquery.jeditable.autogrow.js',
'frontend/js/lib/jquery.snippet.js',
'frontend/js/lib/jquery.gritter.js',
'frontend/js/lib/jquery.slideto.min.js',
'frontend/js/lib/jquery.wiggle.min.js',
'frontend/js/lib/jquery.ba-bbq.min.js',
'frontend/js/lib/handlebars-1.0.rc.1.js',
'frontend/js/lib/underscore.js',
'frontend/js/lib/backbone.js',
'frontend/js/lib/d3.v3.js',
'frontend/js/lib/nv.d3.js',
'frontend/js/lib/d3.fisheye.js',
'frontend/js/lib/ejs_0.9_alpha_1_production.js',
'frontend/js/lib/ejs_fulljslint.js',
'frontend/js/lib/ColVis.js',
'frontend/js/lib/bootstrap.js',
'frontend/js/lib/bootstrap-pagination.js',
'frontend/src/ace.js',
'frontend/js/lib/jqconsole.min.js',
'frontend/js/lib/splitter.js',
'frontend/js/lib/swagger.js',
'frontend/js/lib/swagger-ui.js',
'frontend/js/lib/highlight.7.3.pack.js',
// arangodb
'frontend/js/arango/arango.js',
'frontend/js/arango/templateEngine.js',
'frontend/js/shell/browser.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',
'frontend/js/modules/org/arangodb/arango-query-cursor.js',
'frontend/js/modules/org/arangodb/arango-statement-common.js',
'frontend/js/modules/org/arangodb/arango-statement.js',
'frontend/js/modules/org/arangodb/arangosh.js',
'frontend/js/modules/org/arangodb/graph-common.js',
'frontend/js/modules/org/arangodb/graph.js',
'frontend/js/modules/org/arangodb/mimetypes.js',
'frontend/js/modules/org/arangodb/simple-query-common.js',
'frontend/js/modules/org/arangodb/simple-query.js',
'frontend/js/modules/org/arangodb/aql/functions.js',
'frontend/js/modules/org/arangodb/graph/traversal.js',
'frontend/js/modules/org/arangodb-common.js',
'frontend/js/modules/org/arangodb.js',
'frontend/js/bootstrap/errors.js',
'frontend/js/bootstrap/monkeypatches.js',
'frontend/js/bootstrap/module-internal.js',
'frontend/js/client/bootstrap/module-internal.js',
'frontend/js/client/client.js',
// Mocks
'test/mocks/disableEJS.js',
// Models
'frontend/js/models/arangoCollection.js',
'frontend/js/models/arangoDatabase.js',
'frontend/js/models/arangoDocument.js',
'frontend/js/models/arangoLog.js',
'frontend/js/models/arangoStatistics.js',
'frontend/js/models/arangoStatisticsDescription.js',
'frontend/js/models/foxx.js',
// Collections
'frontend/js/collections/arangoCollections.js',
'frontend/js/collections/arangoDocuments.js',
'frontend/js/collections/arangoDocument.js',
'frontend/js/collections/arangoDatabase.js',
'frontend/js/collections/arangoLogs.js',
'frontend/js/collections/arangoStatisticsCollection.js',
'frontend/js/collections/arangoStatisticsDescriptionCollection.js',
'frontend/js/collections/foxxCollection.js',
// Views
'frontend/js/views/navigationView.js',
'frontend/js/views/footerView.js',
'frontend/js/views/queryView.js',
'frontend/js/views/shellView.js',
'frontend/js/views/aboutView.js',
'frontend/js/views/dashboardView.js',
'frontend/js/views/collectionsView.js',
'frontend/js/views/collectionView.js',
'frontend/js/views/newCollectionView.js',
'frontend/js/views/collectionsItemView.js',
'frontend/js/views/documentsView.js',
'frontend/js/views/documentView.js',
'frontend/js/views/documentSourceView.js',
'frontend/js/views/logsView.js',
'frontend/js/views/foxxActiveView.js',
'frontend/js/views/foxxActiveListView.js',
'frontend/js/views/foxxInstalledView.js',
'frontend/js/views/foxxInstalledListView.js',
'frontend/js/views/foxxEditView.js',
'frontend/js/views/foxxMountView.js',
'frontend/js/views/appDocumentationView.js',
'frontend/js/views/graphView.js',
'frontend/js/views/dbSelectionView.js',
//Templates
{pattern: 'frontend/js/templates/*.ejs', served:true, included:false, watched: true},
// Specs
'test/specs/arango/arangoSpec.js',
'test/specs/views/aboutViewSpec.js',
'test/specs/views/collectionViewSpec.js',
'test/specs/views/collectionsViewSpec.js',
'test/specs/views/foxxEditViewSpec.js',
'test/specs/views/dbSelectionViewSpec.js',
'test/specs/views/graphViewSpec.js',
'test/specJSLint/jsLintSpec.js'
],
// list of files to exclude
exclude: [
],
// test results reporter to use
// possible values: 'dots', 'progress', 'junit', 'growl', 'coverage'
reporters: ['progress'],
// web server port
port: 9876,
// cli runner port
runnerPort: 9100,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: karma.LOG_DISABLE || karma.LOG_ERROR || karma.LOG_WARN || karma.LOG_INFO || karma.LOG_DEBUG
logLevel: karma.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
// Start these browsers, currently available:
// - Chrome
// - ChromeCanary
// - Firefox
// - Opera
// - Safari (only Mac)
// - PhantomJS
// - IE (only Windows)
browsers: [],
// If browser does not capture in given timeout [ms], kill it
captureTimeout: 60000,
// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun: false
});
};

View File

@ -1,68 +1,78 @@
describe('JSLint', function () {
var options = {},
lint = /^\/specJSLint|.jsLintSpec\.js$/;
/*jslint indent: 2, nomen: true, maxlen: 100, white: true plusplus: true */
/*global beforeEach, afterEach */
/*global describe, it, expect, jasmine, spyOn*/
/*global waitsFor, runs, waits */
/*global _, JSLINT*/
/*global document*/
function get(path) {
path = path + "?" + new Date().getTime();
(function () {
"use strict";
describe('JSLint', function () {
var options = {},
lint = /^\/specJSLint|[\w\W]jsLintSpec\.js$/;
var xhr;
try {
xhr = new jasmine.XmlHttpRequest();
xhr.open("GET", path, false);
xhr.send(null);
} catch (e) {
throw new Error("couldn't fetch " + path + ": " + e);
}
if (xhr.status < 200 || xhr.status > 299) {
throw new Error("Could not load '" + path + "'.");
}
function get(path) {
path = path + "?" + new Date().getTime();
return xhr.responseText;
}
describe('checking codeFiles', function() {
var files = /^(.*lib\/.*)|(.*Spec\.js)$/;
_.each(document.getElementsByTagName('script'), function (element) {
var script = element.getAttribute('src');
if (files.test(script)) {
return;
var xhr;
try {
xhr = new jasmine.XmlHttpRequest();
xhr.open("GET", path, false);
xhr.send(null);
} catch (e) {
throw new Error("couldn't fetch " + path + ": " + e);
}
it(script, function () {
var self = this;
var source = get(script);
var result = JSLINT(source, options);
_.each(JSLINT.errors, function (error) {
self.addMatcherResult(new jasmine.ExpectationResult({
passed: false,
message: "line " + error.line + ' - ' + error.reason + ' - ' + error.evidence
}));
if (xhr.status < 200 || xhr.status > 299) {
throw new Error("Could not load '" + path + "'.");
}
return xhr.responseText;
}
describe('checking codeFiles', function() {
var files = /^([\w\W]*lib\/[\w\W]*)|([\w\W]*Spec\.js)$/;
_.each(document.getElementsByTagName('script'), function (element) {
var script = element.getAttribute('src');
if (script === null || files.test(script)) {
return;
}
it(script, function () {
var self = this,
source = get(script),
result = JSLINT(source, options);
_.each(JSLINT.errors, function (error) {
self.addMatcherResult(new jasmine.ExpectationResult({
passed: false,
message: "line " + error.line + ' - ' + error.reason + ' - ' + error.evidence
}));
});
expect(true).toBe(true); // force spec to show up if there are no errors
});
});
});
describe('checking specFiles', function() {
var files = /^\/spec*|[\w\W]*Spec\.js$/;
_.each(document.getElementsByTagName('script'), function (element) {
var script = element.getAttribute('src');
if (!files.test(script) || lint.test(script)) {
return;
}
it(script, function () {
var self = this,
source = get(script),
result = JSLINT(source, options);
_.each(JSLINT.errors, function (error) {
self.addMatcherResult(new jasmine.ExpectationResult({
passed: false,
message: "line " + error.line + ' - ' + error.reason + ' - ' + error.evidence
}));
});
expect(true).toBe(true); // force spec to show up if there are no errors
});
expect(true).toBe(true); // force spec to show up if there are no errors
});
});
});
describe('checking specFiles', function() {
var files = /^\/spec*|.*Spec\.js$/;
_.each(document.getElementsByTagName('script'), function (element) {
var script = element.getAttribute('src');
if (!files.test(script) || lint.test(script)) {
return;
}
it(script, function () {
var self = this;
var source = get(script);
var result = JSLINT(source, options);
_.each(JSLINT.errors, function (error) {
self.addMatcherResult(new jasmine.ExpectationResult({
passed: false,
message: "line " + error.line + ' - ' + error.reason + ' - ' + error.evidence
}));
});
expect(true).toBe(true); // force spec to show up if there are no errors
});
});
});
});
}());

View File

@ -1,33 +0,0 @@
/*jslint indent: 2, nomen: true, maxlen: 100, white: true plusplus: true */
/*global describe, it, expect, jasmine, spyOn*/
/*global $, d3*/
describe("About View", function() {
"use strict";
describe("Checking javascript types", function() {
it("type null", function() {
var dummy = arangoHelper.RealTypeOf(null);
expect(dummy).toBe('null');
});
it("type array", function() {
var dummy = arangoHelper.RealTypeOf([1,2,3]);
expect(dummy).toBe('array');
});
it("type date", function() {
var dummy = arangoHelper.RealTypeOf(new Date);
expect(dummy).toBe('date');
});
it("type regexp", function() {
var dummy = arangoHelper.RealTypeOf(new RegExp);
expect(dummy).toBe('regex');
});
});
});

View File

@ -1,43 +1,45 @@
/*jslint indent: 2, nomen: true, maxlen: 100, white: true plusplus: true */
/*global describe, it, expect, jasmine, spyOn*/
/*global $, d3*/
describe("Collection View", function() {
/*jslint indent: 2, nomen: true, maxlen: 100, white: true plusplus: true, browser: true*/
/*global describe, beforeEach, afterEach, it, spyOn, expect*/
/*global runs, waitsFor, jasmine*/
/*global $, arangoCollection*/
(function() {
"use strict";
var myView;
window.App = function() {};
window.App.navigate = function() {};
beforeEach(function() {
$('body').append('<div id="content" class="removeMe"></div>');
describe("Collection View", function() {
myView = new window.collectionView({
model: arangoCollection
});
var myView;
window.App = function() {};
window.App.navigate = function() {};
});
beforeEach(function() {
$('body').append('<div id="content" class="removeMe"></div>');
afterEach(function() {
$('.removeMe').remove();
});
describe("Collection Changes", function() {
it("Check if changes were submitted", function() {
var pressedEnter = false;
myView.render();
spyOn(myView, 'saveModifiedCollection').andCallFake(function(request) {
pressedEnter = true;
console.log("hasdhasd");
myView = new window.collectionView({
model: arangoCollection
});
myView.saveModifiedCollection();
expect(pressedEnter).toBeTruthy();
});
afterEach(function() {
$('.removeMe').remove();
});
});
});
describe("Collection Changes", function() {
it("Check if changes were submitted", function() {
var pressedEnter = false;
myView.render();
spyOn(myView, 'saveModifiedCollection').andCallFake(function(request) {
pressedEnter = true;
});
myView.saveModifiedCollection();
expect(pressedEnter).toBeTruthy();
});
});
});
}());

View File

@ -1,7 +1,7 @@
/*jslint indent: 2, nomen: true, maxlen: 100, white: true plusplus: true */
/*global describe, it, expect, jasmine, spyOn*/
/*global $, d3*/
/*jslint indent: 2, nomen: true, maxlen: 100, white: true plusplus: true, browser: true*/
/*global describe, beforeEach, afterEach, it, spyOn, expect*/
/*global runs, waitsFor, jasmine, waits*/
/*global $ */
describe("Collections View", function() {
"use strict";
@ -196,9 +196,7 @@ describe("Collections View", function() {
check = false;
return;
}
else {
check = true;
}
check = true;
});
expect(check).toBeTruthy();
});

View File

@ -0,0 +1,85 @@
/*jslint indent: 2, nomen: true, maxlen: 100, white: true plusplus: true, browser: true*/
/*global describe, beforeEach, afterEach, it, spyOn, expect*/
/*global _, $, DBSelectionView*/
(function() {
"use strict";
describe("DB Selection", function() {
var view,
list,
dbCollection,
current,
div;
beforeEach(function() {
dbCollection = new window.ArangoDatabase();
list = ["_system", "second", "first"];
current = "first";
_.each(list, function(n) {
dbCollection.add({name: n});
});
spyOn(dbCollection, "fetch");
spyOn(dbCollection, "getCurrentDatabase").andCallFake(
function() {
return current;
}
);
div = document.createElement("div");
div.id = "selectDB";
document.body.appendChild(div);
});
afterEach(function() {
document.body.removeChild(div);
});
it("should display all databases ordered", function() {
view = new DBSelectionView({collection: dbCollection});
view.render($("#selectDB"));
var select = $(div).children()[0],
childs;
expect(div.childElementCount).toEqual(1);
childs = $(select).children();
expect(childs.length).toEqual(3);
expect(childs[0].id).toEqual(list[0]);
expect(childs[1].id).toEqual(list[2]);
expect(childs[2].id).toEqual(list[1]);
});
it("should select the current db", function() {
view = new DBSelectionView({collection: dbCollection});
view.render($("#selectDB"));
expect($(div).find(":selected").attr("id")).toEqual(current);
});
it("should trigger fetch on collection", function() {
view = new DBSelectionView({collection: dbCollection});
expect(dbCollection.fetch).toHaveBeenCalled();
});
it("should trigger a database switch on click", function() {
view = new DBSelectionView({collection: dbCollection});
view.render($("#selectDB"));
spyOn(dbCollection, "createDatabaseURL").andReturn("switchURL");
spyOn(location, "replace");
$("#dbSelectionList").val("second").trigger("change");
expect(dbCollection.createDatabaseURL).toHaveBeenCalledWith("second");
expect(location.replace).toHaveBeenCalledWith("switchURL");
});
it("should not render if the list has only one element", function() {
var oneCollection = new window.ArangoDatabase();
oneCollection.add({name: current});
spyOn(oneCollection, "getCurrentDatabase").andCallFake(
function() {
return current;
}
);
view = new DBSelectionView({collection: oneCollection});
view.render($("#selectDB"));
expect($(div).text().trim()).toEqual("");
});
});
}());

View File

@ -0,0 +1,123 @@
/*jslint indent: 2, nomen: true, maxlen: 100, white: true plusplus: true, browser: true*/
/*global describe, beforeEach, afterEach, it, spyOn, expect*/
/*global runs, waitsFor, jasmine*/
/*global $, arangoHelper */
(function() {
"use strict";
describe("Foxx Edit View", function() {
var view,
model,
div;
beforeEach(function() {
div = document.createElement("div");
div.id = "modalPlaceholder";
document.body.appendChild(div);
model = new window.Foxx({
_key: "1234",
_id: "aal/1234",
title: "TestFoxx",
version: 1.2,
mount: "/testfoxx",
description: "Test application",
git: "gitpath",
app: "app:TestFoxx:1.2",
isSystem: false,
options: {
collectionPrefix: "testfoxx"
},
development: false
});
view = new window.foxxEditView({model: model});
view.render();
});
afterEach(function() {
document.body.removeChild(div);
});
it("should be able to switch mount point", function() {
var calledBack,
newMount;
runs(function() {
newMount = "/newMount";
spyOn($, "ajax").andCallFake(function(url, options) {
calledBack = true;
});
$("#change-mount-point").val(newMount);
$("#change").click();
});
waitsFor(function() {
return calledBack;
}, 1000);
runs(function() {
expect($.ajax).toHaveBeenCalledWith(
"foxx/move/" + model.get("_key"),{
dataType: "json",
data: JSON.stringify({
mount: newMount,
app: model.get("app"),
prefix: model.get("options").collectionPrefix
}),
async: false,
type: "PUT",
error: jasmine.any(Function)
});
});
});
it("should not hide the modal view if mountpoint change has failed", function() {
var calledBack,
newMount,
resText;
runs(function() {
newMount = "/newMount";
resText = "Mount-Point already in use";
spyOn($, "ajax").andCallFake(function(url, options) {
expect(options.error).toEqual(jasmine.any(Function));
options.error(
{
status: 409,
statusText: "Conflict",
responseText: resText
}
);
calledBack = true;
});
spyOn(view, "hideModal");
spyOn(arangoHelper, "arangoError");
$("#change-mount-point").val(newMount);
$("#change").click();
});
waitsFor(function() {
return calledBack;
}, 1000);
runs(function() {
expect(view.hideModal).not.toHaveBeenCalled();
expect(arangoHelper.arangoError).toHaveBeenCalledWith(resText);
});
});
it("should not trigger a remount if mountpoint has not been changed", function() {
spyOn(window, "alert");
$("#change").click();
expect(window.alert).not.toHaveBeenCalled();
});
it("should prevent an illegal mountpoint", function() {
spyOn(window, "alert");
$("#change-mount-point").val("illegal");
$("#change").click();
expect(window.alert).toHaveBeenCalled();
});
});
}());

View File

@ -0,0 +1,20 @@
/*jslint indent: 2, nomen: true, maxlen: 100, white: true plusplus: true, browser: true*/
/*global describe, beforeEach*/
(function() {
"use strict";
describe("Graph View", function() {
var view,
div;
beforeEach(function() {
div = document.createElement("div");
div.id = "content";
});
});
}());