Write jasmine test for the tag unfollow icon visibility

This commit is contained in:
Andrej Kacian 2011-08-09 19:53:28 +02:00
parent 2a970145c8
commit bddd7c717b
3 changed files with 30 additions and 0 deletions

View file

@ -70,6 +70,13 @@ describe AspectsController do
save_fixture(html_for("body"), "aspects_index_with_posts")
end
it 'generates a jasmine fixture with a followed tag' do
@tag = ActsAsTaggableOn::Tag.create!(:name => "partytimeexcellent")
TagFollowing.create!(:tag => @tag, :user => alice )
get :index
save_fixture(html_for("body"), "aspects_index_with_one_followed_tag")
end
context 'with getting_started = true' do
before do
alice.getting_started = true

View file

@ -43,6 +43,7 @@ src_files:
- public/javascripts/rails.js
- public/javascripts/aspect-filters.js
- public/javascripts/content-updater.js
- public/javascripts/tag-followings.js
# stylesheets
#
# Return an array of stylesheet filepaths relative to src_dir to include before jasmine specs.

View file

@ -0,0 +1,22 @@
/* Copyright (c) 2011, Diaspora Inc. This file is
* licensed under the Affero General Public License version 3 or later. See
* the COPYRIGHT file.
*/
describe("TagFollowings", function() {
describe("unfollow", function(){
it("tests unfollow icon visibility on mouseover event", function(){
spec.loadFixture('aspects_index_with_one_followed_tag');
TagFollowings.initialize();
var tag_li = $('li.unfollow#partytimeexcellent');
var icon_div = $('.unfollow_icon');
expect(icon_div.hasClass('hidden')).toBeTruthy();
tag_li.mouseover();
expect(icon_div.hasClass('hidden')).toBeFalsy();
tag_li.mouseout();
expect(icon_div.hasClass('hidden')).toBeTruthy();
});
});
});