Add initial set of isolated unit tests for the binding routines.
Showing
1 changed file
with
25 additions
and
0 deletions
... | @@ -50,6 +50,31 @@ describe('Rivets', function() { | ... | @@ -50,6 +50,31 @@ describe('Rivets', function() { |
50 | }); | 50 | }); |
51 | }); | 51 | }); |
52 | 52 | ||
53 | describe('Routines', function() { | ||
54 | describe('text', function() { | ||
55 | it("sets the element's text content", function() { | ||
56 | rivets.routines.text(el, '<em>gluten-free</em>'); | ||
57 | expect(el.textContent || el.innerText).toBe('<em>gluten-free</em>'); | ||
58 | expect(el.innerHTML).toBe('<em>gluten-free</em>'); | ||
59 | }); | ||
60 | }); | ||
61 | |||
62 | describe('html', function() { | ||
63 | it("sets the element's HTML content", function() { | ||
64 | rivets.routines.html(el, '<strong>fixie</strong>'); | ||
65 | expect(el.textContent || el.innerText).toBe('fixie'); | ||
66 | expect(el.innerHTML).toBe('<strong>fixie</strong>'); | ||
67 | }); | ||
68 | }); | ||
69 | |||
70 | describe('value', function() { | ||
71 | it("sets the element's value", function() { | ||
72 | rivets.routines.value(input, 'pitchfork'); | ||
73 | expect(input.value).toBe('pitchfork'); | ||
74 | }); | ||
75 | }); | ||
76 | }); | ||
77 | |||
53 | describe('Binds', function() { | 78 | describe('Binds', function() { |
54 | describe('Text', function() { | 79 | describe('Text', function() { |
55 | it('should set the text content of the element', function() { | 80 | it('should set the text content of the element', function() { | ... | ... |
-
Please register or sign in to post a comment