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

content_view_spec.js « views « app « javascripts « spec - github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6e8ebe869a2350e4eb619f7bb01f8d8501011019 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
describe("app.views.Content", function(){
  beforeEach(function(){
    this.post = new app.models.StatusMessage();
    this.view = new app.views.Content({model : this.post});
  });

  describe("smallPhotos", function() {
    it("should return all but the first photo from the post", function() {
      this.post.set({photos : [1,2]}); // set 2 Photos
      expect(this.view.smallPhotos().length).toEqual(1);
    });

    it("shouldn't change the photos array", function() {
      this.post.set({photos: [1, 2]}); // set 2 Photos
      this.view.smallPhotos();
      expect(this.post.get("photos").length).toEqual(2);
    });
  });

  describe("presenter", function(){
    beforeEach(function(){
      this.post.set({text : ""}); // for textFormatter
    });

    it("provides isReshare", function(){
      expect(this.view.presenter().isReshare).toBeFalsy();
    });

    it("provides isReshare and be true when the post is a reshare", function(){
      this.post.set({post_type : "Reshare"});
      expect(this.view.presenter().isReshare).toBeTruthy();
    });

    it("provides location", function(){
      this.post.set({location : factory.location()});
      expect(this.view.presenter().location).toEqual(factory.location());
    });
  });

  describe("onVideoThumbClick", function() {
    beforeEach(function() {
      this.post = new app.models.StatusMessage({text: "[title](https://www.w3schools.com/html/mov_bbb.mp4)"});
      this.view = new app.views.StatusMessage({model: this.post});

      this.view.render();
    });

    afterEach(function() {
      this.view.$("video").stop();
    });

    xit("hides video overlay", function() {
      expect(this.view.$(".video-overlay").length).toBe(1);
      this.view.$(".media-embed .thumb").click();
      expect(this.view.$(".video-overlay")).toHaveClass("hidden");
    });

    xit("expands posts on click", function() {
      this.view.$(".collapsible").height(500);
      this.view.collapseOversized();

      expect(this.view.$(".collapsed").length).toBe(1);
      this.view.$(".media-embed .thumb").click();
      expect(this.view.$(".opened").length).toBe(1);
    });

    xit("plays video", function(done) {
      this.view.$("video").on("playing", function() {
        done();
      });

      this.view.$(".media-embed .thumb").click();
    });
  });
});