summaryrefslogtreecommitdiff
path: root/spec/javascripts/project_title_spec.js
blob: 00c54cbf0c2a9c26327cbc1d473ba5db8f06d059 (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

/*= require bootstrap */

/*= require select2 */

/*= require lib/utils/type_utility */

/*= require gl_dropdown */

/*= require api */

/*= require project_select */

/*= require project */
window.gon || (window.gon = {});

window.gon.api_version = 'v3';

describe('Project Title', function() {
  fixture.preload('project_title.html');
  fixture.preload('projects.json');
  beforeEach(function() {
    fixture.load('project_title.html');
    return this.project = new Project();
  });
  return describe('project list', function() {
    beforeEach((function(_this) {
      return function() {
        _this.projects_data = fixture.load('projects.json')[0];
        return spyOn(jQuery, 'ajax').and.callFake(function(req) {
          var d;
          expect(req.url).toBe('/api/v3/projects.json?simple=true');
          d = $.Deferred();
          d.resolve(_this.projects_data);
          return d.promise();
        });
      };
    })(this));
    it('to show on toggle click', (function(_this) {
      return function() {
        $('.js-projects-dropdown-toggle').click();
        return expect($('.header-content').hasClass('open')).toBe(true);
      };
    })(this));
    return it('hide dropdown', function() {
      $(".dropdown-menu-close-icon").click();
      return expect($('.header-content').hasClass('open')).toBe(false);
    });
  });
});