mirror of
https://github.com/zhigang1992/tsemple.git
synced 2026-04-29 05:05:25 +08:00
js Post.updateVotes function; remove unuse assets
This commit is contained in:
29
test/javascripts/posts_test.js.coffee
Normal file
29
test/javascripts/posts_test.js.coffee
Normal 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') )
|
||||
@@ -1,5 +1,3 @@
|
||||
#= require application
|
||||
#= require qunit
|
||||
|
||||
test "true", ->
|
||||
ok( true, "Passed!" )
|
||||
#= require_tree .
|
||||
|
||||
Reference in New Issue
Block a user