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
1594f8c0
authored
2012-08-10 10:36:26 +0200
by
Nicklas Ansman Giertz
Committed by
Michael Richards
2012-08-10 02:36:00 -0700
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Use the model as context when calling methods on objects
1 parent
44468934
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
1 deletions
spec/rivets/binding.js
src/rivets.coffee
spec/rivets/binding.js
View file @
1594f8c
...
...
@@ -85,6 +85,13 @@ describe('Rivets.Binding', function() {
expect
(
binding
.
routine
).
toHaveBeenCalledWith
(
el
,
'awesome sweater'
);
});
it
(
'calls methods with the object as context'
,
function
()
{
binding
.
model
=
{
foo
:
'bar'
};
spyOn
(
binding
,
'routine'
);
binding
.
set
(
function
()
{
return
this
.
foo
;
});
expect
(
binding
.
routine
).
toHaveBeenCalledWith
(
el
,
binding
.
model
.
foo
);
});
describe
(
'on an event binding'
,
function
()
{
beforeEach
(
function
()
{
binding
.
options
.
special
=
'event'
;
...
...
src/rivets.coffee
View file @
1594f8c
...
...
@@ -48,7 +48,7 @@ class Rivets.Binding
@
routine
@
el
,
value
,
@
currentListener
@
currentListener
=
value
else
value
=
value
(
)
if
value
instanceof
Function
value
=
value
.
call
(
@
model
)
if
value
instanceof
Function
@
routine
@
el
,
value
# Subscribes to the model for changes at the specified keypath. Bi-directional
...
...
Please
register
or
sign in
to post a comment