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
cb840c20
authored
2012-07-25 12:18:36 +1000
by
Paul Jones
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Default to an empty string for undefined value bindings
1 parent
35e7049b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
1 deletions
spec/rivets/routines.js
src/rivets.coffee
spec/rivets/routines.js
View file @
cb840c2
...
...
@@ -37,6 +37,11 @@ describe('Routines', function() {
rivets
.
routines
.
value
(
input
,
'pitchfork'
);
expect
(
input
.
value
).
toBe
(
'pitchfork'
);
});
it
(
"applies a default value to the element when the model doesn't contain it"
,
function
()
{
rivets
.
routines
.
value
(
input
,
undefined
);
expect
(
input
.
value
).
toBe
(
''
);
});
});
describe
(
'show'
,
function
()
{
...
...
src/rivets.coffee
View file @
cb840c2
...
...
@@ -174,7 +174,7 @@ Rivets.routines =
html
:
(
el
,
value
)
->
el
.
innerHTML
=
value
or
''
value
:
(
el
,
value
)
->
el
.
value
=
value
el
.
value
=
value
or
''
text
:
(
el
,
value
)
->
if
el
.
innerText
?
el
.
innerText
=
value
or
''
...
...
Please
register
or
sign in
to post a comment