Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
brainfood
/
rivets
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
14b3c772
authored
2013-01-11 20:18:16 -0800
by
Michael Richards
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge pull request #111 from terrancesnyder/Issue#110
Pull request for #110
2 parents
835f5406
36de3dba
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
0 deletions
spec/rivets/functional.js
src/rivets.coffee
spec/rivets/functional.js
View file @
14b3c77
...
...
@@ -116,6 +116,12 @@ describe('Functional', function() {
expect
(
el
.
getElementsByTagName
(
'li'
).
length
).
toBe
(
2
);
});
it
(
'should not fail if the collection being bound to is null'
,
function
()
{
data
.
set
({
items
:
null
});
rivets
.
bind
(
el
,
bindData
);
expect
(
el
.
getElementsByTagName
(
'li'
).
length
).
toBe
(
0
);
});
it
(
'should re-loop over the collection and create new instances when the array changes'
,
function
()
{
rivets
.
bind
(
el
,
bindData
);
expect
(
el
.
getElementsByTagName
(
'li'
).
length
).
toBe
(
2
);
...
...
@@ -162,6 +168,7 @@ describe('Functional', function() {
expect
(
el
.
getElementsByTagName
(
'li'
)[
2
]).
toHaveTheTextContent
(
'b'
);
expect
(
el
.
getElementsByTagName
(
'li'
)[
3
]).
toHaveTheTextContent
(
'last'
);
})
});
});
...
...
src/rivets.coffee
View file @
14b3c77
...
...
@@ -339,6 +339,7 @@ Rivets.binders =
@
iterated
=
[]
if
collection
for
item
in
collection
data
=
{}
data
[
n
]
=
m
for
n
,
m
of
@
view
.
models
...
...
Please
register
or
sign in
to post a comment