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
71bab2f6
authored
2012-08-02 21:52:48 -0700
by
Michael Richards
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Add initial spec for binding with dependent attributes.
1 parent
29c04023
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
2 deletions
spec/rivets/binding.js
spec/rivets/binding.js
View file @
71bab2f
...
...
@@ -26,7 +26,7 @@ describe('Rivets.Binding', function() {
it
(
'subscribes to the model for changes via the adapter'
,
function
()
{
spyOn
(
rivets
.
config
.
adapter
,
'subscribe'
);
binding
.
bind
();
expect
(
rivets
.
config
.
adapter
.
subscribe
).
toHaveBeenCalled
(
);
expect
(
rivets
.
config
.
adapter
.
subscribe
).
toHaveBeenCalled
With
(
model
,
'name'
,
binding
.
set
);
});
describe
(
'with preloadData set to true'
,
function
()
{
...
...
@@ -38,8 +38,8 @@ describe('Rivets.Binding', function() {
spyOn
(
binding
,
'set'
);
spyOn
(
rivets
.
config
.
adapter
,
'read'
);
binding
.
bind
();
expect
(
rivets
.
config
.
adapter
.
read
).
toHaveBeenCalledWith
(
model
,
'name'
);
expect
(
binding
.
set
).
toHaveBeenCalled
();
expect
(
rivets
.
config
.
adapter
.
read
).
toHaveBeenCalled
();
});
});
...
...
@@ -55,6 +55,19 @@ describe('Rivets.Binding', function() {
expect
(
binding
.
set
).
toHaveBeenCalledWith
(
'espresso'
);
});
});
describe
(
'with dependencies'
,
function
()
{
beforeEach
(
function
()
{
binding
.
options
.
dependencies
=
[
'fname'
,
'lname'
];
});
it
(
'sets up observers on the dependant attributes'
,
function
()
{
spyOn
(
rivets
.
config
.
adapter
,
'subscribe'
);
binding
.
bind
();
expect
(
rivets
.
config
.
adapter
.
subscribe
).
toHaveBeenCalledWith
(
model
,
'fname'
,
binding
.
dependencyCallbacks
[
'fname'
]);
expect
(
rivets
.
config
.
adapter
.
subscribe
).
toHaveBeenCalledWith
(
model
,
'lname'
,
binding
.
dependencyCallbacks
[
'lname'
]);
});
});
});
describe
(
'set()'
,
function
()
{
...
...
Please
register
or
sign in
to post a comment