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
7d8f7d5c
authored
2012-07-21 17:07:59 -0700
by
Michael Richards
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Add specs for Rivets.Binding::formattedValue().
1 parent
19a39894
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
0 deletions
spec/rivets/binding.js
spec/rivets/binding.js
View file @
7d8f7d5
...
...
@@ -63,4 +63,29 @@ describe('Rivets.Binding', function() {
});
});
});
describe
(
'formattedValue()'
,
function
()
{
it
(
'applies the current formatters on the supplied value'
,
function
()
{
rivets
.
config
.
formatters
=
{
awesome
:
function
(
value
)
{
return
'awesome '
+
value
}
};
binding
.
formatters
.
push
(
'awesome'
);
expect
(
binding
.
formattedValue
(
'hat'
)).
toBe
(
'awesome hat'
);
});
describe
(
'with a multi-argument formatter string'
,
function
()
{
beforeEach
(
function
()
{
rivets
.
config
.
formatters
=
{
awesome
:
function
(
value
,
prefix
)
{
return
prefix
+
' awesome '
+
value
;
}
};
binding
.
formatters
.
push
(
'awesome super'
);
});
it
(
'applies the formatter with arguments'
,
function
()
{
expect
(
binding
.
formattedValue
(
'jacket'
)).
toBe
(
'super awesome jacket'
);
});
});
});
});
...
...
Please
register
or
sign in
to post a comment