diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-07 12:09:34 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-07 12:09:34 +0000 |
commit | 903ccf7c93eb9490c76857bffe744249cc07de09 (patch) | |
tree | 603a3162e91999160e4efc74f351f9405f422d61 /spec/javascripts | |
parent | 41cb558299b483b44b45351730ee4c0e9fe4ca2c (diff) | |
download | gitlab-ce-903ccf7c93eb9490c76857bffe744249cc07de09.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/javascripts')
-rw-r--r-- | spec/javascripts/notebook/cells/code_spec.js | 43 |
1 files changed, 31 insertions, 12 deletions
diff --git a/spec/javascripts/notebook/cells/code_spec.js b/spec/javascripts/notebook/cells/code_spec.js index 4659b83d1b6..f3f97145ad3 100644 --- a/spec/javascripts/notebook/cells/code_spec.js +++ b/spec/javascripts/notebook/cells/code_spec.js @@ -11,14 +11,19 @@ describe('Code component', () => { json = getJSONFixture('blob/notebook/basic.json'); }); + const setupComponent = cell => { + const comp = new Component({ + propsData: { + cell, + }, + }); + comp.$mount(); + return comp; + }; + describe('without output', () => { beforeEach(done => { - vm = new Component({ - propsData: { - cell: json.cells[0], - }, - }); - vm.$mount(); + vm = setupComponent(json.cells[0]); setTimeout(() => { done(); @@ -32,12 +37,7 @@ describe('Code component', () => { describe('with output', () => { beforeEach(done => { - vm = new Component({ - propsData: { - cell: json.cells[2], - }, - }); - vm.$mount(); + vm = setupComponent(json.cells[2]); setTimeout(() => { done(); @@ -52,4 +52,23 @@ describe('Code component', () => { expect(vm.$el.querySelector('.output')).toBeDefined(); }); }); + + describe('with string for cell.source', () => { + beforeEach(done => { + const cell = json.cells[0]; + cell.source = cell.source.join(''); + + vm = setupComponent(cell); + + setTimeout(() => { + done(); + }); + }); + + it('renders the same input as when cell.source is an array', () => { + const expected = "console.log('test')"; + + expect(vm.$el.querySelector('.input').innerText).toContain(expected); + }); + }); }); |