diff options
author | Phil Hughes <me@iamphill.com> | 2018-03-20 14:16:38 +0000 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2018-03-20 14:16:38 +0000 |
commit | af22ddafe4e580850e183993ae276b1f0f565ca6 (patch) | |
tree | 61cb2d55e15e8f57f49a48161835216f4e099755 /spec/javascripts/ide/lib | |
parent | f527e6e1855f30cf5ca5cb834b2d20438299a70e (diff) | |
download | gitlab-ce-af22ddafe4e580850e183993ae276b1f0f565ca6.tar.gz |
updated file references in specs
Diffstat (limited to 'spec/javascripts/ide/lib')
-rw-r--r-- | spec/javascripts/ide/lib/common/disposable_spec.js | 2 | ||||
-rw-r--r-- | spec/javascripts/ide/lib/common/model_manager_spec.js | 18 | ||||
-rw-r--r-- | spec/javascripts/ide/lib/common/model_spec.js | 20 | ||||
-rw-r--r-- | spec/javascripts/ide/lib/decorations/controller_spec.js | 47 | ||||
-rw-r--r-- | spec/javascripts/ide/lib/diff/controller_spec.js | 78 | ||||
-rw-r--r-- | spec/javascripts/ide/lib/diff/diff_spec.js | 2 | ||||
-rw-r--r-- | spec/javascripts/ide/lib/editor_options_spec.js | 2 | ||||
-rw-r--r-- | spec/javascripts/ide/lib/editor_spec.js | 4 |
8 files changed, 112 insertions, 61 deletions
diff --git a/spec/javascripts/ide/lib/common/disposable_spec.js b/spec/javascripts/ide/lib/common/disposable_spec.js index 677986aff91..af12ca15369 100644 --- a/spec/javascripts/ide/lib/common/disposable_spec.js +++ b/spec/javascripts/ide/lib/common/disposable_spec.js @@ -1,4 +1,4 @@ -import Disposable from 'ee/ide/lib/common/disposable'; +import Disposable from '~/ide/lib/common/disposable'; describe('Multi-file editor library disposable class', () => { let instance; diff --git a/spec/javascripts/ide/lib/common/model_manager_spec.js b/spec/javascripts/ide/lib/common/model_manager_spec.js index 7a1fab0f74d..4381f6fcfd0 100644 --- a/spec/javascripts/ide/lib/common/model_manager_spec.js +++ b/spec/javascripts/ide/lib/common/model_manager_spec.js @@ -1,13 +1,13 @@ /* global monaco */ -import eventHub from 'ee/ide/eventhub'; -import monacoLoader from 'ee/ide/monaco_loader'; -import ModelManager from 'ee/ide/lib/common/model_manager'; +import eventHub from '~/ide/eventhub'; +import monacoLoader from '~/ide/monaco_loader'; +import ModelManager from '~/ide/lib/common/model_manager'; import { file } from '../../helpers'; describe('Multi-file editor library model manager', () => { let instance; - beforeEach((done) => { + beforeEach(done => { monacoLoader(['vs/editor/editor.main'], () => { instance = new ModelManager(monaco); @@ -55,7 +55,10 @@ describe('Multi-file editor library model manager', () => { instance.addModel(f); - expect(eventHub.$on).toHaveBeenCalledWith(`editor.update.model.dispose.${f.path}`, jasmine.anything()); + expect(eventHub.$on).toHaveBeenCalledWith( + `editor.update.model.dispose.${f.path}`, + jasmine.anything(), + ); }); }); @@ -99,7 +102,10 @@ describe('Multi-file editor library model manager', () => { instance.removeCachedModel(f); - expect(eventHub.$off).toHaveBeenCalledWith(`editor.update.model.dispose.${f.path}`, jasmine.anything()); + expect(eventHub.$off).toHaveBeenCalledWith( + `editor.update.model.dispose.${f.path}`, + jasmine.anything(), + ); }); }); diff --git a/spec/javascripts/ide/lib/common/model_spec.js b/spec/javascripts/ide/lib/common/model_spec.js index dd9e4946883..adc6a93c06b 100644 --- a/spec/javascripts/ide/lib/common/model_spec.js +++ b/spec/javascripts/ide/lib/common/model_spec.js @@ -1,13 +1,13 @@ /* global monaco */ -import eventHub from 'ee/ide/eventhub'; -import monacoLoader from 'ee/ide/monaco_loader'; -import Model from 'ee/ide/lib/common/model'; +import eventHub from '~/ide/eventhub'; +import monacoLoader from '~/ide/monaco_loader'; +import Model from '~/ide/lib/common/model'; import { file } from '../../helpers'; describe('Multi-file editor library model', () => { let model; - beforeEach((done) => { + beforeEach(done => { spyOn(eventHub, '$on').and.callThrough(); monacoLoader(['vs/editor/editor.main'], () => { @@ -27,7 +27,10 @@ describe('Multi-file editor library model', () => { }); it('adds eventHub listener', () => { - expect(eventHub.$on).toHaveBeenCalledWith(`editor.update.model.dispose.${model.file.path}`, jasmine.anything()); + expect(eventHub.$on).toHaveBeenCalledWith( + `editor.update.model.dispose.${model.file.path}`, + jasmine.anything(), + ); }); describe('path', () => { @@ -64,7 +67,7 @@ describe('Multi-file editor library model', () => { expect(model.events.keys().next().value).toBe('path'); }); - it('calls callback on change', (done) => { + it('calls callback on change', done => { const spy = jasmine.createSpy(); model.onChange(spy); @@ -101,7 +104,10 @@ describe('Multi-file editor library model', () => { model.dispose(); - expect(eventHub.$off).toHaveBeenCalledWith(`editor.update.model.dispose.${model.file.path}`, jasmine.anything()); + expect(eventHub.$off).toHaveBeenCalledWith( + `editor.update.model.dispose.${model.file.path}`, + jasmine.anything(), + ); }); }); }); diff --git a/spec/javascripts/ide/lib/decorations/controller_spec.js b/spec/javascripts/ide/lib/decorations/controller_spec.js index 63e4282d4df..092170d086a 100644 --- a/spec/javascripts/ide/lib/decorations/controller_spec.js +++ b/spec/javascripts/ide/lib/decorations/controller_spec.js @@ -1,8 +1,8 @@ /* global monaco */ -import monacoLoader from 'ee/ide/monaco_loader'; -import editor from 'ee/ide/lib/editor'; -import DecorationsController from 'ee/ide/lib/decorations/controller'; -import Model from 'ee/ide/lib/common/model'; +import monacoLoader from '~/ide/monaco_loader'; +import editor from '~/ide/lib/editor'; +import DecorationsController from '~/ide/lib/decorations/controller'; +import Model from '~/ide/lib/common/model'; import { file } from '../../helpers'; describe('Multi-file editor library decorations controller', () => { @@ -10,7 +10,7 @@ describe('Multi-file editor library decorations controller', () => { let controller; let model; - beforeEach((done) => { + beforeEach(done => { monacoLoader(['vs/editor/editor.main'], () => { editorInstance = editor.create(monaco); editorInstance.createInstance(document.createElement('div')); @@ -36,7 +36,9 @@ describe('Multi-file editor library decorations controller', () => { }); it('returns decorations by model URL', () => { - controller.addDecorations(model, 'key', [{ decoration: 'decorationValue' }]); + controller.addDecorations(model, 'key', [ + { decoration: 'decorationValue' }, + ]); const decorations = controller.getAllDecorationsForModel(model); @@ -46,20 +48,28 @@ describe('Multi-file editor library decorations controller', () => { describe('addDecorations', () => { it('caches decorations in a new map', () => { - controller.addDecorations(model, 'key', [{ decoration: 'decorationValue' }]); + controller.addDecorations(model, 'key', [ + { decoration: 'decorationValue' }, + ]); expect(controller.decorations.size).toBe(1); }); it('does not create new cache model', () => { - controller.addDecorations(model, 'key', [{ decoration: 'decorationValue' }]); - controller.addDecorations(model, 'key', [{ decoration: 'decorationValue2' }]); + controller.addDecorations(model, 'key', [ + { decoration: 'decorationValue' }, + ]); + controller.addDecorations(model, 'key', [ + { decoration: 'decorationValue2' }, + ]); expect(controller.decorations.size).toBe(1); }); it('caches decorations by model URL', () => { - controller.addDecorations(model, 'key', [{ decoration: 'decorationValue' }]); + controller.addDecorations(model, 'key', [ + { decoration: 'decorationValue' }, + ]); expect(controller.decorations.size).toBe(1); expect(controller.decorations.keys().next().value).toBe('path'); @@ -68,7 +78,9 @@ describe('Multi-file editor library decorations controller', () => { it('calls decorate method', () => { spyOn(controller, 'decorate'); - controller.addDecorations(model, 'key', [{ decoration: 'decorationValue' }]); + controller.addDecorations(model, 'key', [ + { decoration: 'decorationValue' }, + ]); expect(controller.decorate).toHaveBeenCalled(); }); @@ -80,7 +92,10 @@ describe('Multi-file editor library decorations controller', () => { controller.decorate(model); - expect(controller.editor.instance.deltaDecorations).toHaveBeenCalledWith([], []); + expect(controller.editor.instance.deltaDecorations).toHaveBeenCalledWith( + [], + [], + ); }); it('caches decorations', () => { @@ -102,7 +117,9 @@ describe('Multi-file editor library decorations controller', () => { describe('dispose', () => { it('clears cached decorations', () => { - controller.addDecorations(model, 'key', [{ decoration: 'decorationValue' }]); + controller.addDecorations(model, 'key', [ + { decoration: 'decorationValue' }, + ]); controller.dispose(); @@ -110,7 +127,9 @@ describe('Multi-file editor library decorations controller', () => { }); it('clears cached editorDecorations', () => { - controller.addDecorations(model, 'key', [{ decoration: 'decorationValue' }]); + controller.addDecorations(model, 'key', [ + { decoration: 'decorationValue' }, + ]); controller.dispose(); diff --git a/spec/javascripts/ide/lib/diff/controller_spec.js b/spec/javascripts/ide/lib/diff/controller_spec.js index 90216f8b07e..c8f3e9f4830 100644 --- a/spec/javascripts/ide/lib/diff/controller_spec.js +++ b/spec/javascripts/ide/lib/diff/controller_spec.js @@ -1,10 +1,13 @@ /* global monaco */ -import monacoLoader from 'ee/ide/monaco_loader'; -import editor from 'ee/ide/lib/editor'; -import ModelManager from 'ee/ide/lib/common/model_manager'; -import DecorationsController from 'ee/ide/lib/decorations/controller'; -import DirtyDiffController, { getDiffChangeType, getDecorator } from 'ee/ide/lib/diff/controller'; -import { computeDiff } from 'ee/ide/lib/diff/diff'; +import monacoLoader from '~/ide/monaco_loader'; +import editor from '~/ide/lib/editor'; +import ModelManager from '~/ide/lib/common/model_manager'; +import DecorationsController from '~/ide/lib/decorations/controller'; +import DirtyDiffController, { + getDiffChangeType, + getDecorator, +} from '~/ide/lib/diff/controller'; +import { computeDiff } from '~/ide/lib/diff/diff'; import { file } from '../../helpers'; describe('Multi-file editor library dirty diff controller', () => { @@ -14,7 +17,7 @@ describe('Multi-file editor library dirty diff controller', () => { let decorationsController; let model; - beforeEach((done) => { + beforeEach(done => { monacoLoader(['vs/editor/editor.main'], () => { editorInstance = editor.create(monaco); editorInstance.createInstance(document.createElement('div')); @@ -38,7 +41,7 @@ describe('Multi-file editor library dirty diff controller', () => { }); describe('getDiffChangeType', () => { - ['added', 'removed', 'modified'].forEach((type) => { + ['added', 'removed', 'modified'].forEach(type => { it(`returns ${type}`, () => { const change = { [type]: true, @@ -50,15 +53,15 @@ describe('Multi-file editor library dirty diff controller', () => { }); describe('getDecorator', () => { - ['added', 'removed', 'modified'].forEach((type) => { + ['added', 'removed', 'modified'].forEach(type => { it(`returns with linesDecorationsClassName for ${type}`, () => { const change = { [type]: true, }; - expect( - getDecorator(change).options.linesDecorationsClassName, - ).toBe(`dirty-diff dirty-diff-${type}`); + expect(getDecorator(change).options.linesDecorationsClassName).toBe( + `dirty-diff dirty-diff-${type}`, + ); }); it('returns with line numbers', () => { @@ -118,7 +121,9 @@ describe('Multi-file editor library dirty diff controller', () => { controller.reDecorate(model); - expect(controller.decorationsController.decorate).toHaveBeenCalledWith(model); + expect(controller.decorationsController.decorate).toHaveBeenCalledWith( + model, + ); }); }); @@ -128,23 +133,33 @@ describe('Multi-file editor library dirty diff controller', () => { controller.decorate({ data: { changes: [], path: 'path' } }); - expect(controller.decorationsController.addDecorations).toHaveBeenCalledWith(model, 'dirtyDiff', jasmine.anything()); + expect( + controller.decorationsController.addDecorations, + ).toHaveBeenCalledWith(model, 'dirtyDiff', jasmine.anything()); }); it('adds decorations into editor', () => { - const spy = spyOn(controller.decorationsController.editor.instance, 'deltaDecorations'); - - controller.decorate({ data: { changes: computeDiff('123', '1234'), path: 'path' } }); - - expect(spy).toHaveBeenCalledWith([], [{ - range: new monaco.Range( - 1, 1, 1, 1, - ), - options: { - isWholeLine: true, - linesDecorationsClassName: 'dirty-diff dirty-diff-modified', - }, - }]); + const spy = spyOn( + controller.decorationsController.editor.instance, + 'deltaDecorations', + ); + + controller.decorate({ + data: { changes: computeDiff('123', '1234'), path: 'path' }, + }); + + expect(spy).toHaveBeenCalledWith( + [], + [ + { + range: new monaco.Range(1, 1, 1, 1), + options: { + isWholeLine: true, + linesDecorationsClassName: 'dirty-diff dirty-diff-modified', + }, + }, + ], + ); }); }); @@ -166,11 +181,16 @@ describe('Multi-file editor library dirty diff controller', () => { }); it('removes worker event listener', () => { - spyOn(controller.dirtyDiffWorker, 'removeEventListener').and.callThrough(); + spyOn( + controller.dirtyDiffWorker, + 'removeEventListener', + ).and.callThrough(); controller.dispose(); - expect(controller.dirtyDiffWorker.removeEventListener).toHaveBeenCalledWith('message', jasmine.anything()); + expect( + controller.dirtyDiffWorker.removeEventListener, + ).toHaveBeenCalledWith('message', jasmine.anything()); }); }); }); diff --git a/spec/javascripts/ide/lib/diff/diff_spec.js b/spec/javascripts/ide/lib/diff/diff_spec.js index 3bdd0a77e40..57f3ac3d365 100644 --- a/spec/javascripts/ide/lib/diff/diff_spec.js +++ b/spec/javascripts/ide/lib/diff/diff_spec.js @@ -1,4 +1,4 @@ -import { computeDiff } from 'ee/ide/lib/diff/diff'; +import { computeDiff } from '~/ide/lib/diff/diff'; describe('Multi-file editor library diff calculator', () => { describe('computeDiff', () => { diff --git a/spec/javascripts/ide/lib/editor_options_spec.js b/spec/javascripts/ide/lib/editor_options_spec.js index b974a6befd3..d149a883166 100644 --- a/spec/javascripts/ide/lib/editor_options_spec.js +++ b/spec/javascripts/ide/lib/editor_options_spec.js @@ -1,4 +1,4 @@ -import editorOptions from 'ee/ide/lib/editor_options'; +import editorOptions from '~/ide/lib/editor_options'; describe('Multi-file editor library editor options', () => { it('returns an array', () => { diff --git a/spec/javascripts/ide/lib/editor_spec.js b/spec/javascripts/ide/lib/editor_spec.js index 76869bbc7ce..d6df35c90e8 100644 --- a/spec/javascripts/ide/lib/editor_spec.js +++ b/spec/javascripts/ide/lib/editor_spec.js @@ -1,6 +1,6 @@ /* global monaco */ -import monacoLoader from 'ee/ide/monaco_loader'; -import editor from 'ee/ide/lib/editor'; +import monacoLoader from '~/ide/monaco_loader'; +import editor from '~/ide/lib/editor'; import { file } from '../helpers'; describe('Multi-file editor library', () => { |