summaryrefslogtreecommitdiff
path: root/web-ui/test/spec/feedback/feedback_trigger.spec.js
blob: 3860fc798dbec5d06e31831d110c29e15efa64c1 (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
describeComponent('feedback/feedback_trigger', function () {
  'use strict';

  describe('Feedback link', function () {
   var features;

    beforeEach(function() {
      features = require('features');
    });

    it('Should provide feedback link if logout is enabled', function () {
      spyOn(features, 'isEnabled').and.returnValue(true);
      this.setupComponent('<nav id="feedback"></nav>', {});

      var feedback_link = this.component.$node.find('a')[0];
      expect(feedback_link).toExist();
    });

    it('Should not provide feedback link if disabled', function() {
      spyOn(features, 'isEnabled').and.returnValue(false);
      this.setupComponent('<nav id="feedback"></nav>', {});

      var feedback_link = this.component.$node.find('a')[0];
      expect(feedback_link).not.toExist();
    });

    it('Should trigger ui:feedback:open event on click', function () {

      this.setupComponent('<nav id="feedback"></nav>', {});
      var spy = spyOnEvent(document, Pixelated.events.dispatchers.rightPane.openFeedbackBox);

      this.$node.find('a').click();
      expect(spy).toHaveBeenTriggeredOn(document);
    });

  });
});