js Post.updateVotes function; remove unuse assets

This commit is contained in:
Rei
2014-01-16 14:03:47 +08:00
parent 066f8e3162
commit 3d1251398f
9 changed files with 38 additions and 15 deletions

View File

@@ -0,0 +1,29 @@
module('posts_test')
test 'should update votes', ->
$fixture = $('#qunit-fixture')
$('#qunit-fixture').append("
<ul>
<li data-post-id='1' data-behavior='post-voteable'>
<a data-post-vote='up'></a>
<a data-post-vote='down'></a>
</li>
<li data-post-id='2' data-behavior='post-voteable'>
<a data-post-vote='up'></a>
<a data-post-vote='down'></a>
</li>
<li data-post-id='3' data-behavior='post-voteable'>
<a data-post-vote='up'></a>
<a data-post-vote='down'></a>
</li>
</ul
")
Post.updateVotes(
1: 'up',
2: 'down'
)
equal( 'up', $fixture.find('[data-post-id=1]').data('post-vote') )
equal( 'down', $fixture.find('[data-post-id=2]').data('post-vote') )
equal( null, $fixture.find('[data-post-id=3]').data('post-vote') )

View File

@@ -1,5 +1,3 @@
#= require application
#= require qunit
test "true", ->
ok( true, "Passed!" )
#= require_tree .