Fix a lot eslint errors.

This commit is contained in:
Lars Jung 2015-11-18 23:16:58 +01:00
parent 0c6143704a
commit 39ea94daa8
88 changed files with 3872 additions and 4930 deletions

View file

@ -1,93 +1,73 @@
(function () {
'use strict';
var ID = 'view/mainrow';
var DEPS = ['$', 'view/root'];
var ID = 'view/mainrow';
var DEPS = ['$', 'view/root'];
describe('module \'' + ID + '\'', function () {
before(function () {
this.definition = modulejs._private.definitions[ID];
describe('module \'' + ID + '\'', function () {
before(function () {
this.definition = modulejs._private.definitions[ID];
this.xRoot = {$el: null};
this.applyFn = function () {
return this.definition.fn($, this.xRoot);
};
});
after(function () {
util.restoreHtml();
});
beforeEach(function () {
util.restoreHtml();
this.xRoot.$el = $('<div id="root"/>').appendTo('body');
});
describe('definition', function () {
it('is defined', function () {
assert.isPlainObject(this.definition);
this.xRoot = {$el: null};
this.applyFn = function () {
return this.definition.fn($, this.xRoot);
};
});
it('has correct id', function () {
assert.strictEqual(this.definition.id, ID);
after(function () {
util.restoreHtml();
});
it('requires correct', function () {
assert.deepEqual(this.definition.deps, DEPS);
beforeEach(function () {
util.restoreHtml();
this.xRoot.$el = $('<div id="root"/>').appendTo('body');
});
it('args for each request', function () {
describe('definition', function () {
it('is defined', function () {
assert.isPlainObject(this.definition);
});
assert.strictEqual(this.definition.deps.length, this.definition.fn.length);
it('has correct id', function () {
assert.strictEqual(this.definition.id, ID);
});
it('requires correct', function () {
assert.deepEqual(this.definition.deps, DEPS);
});
it('args for each request', function () {
assert.strictEqual(this.definition.deps.length, this.definition.fn.length);
});
it('has no instance', function () {
assert.notProperty(modulejs._private.instances, ID);
});
it('inits without errors', function () {
this.applyFn();
});
});
it('has no instance', function () {
describe('application', function () {
it('returns object with 1 property', function () {
var instance = this.applyFn();
assert.isPlainObject(instance);
assert.lengthOfKeys(instance, 1);
});
assert.notProperty(modulejs._private.instances, ID);
it('adds HTML #mainrow to #root', function () {
this.applyFn();
assert.lengthOf($('#root > #mainrow'), 1);
});
});
it('inits without errors', function () {
this.applyFn();
describe('.$el', function () {
it('is $(\'#mainrow\')', function () {
var instance = this.applyFn();
assert.isObject(instance.$el);
assert.lengthOf(instance.$el, 1);
assert.isString(instance.$el.jquery);
assert.strictEqual(instance.$el.attr('id'), 'mainrow');
});
});
});
describe('application', function () {
it('returns object with 1 property', function () {
var instance = this.applyFn();
assert.isPlainObject(instance);
assert.lengthOfKeys(instance, 1);
});
it('adds HTML #mainrow to #root', function () {
this.applyFn();
assert.lengthOf($('#root > #mainrow'), 1);
});
});
describe('.$el', function () {
it('is $(\'#mainrow\')', function () {
var instance = this.applyFn();
assert.isObject(instance.$el);
assert.lengthOf(instance.$el, 1);
assert.isString(instance.$el.jquery);
assert.strictEqual(instance.$el.attr('id'), 'mainrow');
});
});
});
}());