mirror of
https://github.com/zhigang1992/tsemple.git
synced 2026-04-28 20:55:23 +08:00
JS VisibleTo module
This commit is contained in:
@@ -10,7 +10,7 @@ test 'should update votes', ->
|
||||
</ul
|
||||
")
|
||||
|
||||
Posts.updateVotes([
|
||||
campo.Posts.updateVotes([
|
||||
{ post_id: 1, value: 'up' }
|
||||
{ post_id: 2, value: 'down' }
|
||||
])
|
||||
|
||||
25
test/javascripts/visible_to_test.js.coffee
Normal file
25
test/javascripts/visible_to_test.js.coffee
Normal 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)
|
||||
Reference in New Issue
Block a user