diff options
author | Mike Greiling <mike@pixelcog.com> | 2018-10-17 10:13:26 +0300 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2018-10-17 19:18:17 +0300 |
commit | f666026d71ebefd70219d5078b1f0c83fa01f84d (patch) | |
tree | ce43feb99c12c21dd266d25de24b1768bac1d459 /spec/javascripts/notebook | |
parent | 5a6fffcffca3dc8e4f52c90d3d18eaefd9e48aef (diff) |
Prettify all spec files
Diffstat (limited to 'spec/javascripts/notebook')
-rw-r--r-- | spec/javascripts/notebook/cells/code_spec.js | 4 | ||||
-rw-r--r-- | spec/javascripts/notebook/cells/markdown_spec.js | 30 | ||||
-rw-r--r-- | spec/javascripts/notebook/cells/output/html_sanitize_tests.js | 8 | ||||
-rw-r--r-- | spec/javascripts/notebook/cells/output/html_spec.js | 2 | ||||
-rw-r--r-- | spec/javascripts/notebook/cells/output/index_spec.js | 14 | ||||
-rw-r--r-- | spec/javascripts/notebook/cells/prompt_spec.js | 4 | ||||
-rw-r--r-- | spec/javascripts/notebook/index_spec.js | 10 |
7 files changed, 35 insertions, 37 deletions
diff --git a/spec/javascripts/notebook/cells/code_spec.js b/spec/javascripts/notebook/cells/code_spec.js index 0c432d73f67..4659b83d1b6 100644 --- a/spec/javascripts/notebook/cells/code_spec.js +++ b/spec/javascripts/notebook/cells/code_spec.js @@ -12,7 +12,7 @@ describe('Code component', () => { }); describe('without output', () => { - beforeEach((done) => { + beforeEach(done => { vm = new Component({ propsData: { cell: json.cells[0], @@ -31,7 +31,7 @@ describe('Code component', () => { }); describe('with output', () => { - beforeEach((done) => { + beforeEach(done => { vm = new Component({ propsData: { cell: json.cells[2], diff --git a/spec/javascripts/notebook/cells/markdown_spec.js b/spec/javascripts/notebook/cells/markdown_spec.js index 0b1b11de1fd..540fc8a21f1 100644 --- a/spec/javascripts/notebook/cells/markdown_spec.js +++ b/spec/javascripts/notebook/cells/markdown_spec.js @@ -11,7 +11,7 @@ describe('Markdown component', () => { let cell; let json; - beforeEach((done) => { + beforeEach(done => { json = getJSONFixture('blob/notebook/basic.json'); // eslint-disable-next-line prefer-destructuring @@ -34,18 +34,18 @@ describe('Markdown component', () => { }); it('does not render the markdown text', () => { - expect( - vm.$el.querySelector('.markdown').innerHTML.trim(), - ).not.toEqual(cell.source.join('')); + expect(vm.$el.querySelector('.markdown').innerHTML.trim()).not.toEqual(cell.source.join('')); }); it('renders the markdown HTML', () => { expect(vm.$el.querySelector('.markdown h1')).not.toBeNull(); }); - it('sanitizes output', (done) => { + it('sanitizes output', done => { Object.assign(cell, { - source: ['[XSS](data:text/html;base64,PHNjcmlwdD5hbGVydChkb2N1bWVudC5kb21haW4pPC9zY3JpcHQ+Cg==)\n'], + source: [ + '[XSS](data:text/html;base64,PHNjcmlwdD5hbGVydChkb2N1bWVudC5kb21haW4pPC9zY3JpcHQ+Cg==)\n', + ], }); Vue.nextTick(() => { @@ -60,7 +60,7 @@ describe('Markdown component', () => { json = getJSONFixture('blob/notebook/math.json'); }); - it('renders multi-line katex', (done) => { + it('renders multi-line katex', done => { vm = new Component({ propsData: { cell: json.cells[0], @@ -68,15 +68,13 @@ describe('Markdown component', () => { }).$mount(); Vue.nextTick(() => { - expect( - vm.$el.querySelector('.katex'), - ).not.toBeNull(); + expect(vm.$el.querySelector('.katex')).not.toBeNull(); done(); }); }); - it('renders inline katex', (done) => { + it('renders inline katex', done => { vm = new Component({ propsData: { cell: json.cells[1], @@ -84,15 +82,13 @@ describe('Markdown component', () => { }).$mount(); Vue.nextTick(() => { - expect( - vm.$el.querySelector('p:first-child .katex'), - ).not.toBeNull(); + expect(vm.$el.querySelector('p:first-child .katex')).not.toBeNull(); done(); }); }); - it('renders multiple inline katex', (done) => { + it('renders multiple inline katex', done => { vm = new Component({ propsData: { cell: json.cells[1], @@ -100,9 +96,7 @@ describe('Markdown component', () => { }).$mount(); Vue.nextTick(() => { - expect( - vm.$el.querySelectorAll('p:nth-child(2) .katex').length, - ).toBe(4); + expect(vm.$el.querySelectorAll('p:nth-child(2) .katex').length).toBe(4); done(); }); diff --git a/spec/javascripts/notebook/cells/output/html_sanitize_tests.js b/spec/javascripts/notebook/cells/output/html_sanitize_tests.js index d587573fc9e..844a1841c81 100644 --- a/spec/javascripts/notebook/cells/output/html_sanitize_tests.js +++ b/spec/javascripts/notebook/cells/output/html_sanitize_tests.js @@ -28,7 +28,8 @@ export default { output: '<a>foo</a>', }, 'protocol-based JS injection: long UTF-8 encoding without semicolons': { - input: '<a href=javascript:alert('XSS')>foo</a>', + input: + '<a href=javascript:alert('XSS')>foo</a>', output: '<a>foo</a>', }, 'protocol-based JS injection: hex encoding': { @@ -40,7 +41,8 @@ export default { output: '<a>foo</a>', }, 'protocol-based JS injection: hex encoding without semicolons': { - input: '<a href=javascript:alert('XSS')>foo</a>', + input: + '<a href=javascript:alert('XSS')>foo</a>', output: '<a>foo</a>', }, 'protocol-based JS injection: null char': { @@ -48,7 +50,7 @@ export default { output: '<a>foo</a>', }, 'protocol-based JS injection: invalid URL char': { - input: '<img src=java\script:alert("XSS")>', // eslint-disable-line no-useless-escape + input: '<img src=javascript:alert("XSS")>', // eslint-disable-line no-useless-escape output: '<img>', }, 'protocol-based JS injection: Unicode': { diff --git a/spec/javascripts/notebook/cells/output/html_spec.js b/spec/javascripts/notebook/cells/output/html_spec.js index 9c5385f2922..bea62f54634 100644 --- a/spec/javascripts/notebook/cells/output/html_spec.js +++ b/spec/javascripts/notebook/cells/output/html_spec.js @@ -14,7 +14,7 @@ describe('html output cell', () => { } describe('sanitizes output', () => { - Object.keys(sanitizeTests).forEach((key) => { + Object.keys(sanitizeTests).forEach(key => { it(key, () => { const test = sanitizeTests[key]; const vm = createComponent(test.input); diff --git a/spec/javascripts/notebook/cells/output/index_spec.js b/spec/javascripts/notebook/cells/output/index_spec.js index dbf79f85c7c..feab7ad4212 100644 --- a/spec/javascripts/notebook/cells/output/index_spec.js +++ b/spec/javascripts/notebook/cells/output/index_spec.js @@ -7,7 +7,7 @@ describe('Output component', () => { let vm; let json; - const createComponent = (output) => { + const createComponent = output => { vm = new Component({ propsData: { output, @@ -22,7 +22,7 @@ describe('Output component', () => { }); describe('text output', () => { - beforeEach((done) => { + beforeEach(done => { createComponent(json.cells[2].outputs[0]); setTimeout(() => { @@ -40,7 +40,7 @@ describe('Output component', () => { }); describe('image output', () => { - beforeEach((done) => { + beforeEach(done => { createComponent(json.cells[3].outputs[0]); setTimeout(() => { @@ -58,7 +58,7 @@ describe('Output component', () => { }); describe('html output', () => { - beforeEach((done) => { + beforeEach(done => { createComponent(json.cells[4].outputs[0]); setTimeout(() => { @@ -77,7 +77,7 @@ describe('Output component', () => { }); describe('svg output', () => { - beforeEach((done) => { + beforeEach(done => { createComponent(json.cells[5].outputs[0]); setTimeout(() => { @@ -95,7 +95,7 @@ describe('Output component', () => { }); describe('default to plain text', () => { - beforeEach((done) => { + beforeEach(done => { createComponent(json.cells[6].outputs[0]); setTimeout(() => { @@ -112,7 +112,7 @@ describe('Output component', () => { expect(vm.$el.querySelector('.prompt span')).not.toBeNull(); }); - it('renders as plain text when doesn\'t recognise other types', (done) => { + it("renders as plain text when doesn't recognise other types", done => { createComponent(json.cells[7].outputs[0]); setTimeout(() => { diff --git a/spec/javascripts/notebook/cells/prompt_spec.js b/spec/javascripts/notebook/cells/prompt_spec.js index 207fa433a59..cbbcb1e68e3 100644 --- a/spec/javascripts/notebook/cells/prompt_spec.js +++ b/spec/javascripts/notebook/cells/prompt_spec.js @@ -7,7 +7,7 @@ describe('Prompt component', () => { let vm; describe('input', () => { - beforeEach((done) => { + beforeEach(done => { vm = new Component({ propsData: { type: 'In', @@ -31,7 +31,7 @@ describe('Prompt component', () => { }); describe('output', () => { - beforeEach((done) => { + beforeEach(done => { vm = new Component({ propsData: { type: 'Out', diff --git a/spec/javascripts/notebook/index_spec.js b/spec/javascripts/notebook/index_spec.js index bd63ab35426..2e2ea5ad8af 100644 --- a/spec/javascripts/notebook/index_spec.js +++ b/spec/javascripts/notebook/index_spec.js @@ -14,7 +14,7 @@ describe('Notebook component', () => { }); describe('without JSON', () => { - beforeEach((done) => { + beforeEach(done => { vm = new Component({ propsData: { notebook: {}, @@ -33,7 +33,7 @@ describe('Notebook component', () => { }); describe('with JSON', () => { - beforeEach((done) => { + beforeEach(done => { vm = new Component({ propsData: { notebook: json, @@ -65,7 +65,7 @@ describe('Notebook component', () => { }); describe('with worksheets', () => { - beforeEach((done) => { + beforeEach(done => { vm = new Component({ propsData: { notebook: jsonWithWorksheet, @@ -80,7 +80,9 @@ describe('Notebook component', () => { }); it('renders cells', () => { - expect(vm.$el.querySelectorAll('.cell').length).toBe(jsonWithWorksheet.worksheets[0].cells.length); + expect(vm.$el.querySelectorAll('.cell').length).toBe( + jsonWithWorksheet.worksheets[0].cells.length, + ); }); it('renders markdown cell', () => { |