From 834c75894c1e36016469991e719535193d2cc8aa Mon Sep 17 00:00:00 2001 From: Ilyaaaaaaaaaaaaa Zhitomirskiy Date: Fri, 19 Aug 2011 14:42:03 -0700 Subject: [PATCH] jasmine is green again --- spec/javascripts/publisher-spec.js | 31 ++++++++++------------------ spec/javascripts/support/jasmine.yml | 1 + 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/spec/javascripts/publisher-spec.js b/spec/javascripts/publisher-spec.js index 56894f794..a386819d9 100644 --- a/spec/javascripts/publisher-spec.js +++ b/spec/javascripts/publisher-spec.js @@ -35,6 +35,7 @@ describe("Publisher", function() { describe("bindAspectToggles", function() { beforeEach( function(){ spec.loadFixture('status_message_new'); + Publisher.open(); }); it('gets called on initialize', function(){ @@ -44,40 +45,30 @@ describe("Publisher", function() { }); it('toggles removed only on the clicked icon', function(){ - expect($("#publisher .aspect_badge").first().hasClass("removed")).toBeFalsy(); - expect($("#publihser .aspect_badge").last().hasClass("removed")).toBeFalsy(); + Publisher.initialize(); + + expect($("#publisher .dropdown .dropdown_list li").first().hasClass("selected")).toBeTruthy(); + expect($("#publihser .dropdown .dropdown_list li").last().hasClass("selected")).toBeFalsy(); Publisher.bindAspectToggles(); - $("#publisher .aspect_badge").last().click(); + $("#publisher .dropdown .dropdown_list li").last().click(); - expect($("#publisher .aspect_badge").first().hasClass("removed")).toBeFalsy(); - expect($("#publisher .aspect_badge").last().hasClass("removed")).toBeTruthy(); + expect($("#publisher .dropdown .dropdown_list li").first().hasClass("selected")).toBeTruthy(); + expect($("#publisher .dropdown .dropdown_list li").last().hasClass("selected")).toBeTruthy(); }); it('binds to the services icons and toggles the hidden field', function(){ spyOn(Publisher, 'toggleAspectIds'); Publisher.bindAspectToggles(); - var aspBadge = $("#publisher .aspect_badge a").last(); - var aspNum = aspBadge.attr('data-guid'); + var aspBadge = $("#publisher .dropdown .dropdown_list li").last(); + var aspNum = aspBadge.attr('data-aspect_id'); aspBadge.click(); expect(Publisher.toggleAspectIds).toHaveBeenCalledWith(aspNum); }); - it('does not execute if it is the last non-removed aspect', function(){ - var aspects = $("#publisher .aspect_badge").length; - spyOn(Publisher, 'toggleAspectIds'); - - Publisher.bindAspectToggles(); - spyOn(window, 'alert');// click through the dialog if it happens - $("#publisher .aspect_badge a").each(function(){$(this).click()}); - - var lastAspectNum = $("#publisher .aspect_badge a").last().attr('data-guid'); - - expect($("#publisher .aspect_badge.removed").length).toBe(aspects-1); - expect(Publisher.toggleAspectIds.callCount).toBe(1); - }); }); + describe('toggleAspectIds', function(){ beforeEach( function(){ spec.loadFixture('status_message_new'); diff --git a/spec/javascripts/support/jasmine.yml b/spec/javascripts/support/jasmine.yml index a17b09bcd..80ad20767 100644 --- a/spec/javascripts/support/jasmine.yml +++ b/spec/javascripts/support/jasmine.yml @@ -42,6 +42,7 @@ src_files: - public/javascripts/validation.js - public/javascripts/rails.js - public/javascripts/aspect-filters.js + - public/javascripts/aspects-dropdown.js - public/javascripts/content-updater.js - public/javascripts/tag-followings.js # stylesheets