summaryrefslogtreecommitdiff
path: root/spec/javascripts/ide/lib/editor_spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'spec/javascripts/ide/lib/editor_spec.js')
-rw-r--r--spec/javascripts/ide/lib/editor_spec.js55
1 files changed, 54 insertions, 1 deletions
diff --git a/spec/javascripts/ide/lib/editor_spec.js b/spec/javascripts/ide/lib/editor_spec.js
index ec56ebc0341..75e6f0f54ec 100644
--- a/spec/javascripts/ide/lib/editor_spec.js
+++ b/spec/javascripts/ide/lib/editor_spec.js
@@ -76,7 +76,8 @@ describe('Multi-file editor library', () => {
occurrencesHighlight: false,
renderLineHighlight: 'none',
hideCursorInOverviewRuler: true,
- wordWrap: 'bounded',
+ wordWrap: 'on',
+ renderSideBySide: true,
});
});
});
@@ -215,4 +216,56 @@ describe('Multi-file editor library', () => {
expect(instance.decorationsController.dispose).not.toHaveBeenCalled();
});
});
+
+ describe('updateDiffView', () => {
+ describe('edit mode', () => {
+ it('does not update options', () => {
+ instance.createInstance(holder);
+
+ spyOn(instance.instance, 'updateOptions');
+
+ instance.updateDiffView();
+
+ expect(instance.instance.updateOptions).not.toHaveBeenCalled();
+ });
+ });
+
+ describe('diff mode', () => {
+ beforeEach(() => {
+ instance.createDiffInstance(holder);
+
+ spyOn(instance.instance, 'updateOptions').and.callThrough();
+ });
+
+ it('sets renderSideBySide to false if el is less than 700 pixels', () => {
+ spyOnProperty(instance.instance.getDomNode(), 'offsetWidth').and.returnValue(600);
+
+ expect(instance.instance.updateOptions).not.toHaveBeenCalledWith({
+ renderSideBySide: false,
+ });
+ });
+
+ it('sets renderSideBySide to false if el is more than 700 pixels', () => {
+ spyOnProperty(instance.instance.getDomNode(), 'offsetWidth').and.returnValue(800);
+
+ expect(instance.instance.updateOptions).not.toHaveBeenCalledWith({
+ renderSideBySide: true,
+ });
+ });
+ });
+ });
+
+ describe('isDiffEditorType', () => {
+ it('returns true when diff editor', () => {
+ instance.createDiffInstance(holder);
+
+ expect(instance.isDiffEditorType).toBe(true);
+ });
+
+ it('returns false when not diff editor', () => {
+ instance.createInstance(holder);
+
+ expect(instance.isDiffEditorType).toBe(false);
+ });
+ });
});