JS VisibleTo module

This commit is contained in:
Rei
2014-01-16 18:33:30 +08:00
parent 096f01cf36
commit cc25b80874
7 changed files with 62 additions and 22 deletions

View File

@@ -10,7 +10,7 @@ test 'should update votes', ->
</ul
")
Posts.updateVotes([
campo.Posts.updateVotes([
{ post_id: 1, value: 'up' }
{ post_id: 2, value: 'down' }
])

View File

@@ -0,0 +1,25 @@
module('visible-to')
test 'should keep element for user if logined', ->
$fixture = $('#qunit-fixture')
$fixture.append("
<div data-visible-to='user'></div>
")
campo.currentUser = { id: 1 }
campo.VisibleTo.check()
ok($fixture.find('div').length)
# clear
campo.currentUser = null
test 'should remove element for user if logined', ->
$fixture = $('#qunit-fixture')
$fixture.append("
<div data-visible-to='user'></div>
")
campo.VisibleTo.check()
ok(!$fixture.find('div').length)