use fixture
This commit is contained in:
parent
6fc6474e98
commit
0241d9c7db
3 changed files with 24 additions and 40 deletions
|
|
@ -261,7 +261,7 @@ app.views.Publisher = Backbone.View.extend({
|
||||||
|
|
||||||
keyDown : function(evt) {
|
keyDown : function(evt) {
|
||||||
if( evt.keyCode == 13 && evt.ctrlKey ) {
|
if( evt.keyCode == 13 && evt.ctrlKey ) {
|
||||||
this.el_submit.click();
|
this.$("form").submit();
|
||||||
this.open();
|
this.open();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
19
spec/controllers/jasmine_fixtures/status_messages_spec.rb
Normal file
19
spec/controllers/jasmine_fixtures/status_messages_spec.rb
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
# 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
|
||||||
|
|
@ -1,42 +1,7 @@
|
||||||
describe("app.views.AspectsDropdown", function(){
|
describe("app.views.AspectsDropdown", function(){
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
spec.content().html(
|
spec.loadFixture("bookmarklet");
|
||||||
'<div class="btn-group aspect_dropdown">'+
|
this.view = new app.views.AspectsDropdown({el: $('.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()});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
context('_toggleCheckbox', function() {
|
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() {
|
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);
|
this.view._selectAspects(this.ids);
|
||||||
expect(this.view.$('li.all_aspects.radio').hasClass('selected')).toBeFalsy();
|
expect(this.view.$('li.all_aspects.radio').hasClass('selected')).toBeFalsy();
|
||||||
expect(this.view.$('li.public.radio').hasClass('selected')).toBeTruthy();
|
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() {
|
it('shows the name of the selected aspect ( == 1 )', function() {
|
||||||
this.view.$('li.aspect_selector:eq(1)').addClass('selected');
|
this.view.$('li.aspect_selector:eq(1)').addClass('selected');
|
||||||
this.view._updateButton('inAspectClass');
|
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() {
|
it('shows the number of selected aspects ( > 1)', function() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue