forked from GetmeUK/ContentTools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflashes.coffee
More file actions
60 lines (39 loc) · 1.71 KB
/
Copy pathflashes.coffee
File metadata and controls
60 lines (39 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# FlashUI
describe 'ContentTools.FlashUI', () ->
div = null
editor = null
beforeEach ->
# Create an editable region
div = document.createElement('div')
div.setAttribute('class', 'editable')
document.body.appendChild(div)
# Initialize the editor
editor = ContentTools.EditorApp.get()
editor.init('.editable')
afterEach ->
# Shutdown the editor
editor.destroy()
# Remove the editable region
document.body.removeChild(div)
describe 'ContentTools.FlashUI()', () ->
it 'should return an instance of a FlashUI', () ->
flash = new ContentTools.FlashUI('ok')
expect(flash instanceof ContentTools.FlashUI).toBe true
it 'should mount the component', () ->
flash = new ContentTools.FlashUI('ok')
expect(flash.isMounted()).toBe true
it 'should unmount the component after X seconds', (done) ->
flash = new ContentTools.FlashUI('ok')
checkUnmounted = () ->
expect(flash.isMounted()).toBe false
done()
setTimeout(checkUnmounted, 500)
describe 'ContentTools.FlashUI.mount()', () ->
it 'should mount the component and apply the specified modifier', () ->
# `mount` is called with the specified modifier in the constructor
flash = new ContentTools.FlashUI('ok')
expect(flash.isMounted()).toBe true
# Get a list of classes against the class and check the specified
# modifier is one of them.
classes = flash.domElement().getAttribute('class').split(' ')
expect(classes.indexOf('ct-flash--ok') > -1).toBe true