Skip to content

Commit 5799920

Browse files
committed
Spec cleanup
Remove unnecessary return statements
1 parent 2a1e10a commit 5799920

3 files changed

Lines changed: 27 additions & 29 deletions

File tree

spec/pane-container-element-spec.js

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ describe('PaneContainerElement', function() {
4242
]);
4343

4444
paneAxis.removeChild(paneAxis.getChildren()[2]);
45-
return expect(childTagNames()).toEqual([
45+
expect(childTagNames()).toEqual([
4646
'atom-pane-axis',
4747
'atom-pane-resize-handle',
4848
'atom-pane-axis'
4949
]);
5050
});
5151

52-
return it('transfers focus to the next pane if a focused pane is removed', function() {
52+
it('transfers focus to the next pane if a focused pane is removed', function() {
5353
const container = new PaneContainer(params);
5454
const containerElement = container.getElement();
5555
const leftPane = container.getActivePane();
@@ -62,8 +62,8 @@ describe('PaneContainerElement', function() {
6262
expect(document.activeElement).toBe(rightPaneElement);
6363

6464
rightPane.destroy();
65-
expect(containerElement).toHaveClass('panes')
66-
return expect(document.activeElement).toBe(leftPaneElement);
65+
expect(containerElement).toHaveClass('panes');
66+
expect(document.activeElement).toBe(leftPaneElement);
6767
});
6868
});
6969

@@ -95,7 +95,7 @@ describe('PaneContainerElement', function() {
9595
);
9696
expect(verticalPanes.length).toBe(2);
9797
expect(verticalPanes[0]).toBe(pane2.getElement());
98-
return expect(verticalPanes[1]).toBe(pane3.getElement());
98+
expect(verticalPanes[1]).toBe(pane3.getElement());
9999
}));
100100

101101
describe('when the resize element is dragged ', function() {
@@ -104,9 +104,7 @@ describe('PaneContainerElement', function() {
104104
beforeEach(function() {
105105
container = new PaneContainer(params);
106106
containerElement = container.getElement();
107-
return document
108-
.querySelector('#jasmine-content')
109-
.appendChild(containerElement);
107+
document.querySelector('#jasmine-content').appendChild(containerElement);
110108
});
111109

112110
const dragElementToPosition = function(element, clientX) {
@@ -126,7 +124,7 @@ describe('PaneContainerElement', function() {
126124
})
127125
);
128126

129-
return element.dispatchEvent(
127+
element.dispatchEvent(
130128
new MouseEvent('mouseup', {
131129
iew: window,
132130
bubbles: true,
@@ -181,7 +179,7 @@ describe('PaneContainerElement', function() {
181179
runs(() => expectPaneScale([leftPane, 0.44], [rightPane, 1.55]));
182180

183181
waitsForPromise(() => leftPane.close());
184-
return runs(() => expectPaneScale([rightPane, 1]));
182+
runs(() => expectPaneScale([rightPane, 1]));
185183
});
186184

187185
it('splits or closes panes in orthogonal direction that the pane is being dragged', function() {
@@ -207,7 +205,7 @@ describe('PaneContainerElement', function() {
207205

208206
// dynamically close pane, the pane's flexscale will recover to origin value
209207
waitsForPromise(() => lowerPane.close());
210-
return runs(() => expectPaneScale([leftPane, 0.5], [rightPane, 1.5]));
208+
runs(() => expectPaneScale([leftPane, 0.5], [rightPane, 1.5]));
211209
});
212210

213211
it('unsubscribes from mouse events when the pane is detached', function() {
@@ -227,19 +225,19 @@ describe('PaneContainerElement', function() {
227225

228226
waitsFor(() => document.addEventListener.callCount === 2);
229227

230-
return runs(function() {
228+
runs(function() {
231229
expect(element.resizeStopped.callCount).toBe(0);
232230
container.destroy();
233231
expect(element.resizeStopped.callCount).toBe(1);
234-
return expect(document.removeEventListener.callCount).toBe(2);
232+
expect(document.removeEventListener.callCount).toBe(2);
235233
});
236234
});
237235

238-
return it('does not throw an error when resized to fit content in a detached state', function() {
236+
it('does not throw an error when resized to fit content in a detached state', function() {
239237
container.getActivePane().splitRight();
240238
const element = getResizeElement(0);
241239
element.remove();
242-
return expect(() => element.resizeToFitContent()).not.toThrow();
240+
expect(() => element.resizeToFitContent()).not.toThrow();
243241
});
244242
});
245243

@@ -249,7 +247,7 @@ describe('PaneContainerElement', function() {
249247
beforeEach(function() {
250248
const container = new PaneContainer(params);
251249
leftPane = container.getActivePane();
252-
return (rightPane = leftPane.splitRight());
250+
rightPane = leftPane.splitRight();
253251
});
254252

255253
describe('when pane:increase-size is triggered', () =>
@@ -263,10 +261,10 @@ describe('PaneContainerElement', function() {
263261

264262
atom.commands.dispatch(rightPane.getElement(), 'pane:increase-size');
265263
expect(leftPane.getFlexScale()).toBe(1.1);
266-
return expect(rightPane.getFlexScale()).toBe(1.1);
264+
expect(rightPane.getFlexScale()).toBe(1.1);
267265
}));
268266

269-
return describe('when pane:decrease-size is triggered', () =>
267+
describe('when pane:decrease-size is triggered', () =>
270268
it('decreases the size of the pane', function() {
271269
expect(leftPane.getFlexScale()).toBe(1);
272270
expect(rightPane.getFlexScale()).toBe(1);
@@ -277,16 +275,16 @@ describe('PaneContainerElement', function() {
277275

278276
atom.commands.dispatch(rightPane.getElement(), 'pane:decrease-size');
279277
expect(leftPane.getFlexScale()).toBe(1 / 1.1);
280-
return expect(rightPane.getFlexScale()).toBe(1 / 1.1);
278+
expect(rightPane.getFlexScale()).toBe(1 / 1.1);
281279
}));
282280
});
283281

284-
return describe('when only a single pane is present', function() {
282+
describe('when only a single pane is present', function() {
285283
let [singlePane] = [];
286284

287285
beforeEach(function() {
288286
const container = new PaneContainer(params);
289-
return (singlePane = container.getActivePane());
287+
singlePane = container.getActivePane();
290288
});
291289

292290
describe('when pane:increase-size is triggered', () =>
@@ -297,18 +295,18 @@ describe('PaneContainerElement', function() {
297295
expect(singlePane.getFlexScale()).toBe(1);
298296

299297
atom.commands.dispatch(singlePane.getElement(), 'pane:increase-size');
300-
return expect(singlePane.getFlexScale()).toBe(1);
298+
expect(singlePane.getFlexScale()).toBe(1);
301299
}));
302300

303-
return describe('when pane:decrease-size is triggered', () =>
301+
describe('when pane:decrease-size is triggered', () =>
304302
it('does not decreases the size of the pane', function() {
305303
expect(singlePane.getFlexScale()).toBe(1);
306304

307305
atom.commands.dispatch(singlePane.getElement(), 'pane:decrease-size');
308306
expect(singlePane.getFlexScale()).toBe(1);
309307

310308
atom.commands.dispatch(singlePane.getElement(), 'pane:decrease-size');
311-
return expect(singlePane.getFlexScale()).toBe(1);
309+
expect(singlePane.getFlexScale()).toBe(1);
312310
}));
313311
});
314312
});

src/pane-container-element.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const { CompositeDisposable } = require('event-kit');
22

33
class PaneContainerElement extends HTMLElement {
44
constructor() {
5-
super()
5+
super();
66
this.subscriptions = new CompositeDisposable();
77
}
88

@@ -43,12 +43,12 @@ class PaneContainerElement extends HTMLElement {
4343
}
4444
}
4545

46-
window.customElements.define('atom-pane-container', PaneContainerElement)
46+
window.customElements.define('atom-pane-container', PaneContainerElement);
4747

4848
function createPaneContainerElement() {
49-
return document.createElement('atom-pane-container')
49+
return document.createElement('atom-pane-container');
5050
}
5151

5252
module.exports = {
5353
createPaneContainerElement
54-
}
54+
};

src/pane-container.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const { find } = require('underscore-plus');
22
const { Emitter, CompositeDisposable } = require('event-kit');
33
const Pane = require('./pane');
44
const ItemRegistry = require('./item-registry');
5-
const {createPaneContainerElement} = require('./pane-container-element');
5+
const { createPaneContainerElement } = require('./pane-container-element');
66

77
const SERIALIZATION_VERSION = 1;
88
const STOPPED_CHANGING_ACTIVE_PANE_ITEM_DELAY = 100;

0 commit comments

Comments
 (0)