mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-05-25 12:34:47 -04:00
Refactor code.
This commit is contained in:
parent
16186811a4
commit
167e30dee1
4 changed files with 10 additions and 10 deletions
|
@ -3,6 +3,6 @@ modulejs.define('core/settings', ['_', 'config'], function (_, config) {
|
|||
return _.extend({}, config.options, {
|
||||
appHref: config.setup.APP_HREF,
|
||||
rootHref: config.setup.ROOT_HREF,
|
||||
currentHref: config.setup.CURRENT_HREF
|
||||
version: config.setup.VERSION
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
modulejs.define('view/topbar', ['$', 'config', 'view/root'], function ($, config, root) {
|
||||
modulejs.define('view/topbar', ['$', 'core/settings', 'view/root'], function ($, settings, root) {
|
||||
|
||||
var template =
|
||||
'<div id="topbar">' +
|
||||
'<div id="toolbar"/>' +
|
||||
'<div id="flowbar"/>' +
|
||||
'<a id="backlink" href="http://larsjung.de/h5ai/" title="powered by h5ai ' + config.setup.VERSION + '">' +
|
||||
'<a id="backlink" href="http://larsjung.de/h5ai/" title="powered by h5ai ' + settings.version + '">' +
|
||||
'<div>powered</div>' +
|
||||
'<div>by h5ai</div>' +
|
||||
'</a>' +
|
||||
|
|
|
@ -19,7 +19,7 @@ describe('module \'' + ID + '\'', function () {
|
|||
setup: {
|
||||
APP_HREF: util.uniqId(),
|
||||
ROOT_HREF: util.uniqId(),
|
||||
CURRENT_HREF: util.uniqId()
|
||||
VERSION: util.uniqId()
|
||||
}
|
||||
};
|
||||
this.applyFn = function () {
|
||||
|
@ -101,12 +101,12 @@ describe('module \'' + ID + '\'', function () {
|
|||
});
|
||||
});
|
||||
|
||||
describe('.currentHref', function () {
|
||||
describe('.version', function () {
|
||||
|
||||
it('set correct', function () {
|
||||
|
||||
var instance = this.applyFn();
|
||||
assert.strictEqual(instance.currentHref, this.xConfig.setup.CURRENT_HREF);
|
||||
assert.strictEqual(instance.version, this.xConfig.setup.VERSION);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
'use strict';
|
||||
|
||||
var ID = 'view/topbar';
|
||||
var DEPS = ['$', 'config', 'view/root'];
|
||||
var DEPS = ['$', 'core/settings', 'view/root'];
|
||||
|
||||
describe('module \'' + ID + '\'', function () {
|
||||
|
||||
|
@ -10,11 +10,11 @@ describe('module \'' + ID + '\'', function () {
|
|||
|
||||
this.definition = modulejs._private.definitions[ID];
|
||||
|
||||
this.xConfig = {setup: {VERSION: util.uniqId()}};
|
||||
this.xSettings = {version: util.uniqId()};
|
||||
this.xRoot = {$el: null};
|
||||
this.applyFn = function () {
|
||||
|
||||
return this.definition.fn($, this.xConfig, this.xRoot);
|
||||
return this.definition.fn($, this.xSettings, this.xRoot);
|
||||
};
|
||||
});
|
||||
|
||||
|
@ -104,7 +104,7 @@ describe('module \'' + ID + '\'', function () {
|
|||
it('#backlink has correct title', function () {
|
||||
|
||||
this.applyFn();
|
||||
assert.strictEqual($('#backlink').attr('title'), 'powered by h5ai ' + this.xConfig.setup.VERSION);
|
||||
assert.strictEqual($('#backlink').attr('title'), 'powered by h5ai ' + this.xSettings.version);
|
||||
});
|
||||
|
||||
it('#backlink has correct text', function () {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue