Test chat privilege option; should replace text/icon on trigger

This commit is contained in:
Lukas Matt 2014-11-13 11:49:03 +01:00
parent 32dcf8cabb
commit bb18c8e028

View file

@ -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");