Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/javascripts/app/views')
-rw-r--r--spec/javascripts/app/views/comment_view_spec.js8
-rw-r--r--spec/javascripts/app/views/help_view_spec.js65
-rw-r--r--spec/javascripts/app/views/notification_dropdown_view_spec.js1
-rw-r--r--spec/javascripts/app/views/publisher_view_spec.js6
-rw-r--r--spec/javascripts/app/views/single-post-view/single_post_interactions_spec.js1
-rw-r--r--spec/javascripts/app/views/stream/shortcuts_spec.js4
-rw-r--r--spec/javascripts/app/views/stream_post_spec.js4
-rw-r--r--spec/javascripts/app/views/stream_view_spec.js4
8 files changed, 24 insertions, 69 deletions
diff --git a/spec/javascripts/app/views/comment_view_spec.js b/spec/javascripts/app/views/comment_view_spec.js
index fc5a633cf..fb73ff190 100644
--- a/spec/javascripts/app/views/comment_view_spec.js
+++ b/spec/javascripts/app/views/comment_view_spec.js
@@ -1,11 +1,11 @@
describe("app.views.Comment", function(){
- beforeEach(function(){
+ beforeEach(function() {
this.post = factory.post({author : {diaspora_id : "xxx@xxx.xxx"}});
this.comment = factory.comment({parent : this.post.toJSON()});
this.view = new app.views.Comment({model : this.comment});
});
- describe("render", function(){
+ describe("render", function() {
it("has a delete link if the author is the current user", function(){
loginAs(this.comment.get("author"));
expect(this.view.render().$('.delete').length).toBe(1);
@@ -47,6 +47,10 @@ describe("app.views.Comment", function(){
});
describe("canRemove", function(){
+ beforeEach(function() {
+ loginAs({name: "alice"});
+ });
+
context("is truthy", function(){
it("when ownComment is true", function(){
spyOn(this.view, "ownComment").and.returnValue(true);
diff --git a/spec/javascripts/app/views/help_view_spec.js b/spec/javascripts/app/views/help_view_spec.js
index e73830267..d23f2cded 100644
--- a/spec/javascripts/app/views/help_view_spec.js
+++ b/spec/javascripts/app/views/help_view_spec.js
@@ -21,71 +21,6 @@ describe("app.views.Help", function(){
it('should initially show getting help section', function(){
expect(this.view.$el.find('#faq').children().first().data('template')).toBe('faq_getting_help');
});
-
- it('should show account and data management section', function(){
- this.view.$el.find('a[data-section=account_and_data_management]').trigger('click');
- expect(this.view.$el.find('#faq').children().first().hasClass('faq_question_account_and_data_management')).toBeTruthy();
- });
-
- it('should show aspects section', function(){
- this.view.$el.find('a[data-section=aspects]').trigger('click');
- expect(this.view.$el.find('#faq').children().first().hasClass('faq_question_aspects')).toBeTruthy();
- });
-
- it('should show mentions section', function(){
- this.view.$el.find('a[data-section=mentions]').trigger('click');
- expect(this.view.$el.find('#faq').children().first().hasClass('faq_question_mentions')).toBeTruthy();
- });
-
- it('should show pods section', function(){
- this.view.$el.find('a[data-section=pods]').trigger('click');
- expect(this.view.$el.find('#faq').children().first().hasClass('faq_question_pods')).toBeTruthy();
- });
-
- it('should show posts and posting section', function(){
- this.view.$el.find('a[data-section=posts_and_posting]').trigger('click');
- expect(this.view.$el.find('#faq').children().first().data('template')).toBe('faq_posts_and_posting');
- });
-
- it('should show private posts section', function(){
- this.view.$el.find('a[data-section=private_posts]').trigger('click');
- expect(this.view.$el.find('#faq').children().first().hasClass('faq_question_private_posts')).toBeTruthy();
- });
-
- it('should show public posts section', function(){
- this.view.$el.find('a[data-section=public_posts]').trigger('click');
- expect(this.view.$el.find('#faq').children().first().hasClass('faq_question_public_posts')).toBeTruthy();
- });
-
- it('should show resharing posts section', function(){
- this.view.$el.find('a[data-section=resharing_posts]').trigger('click');
- expect(this.view.$el.find('#faq').children().first().hasClass('faq_question_resharing_posts')).toBeTruthy();
- });
-
- it("should show profile section", function() {
- this.view.$el.find("a[data-section=profile]").trigger("click");
- expect(this.view.$el.find("#faq").children().first().hasClass("faq_question_profile")).toBeTruthy();
- });
-
- it('should show sharing section', function(){
- this.view.$el.find('a[data-section=sharing]').trigger('click');
- expect(this.view.$el.find('#faq').children().first().data('template')).toBe('faq_sharing');
- });
-
- 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')).toBe('faq_tags');
- });
-
- it('should show keyboard shortcuts section', function(){
- this.view.$el.find('a[data-section=keyboard_shortcuts]').trigger('click');
- expect(this.view.$el.find('#faq').children().first().data('template')).toBe('faq_keyboard_shortcuts');
- });
-
- it('should show miscellaneous section', function(){
- this.view.$el.find('a[data-section=miscellaneous]').trigger('click');
- expect(this.view.$el.find('#faq').children().first().hasClass('faq_question_miscellaneous')).toBeTruthy();
- });
});
describe("findSection", function() {
diff --git a/spec/javascripts/app/views/notification_dropdown_view_spec.js b/spec/javascripts/app/views/notification_dropdown_view_spec.js
index 725ae0d57..50a9de755 100644
--- a/spec/javascripts/app/views/notification_dropdown_view_spec.js
+++ b/spec/javascripts/app/views/notification_dropdown_view_spec.js
@@ -5,6 +5,7 @@ describe("app.views.NotificationDropdown", function() {
this.header = new app.views.Header();
$("header").prepend(this.header.el);
loginAs({guid: "foo"});
+ app.notificationsCollection = new app.collections.Notifications();
this.header.render();
this.collection = new app.collections.Notifications();
this.view = new app.views.NotificationDropdown({el: "#notification-dropdown", collection: this.collection});
diff --git a/spec/javascripts/app/views/publisher_view_spec.js b/spec/javascripts/app/views/publisher_view_spec.js
index a43d12a76..a5892f77f 100644
--- a/spec/javascripts/app/views/publisher_view_spec.js
+++ b/spec/javascripts/app/views/publisher_view_spec.js
@@ -25,7 +25,8 @@ describe("app.views.Publisher", function() {
describe("createStatusMessage", function(){
it("doesn't add the status message to the stream", function() {
- app.stream = { addNow: $.noop };
+ app.stream = new app.models.Stream();
+
spyOn(app.stream, "addNow");
this.view.createStatusMessage($.Event());
jasmine.Ajax.requests.mostRecent().respondWith({ status: 200, responseText: "{\"id\": 1}" });
@@ -198,7 +199,8 @@ describe("app.views.Publisher", function() {
describe("createStatusMessage", function(){
it("adds the status message to the stream", function() {
- app.stream = { addNow: $.noop };
+ app.stream = new app.models.Stream();
+
spyOn(app.stream, "addNow");
this.view.createStatusMessage($.Event());
jasmine.Ajax.requests.mostRecent().respondWith({ status: 200, responseText: "{\"id\": 1}" });
diff --git a/spec/javascripts/app/views/single-post-view/single_post_interactions_spec.js b/spec/javascripts/app/views/single-post-view/single_post_interactions_spec.js
index 507317a20..dad2951e7 100644
--- a/spec/javascripts/app/views/single-post-view/single_post_interactions_spec.js
+++ b/spec/javascripts/app/views/single-post-view/single_post_interactions_spec.js
@@ -1,5 +1,6 @@
describe("app.views.SinglePostInteractions", function() {
beforeEach(function() {
+ loginAs({name: "alice", avatar: {small: "http://avatar.com/photo.jpg"}});
this.post = factory.post();
this.view = new app.views.SinglePostInteractions({model: this.post});
});
diff --git a/spec/javascripts/app/views/stream/shortcuts_spec.js b/spec/javascripts/app/views/stream/shortcuts_spec.js
index ba58b54c1..19c1b8d3f 100644
--- a/spec/javascripts/app/views/stream/shortcuts_spec.js
+++ b/spec/javascripts/app/views/stream/shortcuts_spec.js
@@ -1,6 +1,10 @@
describe("app.views.StreamShortcuts", function () {
beforeEach(function() {
+ // This puts `app.page` into the proper state.
+ delete app.page;
+ new app.Router().stream();
+
this.post1 = factory.post({author : factory.author({name : "Rebecca Black", id : 1492})});
this.post2 = factory.post({author : factory.author({name : "John Stamos", id : 1987})});
diff --git a/spec/javascripts/app/views/stream_post_spec.js b/spec/javascripts/app/views/stream_post_spec.js
index d36a95e4a..2aa9f41fc 100644
--- a/spec/javascripts/app/views/stream_post_spec.js
+++ b/spec/javascripts/app/views/stream_post_spec.js
@@ -1,5 +1,9 @@
describe("app.views.StreamPost", function(){
beforeEach(function(){
+ // This puts `app.page` into the proper state.
+ delete app.page;
+ new app.Router().stream();
+
this.PostViewClass = app.views.StreamPost;
var posts = $.parseJSON(spec.readFixture("stream_json"));
diff --git a/spec/javascripts/app/views/stream_view_spec.js b/spec/javascripts/app/views/stream_view_spec.js
index c0caee100..a9b602baa 100644
--- a/spec/javascripts/app/views/stream_view_spec.js
+++ b/spec/javascripts/app/views/stream_view_spec.js
@@ -1,5 +1,9 @@
describe("app.views.Stream", function() {
beforeEach(function() {
+ // This puts `app.page` into the proper state.
+ delete app.page;
+ new app.Router().stream();
+
loginAs({name: "alice", avatar : {small : "http://avatar.com/photo.jpg"}});
this.posts = $.parseJSON(spec.readFixture("stream_json"));