load indicator module
This commit is contained in:
parent
cbe68047f5
commit
75b3d0adc9
6 changed files with 95 additions and 34 deletions
44
test/view/load-indicator.test.js
Normal file
44
test/view/load-indicator.test.js
Normal file
|
@ -0,0 +1,44 @@
|
|||
let assert = require('chai').assert
|
||||
let LoadIndicator = require('../../app/view/load-indicator')
|
||||
|
||||
describe('#loadIndicator()', function () {
|
||||
|
||||
it('should render on init', function () {
|
||||
let indicator = new LoadIndicator()
|
||||
assert.equal(indicator.el.outerHTML
|
||||
, '<div id="cb-loading-overlay" class="cb-control" style="display: none; "></div>')
|
||||
})
|
||||
|
||||
it('should show', function () {
|
||||
let indicator = new LoadIndicator()
|
||||
assert.equal(indicator.el.style.display, 'none')
|
||||
indicator.show()
|
||||
assert.equal(indicator.el.style.display, 'block')
|
||||
})
|
||||
|
||||
it('should hide', function () {
|
||||
let indicator = new LoadIndicator()
|
||||
indicator.show()
|
||||
indicator.hide()
|
||||
assert.equal(indicator.el.style.display, 'none')
|
||||
})
|
||||
|
||||
it('should emit a "show" event', function (done) {
|
||||
let indicator = new LoadIndicator()
|
||||
indicator.on('show', function (e) {
|
||||
assert.deepEqual(indicator, e)
|
||||
done()
|
||||
})
|
||||
indicator.show()
|
||||
})
|
||||
|
||||
it('should emit a "hide" event', function (done) {
|
||||
let indicator = new LoadIndicator()
|
||||
indicator.on('hide', function (e) {
|
||||
assert.deepEqual(indicator, e)
|
||||
done()
|
||||
})
|
||||
indicator.hide()
|
||||
})
|
||||
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue