Merge pull request #5635 from svbergerem/remove-unused-files
Remove unused files, fix syntax in jasmine tests
This commit is contained in:
commit
3114b04a08
12 changed files with 81 additions and 189 deletions
|
|
@ -41,38 +41,5 @@ $(document).ready(function(){
|
|||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$('#conversation_inbox .stream').infinitescroll({
|
||||
navSelector : ".pagination",
|
||||
// selector for the paged navigation (it will be hidden)
|
||||
nextSelector : ".pagination a.next_page",
|
||||
// selector for the NEXT link (to page 2)
|
||||
itemSelector : "#conversation_inbox .conversation",
|
||||
// selector for all items you'll retrieve
|
||||
localMode: true,
|
||||
debug: false,
|
||||
donetext: "no more.",
|
||||
loadingText: "",
|
||||
loadingImg: ImagePaths.get('ajax-loader.gif')
|
||||
}, function(){
|
||||
$('.conversation-wrapper', '.stream').bind('mousedown', function(){
|
||||
bindIt($(this));
|
||||
});
|
||||
});
|
||||
|
||||
// kill scroll binding
|
||||
$(window).unbind('.infscr');
|
||||
|
||||
// hook up the manual click guy.
|
||||
$('a.next_page').click(function(){
|
||||
$(document).trigger('retrieve.infscr');
|
||||
return false;
|
||||
});
|
||||
|
||||
// remove the paginator when we're done.
|
||||
$(document).ajaxError(function(e,xhr,opt){
|
||||
if (xhr.status == 404) { $('a.next_page').remove(); }
|
||||
});
|
||||
});
|
||||
// @license-end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,14 +0,0 @@
|
|||
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-Later
|
||||
|
||||
Diaspora.Pages.ContactsIndex = function() {
|
||||
var self = this;
|
||||
|
||||
this.subscribe("page/ready", function(evt, document) {
|
||||
self.infiniteScroll = self.instantiate("InfiniteScroll",
|
||||
{donetext: Diaspora.I18n.t("infinite_scroll.no_more_contacts"),});
|
||||
$('.conversation_button').tooltip({placement: 'bottom'});
|
||||
});
|
||||
|
||||
};
|
||||
// @license-end
|
||||
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-Later
|
||||
|
||||
Diaspora.Pages.InvitationsEdit = function() {
|
||||
var self = this;
|
||||
|
||||
this.subscribe("page/ready", function(evt, body) {
|
||||
jQuery.ajaxSetup({'cache': true});
|
||||
$('#user_username').tooltip({trigger: 'focus', placement: 'right'});
|
||||
});
|
||||
};
|
||||
// @license-end
|
||||
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-Later
|
||||
|
||||
Diaspora.Pages.InvitationsNew = function() {
|
||||
var self = this;
|
||||
|
||||
this.subscribe("page/ready", function(evt, document) {
|
||||
var rtl = $('html').attr('dir') == 'rtl',
|
||||
position = rtl ? 'left' : 'right';
|
||||
|
||||
$('#new_user [title]').tooltip({trigger: 'focus', placement: position});
|
||||
$('#user_email').focus();
|
||||
});
|
||||
};
|
||||
// @license-end
|
||||
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-Later
|
||||
|
||||
Diaspora.Pages.NotificationsIndex = function() {
|
||||
var self = this;
|
||||
|
||||
this.subscribe("page/ready", function(evt, document) {
|
||||
self.infiniteScroll = self.instantiate("InfiniteScroll");
|
||||
self.instantiate("TimeAgo", document.find("time.timeago"));
|
||||
});
|
||||
};
|
||||
// @license-end
|
||||
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
:javascript
|
||||
$(function() {
|
||||
$("#user_email").focus();
|
||||
});
|
||||
|
||||
%h2
|
||||
= t('.invite_someone_to_join')
|
||||
|
||||
#email_invitation
|
||||
= form_for User.new, :url => invitation_path(User) do |invite|
|
||||
%h4
|
||||
= t('email')
|
||||
= invite.text_field :email, :title => t('.comma_seperated_plz')
|
||||
%br
|
||||
|
||||
%h4
|
||||
= t('.aspect')
|
||||
= invite.select(:aspects, options_from_collection_for_select(all_aspects, 'id', 'name'))
|
||||
|
||||
%br
|
||||
%br
|
||||
|
||||
%h4
|
||||
= t('.personal_message')
|
||||
= invite.text_area :invite_messages, :rows => 3, :value => ""
|
||||
|
||||
%p
|
||||
= invite.submit t('.send_an_invitation')
|
||||
|
|
@ -16,4 +16,19 @@ describe StatusMessagesController, :type => :controller do
|
|||
end
|
||||
|
||||
end
|
||||
|
||||
describe '#new' do
|
||||
before do
|
||||
sign_in :user, alice
|
||||
end
|
||||
|
||||
it 'generates a jasmine fixture', :fixture => true do
|
||||
contact = alice.contact_for(bob.person)
|
||||
aspect = alice.aspects.create(:name => 'people')
|
||||
contact.aspects << aspect
|
||||
contact.save
|
||||
get :new, :person_id => bob.person.id
|
||||
save_fixture(html_for("body"), "status_message_new")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -46,15 +46,6 @@ describe StatusMessagesController, :type => :controller do
|
|||
get :new
|
||||
expect(response).to redirect_to(stream_path)
|
||||
end
|
||||
|
||||
it 'generates a jasmine fixture', :fixture => true do
|
||||
contact = alice.contact_for(bob.person)
|
||||
aspect = alice.aspects.create(:name => 'people')
|
||||
contact.aspects << aspect
|
||||
contact.save
|
||||
get :new, :person_id => bob.person.id, :layout => true
|
||||
save_fixture(html_for("body"), "status_message_new")
|
||||
end
|
||||
end
|
||||
|
||||
describe '#create' do
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ describe("app.views.Help", function(){
|
|||
|
||||
it('should show tags section', function(){
|
||||
this.view.$el.find('a[data-section=tags]').trigger('click');
|
||||
expect(this.view.$el.find('#faq').children().first().data('template') == 'faq_tags')).toBeTruthy();
|
||||
expect(this.view.$el.find('#faq').children().first().data('template') == 'faq_tags').toBeTruthy();
|
||||
});
|
||||
|
||||
it('should show keyboard shortcuts section', function(){
|
||||
|
|
@ -87,4 +87,4 @@ describe("app.views.Help", function(){
|
|||
expect(this.view.$el.find('#faq').children().first().hasClass('faq_question_miscellaneous')).toBeTruthy();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ describe("app.views.ProfileSidebar", function() {
|
|||
|
||||
context("#presenter", function() {
|
||||
it("contains necessary elements", function() {
|
||||
console.log(this.view.presenter());
|
||||
expect(this.view.presenter()).toEqual(jasmine.objectContaining({
|
||||
relationship: 'mutual',
|
||||
show_profile_info: true,
|
||||
|
|
|
|||
|
|
@ -14,17 +14,19 @@ describe('app.views.PublisherPollCreator', function(){
|
|||
});
|
||||
describe('#addAnswerInput', function(){
|
||||
it('should add new answer input', function(){
|
||||
this.view.addAnswerInput();
|
||||
expect(this.view.$(this.input_selector).length).toBe(2);
|
||||
this.view.addAnswerInput();
|
||||
expect(this.view.$(this.input_selector).length).toBe(3);
|
||||
});
|
||||
it('should change input count', function(){
|
||||
this.view.addAnswerInput();
|
||||
expect(this.view.inputCount).toBe(2);
|
||||
expect(this.view.inputCount).toBe(3);
|
||||
});
|
||||
});
|
||||
describe('#removeAnswerInput', function(){
|
||||
it('remove answer input', function(){
|
||||
var input = this.view.$('input:first');
|
||||
var input = this.view.$(this.input_selector).first();
|
||||
expect(this.view.$(this.input_selector).length).toBe(2);
|
||||
this.view.removeAnswerInput(input);
|
||||
expect(this.view.$(this.input_selector).length).toBe(1);
|
||||
});
|
||||
|
|
@ -40,7 +42,7 @@ describe('app.views.PublisherPollCreator', function(){
|
|||
var remove_btn = '.poll-answer .remove-answer';
|
||||
it('show remove button when answer input is greater 1', function(){
|
||||
this.view.addAnswerInput();
|
||||
expect(this.view.$(remove_btn).hasClass('active')).toBe(true);
|
||||
expect(this.view.$(remove_btn).hasClass('active')).toBeFalsy;
|
||||
});
|
||||
it('hide remove button when is only one answer input', function(){
|
||||
var input = this.view.$(this.input_selector);
|
||||
|
|
@ -48,14 +50,14 @@ describe('app.views.PublisherPollCreator', function(){
|
|||
this.view.addAnswerInput();
|
||||
this.view.removeAnswerInput(input);
|
||||
|
||||
expect(this.view.$(remove_btn).hasClass('active')).toBe(false);
|
||||
expect(this.view.$(remove_btn).hasClass('active')).toBeFalsy;
|
||||
});
|
||||
});
|
||||
describe('#validateInput', function(){
|
||||
it('should invalid blank value', function(){
|
||||
var input = this.view.$('input');
|
||||
input.val(' ');
|
||||
expect(this.view.validateInput(input)).toBe(false);
|
||||
}):
|
||||
expect(this.view.validateInput(input)).toBeFalsy;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -270,107 +270,106 @@ describe("app.views.Publisher", function() {
|
|||
|
||||
context("aspect selection", function(){
|
||||
beforeEach( function(){
|
||||
spec.loadFixture('status_message_new');
|
||||
loginAs({name: "alice", avatar : {small : "http://avatar.com/photo.jpg"}});
|
||||
spec.loadFixture("status_message_new");
|
||||
Diaspora.I18n.load({ stream: { public: 'Public' }});
|
||||
|
||||
this.radio_els = $('#publisher .aspect_dropdown li.radio');
|
||||
this.check_els = $('#publisher .aspect_dropdown li.aspect_selector');
|
||||
this.visibility_icon = $('#visibility-icon');
|
||||
|
||||
this.view = new app.views.Publisher();
|
||||
this.view.open();
|
||||
|
||||
this.radio_els = this.view.$('#publisher .aspect_dropdown li.radio');
|
||||
this.check_els = this.view.$('#publisher .aspect_dropdown li.aspect_selector');
|
||||
this.visibility_icon = this.view.$('#visibility-icon');
|
||||
});
|
||||
|
||||
it("initializes with 'all_aspects'", function(){
|
||||
expect(this.radio_els.first().hasClass('selected')).toBeFalsy();
|
||||
expect(this.radio_els.last().hasClass('selected')).toBeTruthy();
|
||||
expect($('.aspect_dropdown li.public')).not.toHaveClass('selected');
|
||||
expect($('.aspect_dropdown li.all_aspects')).toHaveClass('selected');
|
||||
expect($('.aspect_dropdown li.aspect_selector')).not.toHaveClass('selected');
|
||||
|
||||
_.each(this.check_els, function(el){
|
||||
expect($(el).hasClass('selected')).toBeFalsy();
|
||||
});
|
||||
expect(this.visibility_icon.hasClass('globe')).toBeFalsy();
|
||||
expect(this.visibility_icon.hasClass('lock')).toBeTruthy();
|
||||
expect($('#publisher #visibility-icon')).not.toHaveClass('globe');
|
||||
expect($('#publisher #visibility-icon')).toHaveClass('lock');
|
||||
});
|
||||
|
||||
it("toggles the selected entry visually", function(){
|
||||
// click on the last aspect
|
||||
this.check_els.last().trigger('click');
|
||||
// click on the first aspect
|
||||
var evt = $.Event("click", { target: $('.aspect_dropdown li.aspect_selector:first') });
|
||||
this.view.view_aspect_selector.toggleAspect(evt);
|
||||
// public and "all aspects" are deselected
|
||||
_.each(this.radio_els, function(el){
|
||||
expect($(el).hasClass('selected')).toBeFalsy();
|
||||
});
|
||||
// the first aspect is not selected
|
||||
expect(this.check_els.first().hasClass('selected')).toBeFalsy();
|
||||
// the last aspect is selected
|
||||
expect(this.check_els.last().hasClass('selected')).toBeTruthy();
|
||||
expect($('.aspect_dropdown li.public')).not.toHaveClass('selected');
|
||||
expect($('.aspect_dropdown li.all_aspects')).not.toHaveClass('selected');
|
||||
// the first aspect is selected
|
||||
expect($('.aspect_dropdown li.aspect_selector:first')).toHaveClass('selected');
|
||||
// the last aspect is not selected
|
||||
expect($('.aspect_dropdown li.aspect_selector:last')).not.toHaveClass('selected');
|
||||
// visibility icon is set to the lock icon
|
||||
expect(this.visibility_icon.hasClass('globe')).toBeFalsy();
|
||||
expect(this.visibility_icon.hasClass('lock')).toBeTruthy();
|
||||
expect($('#publisher #visibility-icon')).not.toHaveClass('globe');
|
||||
expect($('#publisher #visibility-icon')).toHaveClass('lock');
|
||||
|
||||
// click on public
|
||||
this.radio_els.first().trigger('click');
|
||||
evt = $.Event("click", { target: $('.aspect_dropdown li.public') });
|
||||
this.view.view_aspect_selector.toggleAspect(evt);
|
||||
// public is selected, "all aspects" is deselected
|
||||
expect(this.radio_els.first().hasClass('selected')).toBeTruthy();
|
||||
expect(this.radio_els.last().hasClass('selected')).toBeFalsy();
|
||||
expect($('.aspect_dropdown li.public').hasClass('selected')).toBeTruthy();
|
||||
expect($('.aspect_dropdown li.all_aspects').hasClass('selected')).toBeFalsy();
|
||||
// the aspects are deselected
|
||||
_.each(this.check_els, function(el){
|
||||
expect($(el).hasClass('selected')).toBeFalsy();
|
||||
});
|
||||
expect($('.aspect_dropdown li.aspect_selector').hasClass('selected')).toBeFalsy();
|
||||
// visibility icon is set to the globe icon
|
||||
expect(this.visibility_icon.hasClass('globe')).toBeTruthy();
|
||||
expect(this.visibility_icon.hasClass('lock')).toBeFalsy();
|
||||
expect($('#publisher #visibility-icon').hasClass('globe')).toBeTruthy();
|
||||
expect($('#publisher #visibility-icon').hasClass('lock')).toBeFalsy();
|
||||
|
||||
// click on "all aspects"
|
||||
this.radio_els.last().trigger('click');
|
||||
evt = $.Event("click", { target: $('.aspect_dropdown li.all_aspects') });
|
||||
this.view.view_aspect_selector.toggleAspect(evt);
|
||||
// public is deselected, "all aspects" is selected
|
||||
expect(this.radio_els.first().hasClass('selected')).toBeFalsy();
|
||||
expect(this.radio_els.last().hasClass('selected')).toBeTruthy();
|
||||
expect($('.aspect_dropdown li.public').hasClass('selected')).toBeFalsy();
|
||||
expect($('.aspect_dropdown li.all_aspects').hasClass('selected')).toBeTruthy();
|
||||
// the aspects are deselected
|
||||
_.each(this.check_els, function(el){
|
||||
expect($(el).hasClass('selected')).toBeFalsy();
|
||||
});
|
||||
expect($('.aspect_dropdown li.aspect_selector').hasClass('selected')).toBeFalsy();
|
||||
// visibility icon is set to the lock icon
|
||||
expect(this.visibility_icon.hasClass('globe')).toBeFalsy();
|
||||
expect(this.visibility_icon.hasClass('lock')).toBeTruthy();
|
||||
expect($('#publisher #visibility-icon').hasClass('globe')).toBeFalsy();
|
||||
expect($('#publisher #visibility-icon').hasClass('lock')).toBeTruthy();
|
||||
});
|
||||
|
||||
describe("hidden form elements", function(){
|
||||
beforeEach(function(){
|
||||
this.li = $('<li data-aspect_id="42" class="aspect_selector" />');
|
||||
this.view.$('.dropdown-menu').append(this.li);
|
||||
$('.dropdown-menu').append('<li data-aspect_id="42" class="aspect_selector" />');
|
||||
});
|
||||
|
||||
it("removes a previous selection and inserts the current one", function() {
|
||||
var selected = this.view.$('input[name="aspect_ids[]"]');
|
||||
var selected = $('input[name="aspect_ids[]"]');
|
||||
expect(selected.length).toBe(1);
|
||||
expect(selected.first().val()).toBe('all_aspects');
|
||||
|
||||
this.li.trigger('click');
|
||||
var evt = $.Event("click", { target: $('.aspect_dropdown li.aspect_selector:last') });
|
||||
this.view.view_aspect_selector.toggleAspect(evt);
|
||||
|
||||
selected = this.view.$('input[name="aspect_ids[]"]');
|
||||
selected = $('input[name="aspect_ids[]"]');
|
||||
expect(selected.length).toBe(1);
|
||||
expect(selected.first().val()).toBe('42');
|
||||
});
|
||||
|
||||
it("toggles the same item", function() {
|
||||
expect(this.view.$('input[name="aspect_ids[]"][value="42"]').length).toBe(0);
|
||||
expect($('input[name="aspect_ids[]"][value="42"]').length).toBe(0);
|
||||
|
||||
this.li.trigger('click');
|
||||
expect(this.view.$('input[name="aspect_ids[]"][value="42"]').length).toBe(1);
|
||||
var evt = $.Event("click", { target: $('.aspect_dropdown li.aspect_selector:last') });
|
||||
this.view.view_aspect_selector.toggleAspect(evt);
|
||||
expect($('input[name="aspect_ids[]"][value="42"]').length).toBe(1);
|
||||
|
||||
this.li.trigger('click');
|
||||
expect(this.view.$('input[name="aspect_ids[]"][value="42"]').length).toBe(0);
|
||||
var evt = $.Event("click", { target: $('.aspect_dropdown li.aspect_selector:last') });
|
||||
this.view.view_aspect_selector.toggleAspect(evt);
|
||||
expect($('input[name="aspect_ids[]"][value="42"]').length).toBe(0);
|
||||
});
|
||||
|
||||
it("keeps other fields with different values", function() {
|
||||
var li2 = $('<li data-aspect_id=99 class="aspect_selector"></li>');
|
||||
this.view.$('.dropdown-menu').append(li2);
|
||||
$('.dropdown-menu').append('<li data-aspect_id="99" class="aspect_selector" />');
|
||||
var evt = $.Event("click", { target: $('.aspect_dropdown li.aspect_selector:eq(-2)') });
|
||||
this.view.view_aspect_selector.toggleAspect(evt);
|
||||
evt = $.Event("click", { target: $('.aspect_dropdown li.aspect_selector:eq(-1)') });
|
||||
this.view.view_aspect_selector.toggleAspect(evt);
|
||||
|
||||
this.li.trigger('click');
|
||||
li2.trigger('click');
|
||||
|
||||
expect(this.view.$('input[name="aspect_ids[]"][value="42"]').length).toBe(1);
|
||||
expect(this.view.$('input[name="aspect_ids[]"][value="99"]').length).toBe(1);
|
||||
expect($('input[name="aspect_ids[]"][value="42"]').length).toBe(1);
|
||||
expect($('input[name="aspect_ids[]"][value="99"]').length).toBe(1);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue