From bb18c8e028a64a1f6d6810ef7fa3b7143b5dc797 Mon Sep 17 00:00:00 2001 From: Lukas Matt Date: Thu, 13 Nov 2014 11:49:03 +0100 Subject: [PATCH] Test chat privilege option; should replace text/icon on trigger --- .../app/views/contacts_view_spec.js | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/spec/javascripts/app/views/contacts_view_spec.js b/spec/javascripts/app/views/contacts_view_spec.js index d9236c0d7..04ed438fa 100644 --- a/spec/javascripts/app/views/contacts_view_spec.js +++ b/spec/javascripts/app/views/contacts_view_spec.js @@ -7,6 +7,8 @@ describe("app.views.Contacts", function(){ add_contact: "Add contact", aspect_list_is_visible: "Contacts in this aspect are able to see each other.", aspect_list_is_not_visible: "Contacts in this aspect are not able to see each other.", + aspect_chat_is_enabled: "Contacts in this aspect are able to chat with you.", + aspect_chat_is_not_enabled: "Contacts in this aspect are not able to chat with you.", remove_contact: "Remove contact", error_add: "Couldn't add <%= name %> to the aspect :(", error_remove: "Couldn't remove <%= name %> from the aspect :(" @@ -14,6 +16,28 @@ describe("app.views.Contacts", function(){ }); }); + context('toggle chat privilege', function() { + beforeEach(function() { + this.chat_toggle = $("#chat_privilege_toggle .entypo"); + }); + + it('updates the title for the tooltip', function() { + expect(this.chat_toggle.attr('data-original-title')).toBe( + Diaspora.I18n.t("contacts.aspect_chat_is_not_enabled") + ); + this.chat_toggle.trigger('click'); + expect(this.chat_toggle.attr('data-original-title')).toBe( + Diaspora.I18n.t("contacts.aspect_chat_is_enabled") + ); + }); + + it('toggles the chat icon', function() { + expect(this.chat_toggle.hasClass('enabled')).toBeFalsy; + this.chat_toggle.trigger('click'); + expect(this.chat_toggle.hasClass('enabled')).toBeTruethy; + }); + }); + context('toggle contacts visibility', function() { beforeEach(function() { this.visibility_toggle = $("#contacts_visibility_toggle");