summaryrefslogtreecommitdiff
path: root/spec/frontend/notebook/cells/prompt_spec.js
blob: cf5a7a603c639fd6b4d2930010af0a0354e53981 (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
import Vue from 'vue';
import PromptComponent from '~/notebook/cells/prompt.vue';

const Component = Vue.extend(PromptComponent);

describe('Prompt component', () => {
  let vm;

  describe('input', () => {
    beforeEach(done => {
      vm = new Component({
        propsData: {
          type: 'In',
          count: 1,
        },
      });
      vm.$mount();

      setImmediate(() => {
        done();
      });
    });

    it('renders in label', () => {
      expect(vm.$el.textContent.trim()).toContain('In');
    });

    it('renders count', () => {
      expect(vm.$el.textContent.trim()).toContain('1');
    });
  });

  describe('output', () => {
    beforeEach(done => {
      vm = new Component({
        propsData: {
          type: 'Out',
          count: 1,
        },
      });
      vm.$mount();

      setImmediate(() => {
        done();
      });
    });

    it('renders in label', () => {
      expect(vm.$el.textContent.trim()).toContain('Out');
    });

    it('renders count', () => {
      expect(vm.$el.textContent.trim()).toContain('1');
    });
  });
});