mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-08-14 01:44:06 +02:00
Replace modernizr with custom setup.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
'use strict';
|
||||
|
||||
var ID = 'core/location';
|
||||
var DEPS = ['_', 'modernizr', 'core/event', 'core/settings', 'view/notification'];
|
||||
var DEPS = ['_', 'core/event', 'core/modernizr', 'core/settings', 'view/notification'];
|
||||
|
||||
describe('module \'' + ID + '\'', function () {
|
||||
|
||||
@@ -30,7 +30,7 @@ describe('module \'' + ID + '\'', function () {
|
||||
this.xEvent.sub.reset();
|
||||
this.xNotification.set.reset();
|
||||
|
||||
return this.definition.fn(_, this.xModernizr, this.xEvent, this.xSettings, this.xNotification);
|
||||
return this.definition.fn(_, this.xEvent, this.xModernizr, this.xSettings, this.xNotification);
|
||||
};
|
||||
});
|
||||
|
||||
|
90
test/tests/unit/core/modernizr.js
Normal file
90
test/tests/unit/core/modernizr.js
Normal file
@@ -0,0 +1,90 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var ID = 'core/modernizr';
|
||||
var DEPS = [];
|
||||
|
||||
describe('module \'' + ID + '\'', function () {
|
||||
|
||||
before(function () {
|
||||
|
||||
this.definition = modulejs._private.definitions[ID];
|
||||
|
||||
this.applyFn = function () {
|
||||
|
||||
return this.definition.fn();
|
||||
};
|
||||
});
|
||||
|
||||
describe('definition', function () {
|
||||
|
||||
it('is defined', function () {
|
||||
|
||||
assert.isPlainObject(this.definition);
|
||||
});
|
||||
|
||||
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();
|
||||
});
|
||||
});
|
||||
|
||||
describe('application', function () {
|
||||
|
||||
it('returns plain object with 3 properties', function () {
|
||||
|
||||
var instance = this.applyFn();
|
||||
assert.isPlainObject(instance);
|
||||
assert.lengthOf(_.keys(instance), 3);
|
||||
});
|
||||
});
|
||||
|
||||
describe('.canvas', function () {
|
||||
|
||||
it('is boolean', function () {
|
||||
|
||||
var instance = this.applyFn();
|
||||
assert.isBoolean(instance.canvas);
|
||||
});
|
||||
});
|
||||
|
||||
describe('.history', function () {
|
||||
|
||||
it('is boolean', function () {
|
||||
|
||||
var instance = this.applyFn();
|
||||
assert.isBoolean(instance.history);
|
||||
});
|
||||
});
|
||||
|
||||
describe('.localstorage', function () {
|
||||
|
||||
it('is boolean', function () {
|
||||
|
||||
var instance = this.applyFn();
|
||||
assert.isBoolean(instance.localstorage);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
}());
|
@@ -2,7 +2,7 @@
|
||||
'use strict';
|
||||
|
||||
var ID = 'core/store';
|
||||
var DEPS = ['modernizr'];
|
||||
var DEPS = ['core/modernizr'];
|
||||
|
||||
describe('module \'' + ID + '\'', function () {
|
||||
|
||||
|
@@ -7,7 +7,6 @@ describe('libs', function () {
|
||||
_: window._,
|
||||
$: window.jQuery,
|
||||
marked: window.marked,
|
||||
modernizr: window.Modernizr,
|
||||
prism: window.Prism
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user