-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtests.js
34 lines (25 loc) · 1.08 KB
/
tests.js
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
describe('To-Do App Tests', function() {
describe('Add Item Function', function() {
beforeEach(function() {
$('body')
.append('<input id="itemEntry" value="Test item">')
.append('<ul id="items">');
app.init();
});
it('should add styled items to the list', function() {
var spyV = sinon.spy(app.update, 'visibility'),
spyR = sinon.spy(app.update, 'remaining'),
event = jQuery.Event('keydown', { 'which': 13 });
console.log(JSON.stringify(event));
$('#itemEntry').trigger(event);
var $todo = $('.todo');
expect($todo.length).to.equal(1);
expect($todo.find('toDoText').text()).to.equal('Test item');
expect(spyV.callCount).to.equal(1);
expect(spyR.callCount).to.equal(1);
});
afterEach(function() {
$('#itemEntry, #items').remove();
});
});
});