Commit 0241d9c7 authored by Steffen van Bergerem's avatar Steffen van Bergerem

use fixture

parent 6fc6474e
......@@ -261,7 +261,7 @@ app.views.Publisher = Backbone.View.extend({
keyDown : function(evt) {
if( evt.keyCode == 13 && evt.ctrlKey ) {
this.el_submit.click();
this.$("form").submit();
this.open();
return false;
}
......
# Copyright (c) 2010-2011, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
require 'spec_helper'
describe StatusMessagesController do
describe '#bookmarklet' do
before do
sign_in :user, bob
end
it "generates a jasmine fixture", :fixture => true do
get :bookmarklet
save_fixture(html_for("body"), "bookmarklet")
end
end
end
describe("app.views.AspectsDropdown", function(){
beforeEach(function() {
spec.content().html(
'<div class="btn-group aspect_dropdown">'+
' <button class="btn dropdown-toggle" data-toggle="dropdown">'+
' <span class="text">'+ Diaspora.I18n.t('all_aspects') +'</span>'+
' <span class="caret"></span>'+
' </button>'+
' <ul class="dropdown-menu">'+
' <li class="public radio" data-aspect_id="public">'+
' <a>'+
' <span class="status_indicator"><i class="icon-ok"></i></span>'+
' <span class="text">'+ Diaspora.I18n.t('public') +'</span>'+
' </a>'+
' </li>'+
' <li class="all_aspects radio" data-aspect_id="all_aspects">'+
' <a>'+
' <span class="status_indicator"><i class="icon-ok"></i></span>'+
' <span class="text">'+ Diaspora.I18n.t('all_aspects') +'</span>'+
' </a>'+
' </li>'+
' <li class="divider"></li>'+
' <li class="aspect_selector" data-aspect_id="10">'+
' <a>'+
' <span class="status_indicator"><i class="icon-ok"></i></span>'+
' <span class="text">Aspect 10</span>'+
' </a>'+
' </li>'+
' <li class="aspect_selector" data-aspect_id="12">'+
' <a>'+
' <span class="status_indicator"><i class="icon-ok"></i></span>'+
' <span class="text">Aspect 12</span>'+
' </a>'+
' </li>'+
' </ul>'+
'</div>'
);
this.view = new app.views.AspectsDropdown({el: spec.content()});
spec.loadFixture("bookmarklet");
this.view = new app.views.AspectsDropdown({el: $('.aspect_dropdown')});
});
context('_toggleCheckbox', function() {
......@@ -96,7 +61,7 @@ describe("app.views.AspectsDropdown", function(){
});
it('select aspects in the dropdown by a given list of ids', function() {
this.ids = [12,'public'];
this.ids = [this.view.$('li.aspect_selector:eq(1)').data('aspect_id'),'public'];
this.view._selectAspects(this.ids);
expect(this.view.$('li.all_aspects.radio').hasClass('selected')).toBeFalsy();
expect(this.view.$('li.public.radio').hasClass('selected')).toBeTruthy();
......@@ -124,7 +89,7 @@ describe("app.views.AspectsDropdown", function(){
it('shows the name of the selected aspect ( == 1 )', function() {
this.view.$('li.aspect_selector:eq(1)').addClass('selected');
this.view._updateButton('inAspectClass');
expect(this.view.$('.btn.dropdown-toggle > .text').text()).toContain("Aspect 12");
expect(this.view.$('.btn.dropdown-toggle > .text').text()).toContain(this.view.$('li.aspect_selector:eq(1) .text').text());
});
it('shows the number of selected aspects ( > 1)', function() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment