mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-05-29 14:35:18 -04:00
Fix a lot eslint errors.
This commit is contained in:
parent
0c6143704a
commit
39ea94daa8
88 changed files with 3872 additions and 4930 deletions
|
@ -1,105 +1,83 @@
|
|||
(function () {
|
||||
'use strict';
|
||||
var ID = 'view/root';
|
||||
var DEPS = ['$'];
|
||||
|
||||
var ID = 'view/root';
|
||||
var DEPS = ['$'];
|
||||
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.applyFn = function () {
|
||||
|
||||
return this.definition.fn($);
|
||||
};
|
||||
});
|
||||
|
||||
after(function () {
|
||||
|
||||
util.restoreHtml();
|
||||
});
|
||||
|
||||
beforeEach(function () {
|
||||
|
||||
util.restoreHtml();
|
||||
$('<div id="fallback"/>').appendTo('body');
|
||||
$('<div id="fallback-hints"/>').appendTo('body');
|
||||
});
|
||||
|
||||
describe('definition', function () {
|
||||
|
||||
it('is defined', function () {
|
||||
|
||||
assert.isPlainObject(this.definition);
|
||||
this.applyFn = function () {
|
||||
return this.definition.fn($);
|
||||
};
|
||||
});
|
||||
|
||||
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();
|
||||
$('<div id="fallback"/>').appendTo('body');
|
||||
$('<div id="fallback-hints"/>').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 id root to body', function () {
|
||||
this.applyFn();
|
||||
assert.strictEqual($('body').attr('id'), 'root');
|
||||
});
|
||||
|
||||
it('removes HTML #fallback', function () {
|
||||
this.applyFn();
|
||||
assert.lengthOf($('#fallback'), 0);
|
||||
});
|
||||
|
||||
it('removes HTML #fallback-hints', function () {
|
||||
this.applyFn();
|
||||
assert.lengthOf($('#fallback-hints'), 0);
|
||||
});
|
||||
});
|
||||
|
||||
it('inits without errors', function () {
|
||||
|
||||
this.applyFn();
|
||||
describe('.$el', function () {
|
||||
it('is $(\'#root\')', 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'), 'root');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('application', function () {
|
||||
|
||||
it('returns object with 1 property', function () {
|
||||
|
||||
var instance = this.applyFn();
|
||||
assert.isPlainObject(instance);
|
||||
assert.lengthOfKeys(instance, 1);
|
||||
});
|
||||
|
||||
it('adds id root to body', function () {
|
||||
|
||||
this.applyFn();
|
||||
assert.strictEqual($('body').attr('id'), 'root');
|
||||
});
|
||||
|
||||
it('removes HTML #fallback', function () {
|
||||
|
||||
this.applyFn();
|
||||
assert.lengthOf($('#fallback'), 0);
|
||||
});
|
||||
|
||||
it('removes HTML #fallback-hints', function () {
|
||||
|
||||
this.applyFn();
|
||||
assert.lengthOf($('#fallback-hints'), 0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('.$el', function () {
|
||||
|
||||
it('is $(\'#root\')', 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'), 'root');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
}());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue