Better stab at the jasmine test.

This commit is contained in:
Andrej Kacian 2011-08-06 22:48:49 +02:00
parent 2716316dac
commit 6cf42fb8ba
2 changed files with 8 additions and 3 deletions

View file

@ -289,7 +289,7 @@ var Publisher = {
bindPublicIcon: function(){
$(".public_icon").bind("click", function(evt){
$(this).toggleClass("dim");
var public_field= $("#publisher #status_message_public");
var public_field = $("#publisher #status_message_public");
if (public_field.val() == 'false') {
public_field.val('true');

View file

@ -110,6 +110,9 @@ describe("Publisher", function() {
describe("bindPublicIcon", function() {
beforeEach( function(){
spec.loadFixture('aspects_index_services');
Diaspora.widgets.i18n.loadLocale(
{ 'publisher' :
{ 'public' : 'is public', 'limited' : 'is limited' } }, 'en');
});
it('gets called on initialize', function(){
@ -134,10 +137,12 @@ describe("Publisher", function() {
});
it('toggles the tooltip on the clicked icon', function(){
Publisher.bindPublicIcon();
expect($(".public_icon")).toHaveAttr('title', 'is public');
$(".public_icon").click();
expect($(".public_icon")).toHaveAttr('title', Diaspora.widgets.i18n.t('javascripts.publisher.limited'));
expect($(".public_icon")).toHaveAttr('title', 'is limited');
$(".public_icon").click();
expect($(".public_icon")).toHaveAttr('title', Diaspora.widgets.i18n.t('javascripts.publisher.public'));
expect($(".public_icon")).toHaveAttr('title', 'is public');
});
});
describe("bindServiceIcons", function() {