mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-08-08 14:56:35 +02:00
Refactor notifications.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
'use strict';
|
||||
|
||||
var ID = 'core/location';
|
||||
var DEPS = ['_', 'modernizr', 'core/event', 'core/notify', 'core/settings'];
|
||||
var DEPS = ['_', 'modernizr', 'core/event', 'core/settings', 'view/notification'];
|
||||
|
||||
describe('module \'' + ID + '\'', function () {
|
||||
|
||||
@@ -21,16 +21,16 @@ describe('module \'' + ID + '\'', function () {
|
||||
pub: sinon.stub(),
|
||||
sub: sinon.stub()
|
||||
};
|
||||
this.xNotify = {
|
||||
this.xNotification = {
|
||||
set: sinon.stub()
|
||||
};
|
||||
this.applyFn = function () {
|
||||
|
||||
this.xEvent.pub.reset();
|
||||
this.xEvent.sub.reset();
|
||||
this.xNotify.set.reset();
|
||||
this.xNotification.set.reset();
|
||||
|
||||
return this.definition.fn(_, this.xModernizr, this.xEvent, this.xNotify, this.xSettings);
|
||||
return this.definition.fn(_, this.xModernizr, this.xEvent, this.xSettings, this.xNotification);
|
||||
};
|
||||
});
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var ID = 'core/notify';
|
||||
var ID = 'view/notification';
|
||||
var DEPS = ['$'];
|
||||
|
||||
describe('module \'' + ID + '\'', function () {
|
||||
@@ -71,9 +71,9 @@ describe('module \'' + ID + '\'', function () {
|
||||
it('adds HTML', function () {
|
||||
|
||||
this.applyFn();
|
||||
assert.lengthOf($('#notify'), 1);
|
||||
assert.lengthOf($('#notify:visible'), 0);
|
||||
assert.strictEqual($('#notify').text(), '');
|
||||
assert.lengthOf($('#notification'), 1);
|
||||
assert.lengthOf($('#notification:visible'), 0);
|
||||
assert.strictEqual($('#notification').text(), '');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -90,20 +90,20 @@ describe('module \'' + ID + '\'', function () {
|
||||
var instance = this.applyFn();
|
||||
|
||||
instance.set();
|
||||
assert.lengthOf($('#notify:visible'), 0);
|
||||
assert.strictEqual($('#notify').text(), '');
|
||||
assert.lengthOf($('#notification:visible'), 0);
|
||||
assert.strictEqual($('#notification').text(), '');
|
||||
|
||||
instance.set('hello');
|
||||
assert.lengthOf($('#notify:visible'), 1);
|
||||
assert.strictEqual($('#notify').text(), 'hello');
|
||||
assert.lengthOf($('#notification:visible'), 1);
|
||||
assert.strictEqual($('#notification').text(), 'hello');
|
||||
|
||||
instance.set('world');
|
||||
assert.lengthOf($('#notify:visible'), 1);
|
||||
assert.strictEqual($('#notify').text(), 'world');
|
||||
assert.lengthOf($('#notification:visible'), 1);
|
||||
assert.strictEqual($('#notification').text(), 'world');
|
||||
|
||||
instance.set();
|
||||
// assert.lengthOf($('#notify:visible'), 0);
|
||||
assert.strictEqual($('#notify').text(), 'world');
|
||||
// assert.lengthOf($('#notification:visible'), 0);
|
||||
assert.strictEqual($('#notification').text(), 'world');
|
||||
});
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user