Lint fixture file from git-diff package

This commit is contained in:
Rafael Oleza
2019-02-25 12:27:10 +01:00
parent e734434811
commit 20ec642da1
18 changed files with 34 additions and 27 deletions

View File

@@ -22,7 +22,7 @@ describe('git-diff:toggle-diff-list', () => {
runs(() => {
editor = atom.workspace.getActiveTextEditor()
editor.setCursorBufferPosition([4, 29])
editor.setCursorBufferPosition([3, 28])
editor.insertText('a')
atom.commands.dispatch(editor.getElement(), 'git-diff:toggle-diff-list')
})
@@ -35,7 +35,7 @@ describe('git-diff:toggle-diff-list', () => {
it('shows a list of all diff hunks', () => {
diffListView = document.querySelector('.diff-list-view ol')
expect(diffListView.textContent).toBe('while(items.length > 0) {a-5,1 +5,1')
expect(diffListView.textContent).toBe('var pivot = items.shift(a)-4,1 +4,1')
})
it('moves the cursor to the selected hunk', () => {
@@ -44,6 +44,6 @@ describe('git-diff:toggle-diff-list', () => {
document.querySelector('.diff-list-view'),
'core:confirm'
)
expect(editor.getCursorBufferPosition()).toEqual([4, 4])
expect(editor.getCursorBufferPosition()).toEqual([3, 4])
})
})

View File

@@ -0,0 +1 @@
745ed7547d15a61bc4ee7e182615590f44aca201 refs/heads/master

View File

@@ -1,3 +0,0 @@
xťÍM0†a×=Ĺ\@ŇB;SbtíŇ ĄŐ
őçřbL<€Ëç]|źJi6yöŇJ×-µ•eÉ5•NŁ1d‰‡€®žP
ľçË4ĂŃ?â'~F×Ghú—ŻöçÄq(Ü”v *«L‰<4C>¶’¤k]ł˙AşN·Á×xü)ż˛xmđCŰ

View File

@@ -0,0 +1,2 @@
P pack-fb30b46ead026befe94c88f5591a6d3dfdca4e95.pack

View File

@@ -0,0 +1,2 @@
# pack-refs with: peeled fully-peeled sorted
745ed7547d15a61bc4ee7e182615590f44aca201 refs/heads/master

View File

@@ -1 +0,0 @@
90820108a054b6f49c0d21031313244b6f7d69dc

View File

@@ -1,13 +1,19 @@
var quicksort = function () {
var sort = function(items) {
if (items.length <= 1) return items;
var pivot = items.shift(), current, left = [], right = [];
while(items.length > 0) {
current = items.shift();
current < pivot ? left.push(current) : right.push(current);
}
return sort(left).concat(pivot).concat(sort(right));
};
module.exports.quicksort = function () {
var sort = function (items) {
if (items.length <= 1) return items
var pivot = items.shift()
var current
var left = []
var right = []
return sort(Array.apply(this, arguments));
};
while (items.length > 0) {
current = items.shift()
current < pivot ? left.push(current) : right.push(current)
}
return sort(left)
.concat(pivot)
.concat(sort(right))
}
return sort(Array.apply(this, arguments))
}

View File

@@ -156,13 +156,13 @@ describe('GitDiff package', () => {
describe('move-to-next-diff/move-to-previous-diff events', () => {
it('moves the cursor to first character of the next/previous diff line', () => {
editor.insertText('a')
editor.setCursorBufferPosition([5])
editor.setCursorBufferPosition([9])
editor.deleteLine()
advanceClock(editor.getBuffer().stoppedChangingDelay)
editor.setCursorBufferPosition([0])
atom.commands.dispatch(editorElement, 'git-diff:move-to-next-diff')
expect(editor.getCursorBufferPosition()).toEqual([4, 4])
expect(editor.getCursorBufferPosition()).toEqual([8, 4])
atom.commands.dispatch(editorElement, 'git-diff:move-to-previous-diff')
expect(editor.getCursorBufferPosition()).toEqual([0, 0])
@@ -170,19 +170,19 @@ describe('GitDiff package', () => {
it('wraps around to the first/last diff in the file', () => {
editor.insertText('a')
editor.setCursorBufferPosition([5])
editor.setCursorBufferPosition([9])
editor.deleteLine()
advanceClock(editor.getBuffer().stoppedChangingDelay)
editor.setCursorBufferPosition([0])
atom.commands.dispatch(editorElement, 'git-diff:move-to-next-diff')
expect(editor.getCursorBufferPosition()).toEqual([4, 4])
expect(editor.getCursorBufferPosition()).toEqual([8, 4])
atom.commands.dispatch(editorElement, 'git-diff:move-to-next-diff')
expect(editor.getCursorBufferPosition()).toEqual([0, 0])
atom.commands.dispatch(editorElement, 'git-diff:move-to-previous-diff')
expect(editor.getCursorBufferPosition()).toEqual([4, 4])
expect(editor.getCursorBufferPosition()).toEqual([8, 4])
})
describe('when the wrapAroundOnMoveToDiff config option is false', () => {
@@ -192,16 +192,16 @@ describe('GitDiff package', () => {
it('does not wraps around to the first/last diff in the file', () => {
editor.insertText('a')
editor.setCursorBufferPosition([5])
editor.setCursorBufferPosition([9])
editor.deleteLine()
advanceClock(editor.getBuffer().stoppedChangingDelay)
editor.setCursorBufferPosition([0])
atom.commands.dispatch(editorElement, 'git-diff:move-to-next-diff')
expect(editor.getCursorBufferPosition()).toEqual([4, 4])
expect(editor.getCursorBufferPosition()).toEqual([8, 4])
atom.commands.dispatch(editorElement, 'git-diff:move-to-next-diff')
expect(editor.getCursorBufferPosition()).toEqual([4, 4])
expect(editor.getCursorBufferPosition()).toEqual([8, 4])
atom.commands.dispatch(editorElement, 'git-diff:move-to-previous-diff')
expect(editor.getCursorBufferPosition()).toEqual([0, 0])