id stringlengths 34 124 | type stringclasses 4
values | prompt stringlengths 0 4.95k | response stringlengths 21 4.89k | source_lang stringclasses 3
values | target_lang stringclasses 2
values | repo stringclasses 75
values | path stringlengths 10 88 | license stringclasses 1
value | commit stringlengths 40 40 | stars int64 431 18.7k | source_url stringlengths 86 176 | line_start int64 1 214 | line_end int64 3 253 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
iizukanao/node-rtsp-rtmp-server:EventEmitterModule.coffee:3:raw_corpus | raw_corpus | module.exports = EventEmitterModule
###
# Usage
EventEmitterModule = require './EventEmitterModule'
class MyClass
EventEmitterModule.mixin MyClass
obj = new MyClass
obj.on 'event-a', (a, b, c) ->
console.log "received event-a a=#{a} b=#{b} c=#{c}"
obj.onAny (eventName, data...) ->
... | CoffeeScript | iizukanao/node-rtsp-rtmp-server | EventEmitterModule.coffee | MIT | 699e1414a8cacbdc5314312977897be597bb679b | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/699e1414a8cacbdc5314312977897be597bb679b/EventEmitterModule.coffee | 62 | 96 | ||
iizukanao/node-rtsp-rtmp-server:EventEmitterModule.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = EventEmitterModule
###
# Usage
EventEmitterModule = require './EventEmitterModule'
class MyClass
EventEmitterModule.mixin MyClass
obj = new MyClass
obj.on 'event-a', (a, b, c) ->
console.log "received event-a a=#{a}... | module.exports = EventEmitterModule;
/*
* Usage
EventEmitterModule = require './EventEmitterModule'
class MyClass
EventEmitterModule.mixin MyClass
obj = new MyClass
obj.on 'event-a', (a, b, c) ->
console.log "received event-a a=#{a} b=#{b} c=#{c}"
obj.onAny (eventName, data...) ->
... | CoffeeScript | JavaScript | iizukanao/node-rtsp-rtmp-server | EventEmitterModule.coffee | MIT | 699e1414a8cacbdc5314312977897be597bb679b | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/699e1414a8cacbdc5314312977897be597bb679b/EventEmitterModule.coffee | 62 | 96 |
iizukanao/node-rtsp-rtmp-server:EventEmitterModule.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
module.exports = EventEmitterModule;
/*
* Usage
EventEmitterModule = require './EventEmitterModule'
class MyClass
EventEmitterModule.mixin MyClass
obj = new MyClass
obj.on 'event-a', (a, b, c) ->
console.log "received event-a a=#{a} ... | module.exports = EventEmitterModule
###
# Usage
EventEmitterModule = require './EventEmitterModule'
class MyClass
EventEmitterModule.mixin MyClass
obj = new MyClass
obj.on 'event-a', (a, b, c) ->
console.log "received event-a a=#{a} b=#{b} c=#{c}"
obj.onAny (eventName, data...) ->
... | JavaScript | CoffeeScript | iizukanao/node-rtsp-rtmp-server | EventEmitterModule.coffee | MIT | 699e1414a8cacbdc5314312977897be597bb679b | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/699e1414a8cacbdc5314312977897be597bb679b/EventEmitterModule.coffee | 62 | 96 |
iizukanao/node-rtsp-rtmp-server:EventEmitterModule.coffee:3:completion | completion | module.exports = EventEmitterModule
###
# Usage
EventEmitterModule = require './EventEmitterModule'
class MyClass
EventEmitterModule.mixin MyClass
obj = new MyClass
obj.on 'event-a', (a, b, c) ->
console.log "received event-a a=#{a} b=#{b} c=#{c}"
obj.onAny (eventName, data...) ->
... | obj.emit 'event-a', 111, 222, 333
obj.emit 'event-b', 'hello'
Or you can inject EventEmitterModule into an object dynamically
(with slightly worse performance):
class MyClass
constructor: ->
EventEmitterModule.inject this
obj = new MyClass
obj.on 'event-a', ->
console.log "receive... | CoffeeScript | CoffeeScript | iizukanao/node-rtsp-rtmp-server | EventEmitterModule.coffee | MIT | 699e1414a8cacbdc5314312977897be597bb679b | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/699e1414a8cacbdc5314312977897be597bb679b/EventEmitterModule.coffee | 62 | 96 |
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:1:raw_corpus | raw_corpus | {getVimState} = require './spec-helper'
describe "Scrolling", ->
[set, ensure, editor, editorElement, vimState] = []
beforeEach ->
getVimState (state, vim) ->
vimState = state
{editor, editorElement} = vimState
{set, ensure} = vim
jasmine.attachToDOM(editorElement)
describe "scrolli... | CoffeeScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | 8d6f93ae3e3c43c205d6b51aeee911525a7ded78 | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/8d6f93ae3e3c43c205d6b51aeee911525a7ded78/spec/scroll-spec.coffee | 1 | 39 | ||
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
{getVimState} = require './spec-helper'
describe "Scrolling", ->
[set, ensure, editor, editorElement, vimState] = []
beforeEach ->
getVimState (state, vim) ->
vimState = state
{editor, editorElement} = vimState
{set, ensure} = vim
... | var getVimState;
({getVimState} = require('./spec-helper'));
describe("Scrolling", function() {
var editor, editorElement, ensure, set, vimState;
[set, ensure, editor, editorElement, vimState] = [];
beforeEach(function() {
return getVimState(function(state, vim) {
vimState = state;
({editor, edi... | CoffeeScript | JavaScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | 8d6f93ae3e3c43c205d6b51aeee911525a7ded78 | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/8d6f93ae3e3c43c205d6b51aeee911525a7ded78/spec/scroll-spec.coffee | 1 | 39 |
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var getVimState;
({getVimState} = require('./spec-helper'));
describe("Scrolling", function() {
var editor, editorElement, ensure, set, vimState;
[set, ensure, editor, editorElement, vimState] = [];
beforeEach(function() {
return getVimState(function(st... | {getVimState} = require './spec-helper'
describe "Scrolling", ->
[set, ensure, editor, editorElement, vimState] = []
beforeEach ->
getVimState (state, vim) ->
vimState = state
{editor, editorElement} = vimState
{set, ensure} = vim
jasmine.attachToDOM(editorElement)
describe "scrolli... | JavaScript | CoffeeScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | 8d6f93ae3e3c43c205d6b51aeee911525a7ded78 | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/8d6f93ae3e3c43c205d6b51aeee911525a7ded78/spec/scroll-spec.coffee | 1 | 39 |
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:1:completion | completion | {getVimState} = require './spec-helper'
describe "Scrolling", ->
[set, ensure, editor, editorElement, vimState] = []
beforeEach ->
getVimState (state, vim) ->
vimState = state
{editor, editorElement} = vimState
{set, ensure} = vim
jasmine.attachToDOM(editorElement)
describe "scrolli... | set
textC: """
100
200
30|0
400
500
600
700
800
900
1000
"""
expect(editorElement.getVisibleRowRange()).toEqual(initialRowRange)
describe "the ctrl-e and ctrl-y keybindings", ->
it "moves... | CoffeeScript | CoffeeScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | 8d6f93ae3e3c43c205d6b51aeee911525a7ded78 | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/8d6f93ae3e3c43c205d6b51aeee911525a7ded78/spec/scroll-spec.coffee | 1 | 39 |
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:2:raw_corpus | raw_corpus | ensure '2 ctrl-e', cursor: [5, 2]
expect(editor.getFirstVisibleScreenRow()).toBe 3
expect(editor.getLastVisibleScreenRow()).toBe 8
ensure '2 ctrl-y', cursor: [4, 2]
expect(editor.getFirstVisibleScreenRow()).toBe 1
expect(editor.getLastVisibleScreenRow()).toBe 6
describe "redr... | CoffeeScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | 8d6f93ae3e3c43c205d6b51aeee911525a7ded78 | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/8d6f93ae3e3c43c205d6b51aeee911525a7ded78/spec/scroll-spec.coffee | 41 | 82 | ||
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:2:completion | completion | ensure '2 ctrl-e', cursor: [5, 2]
expect(editor.getFirstVisibleScreenRow()).toBe 3
expect(editor.getLastVisibleScreenRow()).toBe 8
ensure '2 ctrl-y', cursor: [4, 2]
expect(editor.getFirstVisibleScreenRow()).toBe 1
expect(editor.getLastVisibleScreenRow()).toBe 6
describe "redr... | editorElement.setHeight(20 * 10)
editorElement.measureDimensions()
spyOn(editor, 'moveToFirstCharacterOfLine')
spyOn(editorElement, 'setScrollTop')
spyOn(editor, 'getFirstVisibleScreenRow').andReturn(90)
spyOn(editor, 'getLastVisibleScreenRow').andReturn(110)
spyOn(editorElement, 'p... | CoffeeScript | CoffeeScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | 8d6f93ae3e3c43c205d6b51aeee911525a7ded78 | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/8d6f93ae3e3c43c205d6b51aeee911525a7ded78/spec/scroll-spec.coffee | 41 | 82 |
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:3:raw_corpus | raw_corpus | describe "horizontal scroll cursor keybindings", ->
beforeEach ->
editorElement.setWidth(600)
editorElement.setHeight(600)
editorElement.style.lineHeight = "10px"
editorElement.style.font = "16px monospace"
editorElement.measureDimensions()
text = ""
for i in [100..199]
... | CoffeeScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | 8d6f93ae3e3c43c205d6b51aeee911525a7ded78 | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/8d6f93ae3e3c43c205d6b51aeee911525a7ded78/spec/scroll-spec.coffee | 84 | 123 | ||
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
describe "horizontal scroll cursor keybindings", ->
beforeEach ->
editorElement.setWidth(600)
editorElement.setHeight(600)
editorElement.style.lineHeight = "10px"
editorElement.style.font = "16px monospace"
editorElement.measureD... | describe("horizontal scroll cursor keybindings", function() {
beforeEach(function() {
var i, j, text;
editorElement.setWidth(600);
editorElement.setHeight(600);
editorElement.style.lineHeight = "10px";
editorElement.style.font = "16px monospace";
editorElement.measureDimensions();
text = "... | CoffeeScript | JavaScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | 8d6f93ae3e3c43c205d6b51aeee911525a7ded78 | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/8d6f93ae3e3c43c205d6b51aeee911525a7ded78/spec/scroll-spec.coffee | 84 | 123 |
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
describe("horizontal scroll cursor keybindings", function() {
beforeEach(function() {
var i, j, text;
editorElement.setWidth(600);
editorElement.setHeight(600);
editorElement.style.lineHeight = "10px";
editorElement.style.font = "16px monospac... | describe "horizontal scroll cursor keybindings", ->
beforeEach ->
editorElement.setWidth(600)
editorElement.setHeight(600)
editorElement.style.lineHeight = "10px"
editorElement.style.font = "16px monospace"
editorElement.measureDimensions()
text = ""
for i in [100..199]
... | JavaScript | CoffeeScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | 8d6f93ae3e3c43c205d6b51aeee911525a7ded78 | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/8d6f93ae3e3c43c205d6b51aeee911525a7ded78/spec/scroll-spec.coffee | 84 | 123 |
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:3:completion | completion | describe "horizontal scroll cursor keybindings", ->
beforeEach ->
editorElement.setWidth(600)
editorElement.setHeight(600)
editorElement.style.lineHeight = "10px"
editorElement.style.font = "16px monospace"
editorElement.measureDimensions()
text = ""
for i in [100..199]
... | editorElement.getScrollLeft()
beforeEach ->
startPosition = editorElement.getScrollLeft()
# FIXME: remove in future
xit "does nothing near the start of the line", ->
pos1 = zsPos(1)
expect(pos1).toEqual(startPosition)
it "moves the cursor the nearest it can to the left... | CoffeeScript | CoffeeScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | 8d6f93ae3e3c43c205d6b51aeee911525a7ded78 | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/8d6f93ae3e3c43c205d6b51aeee911525a7ded78/spec/scroll-spec.coffee | 84 | 123 |
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:4:raw_corpus | raw_corpus | pos390 = zsPos(390)
expect(pos390).toEqual(posEnd)
expect(editor.getCursorBufferPosition()).toEqual [0, 390]
pos340 = zsPos(340)
expect(pos340).toEqual(posEnd)
it "does nothing if all lines are short", ->
editor.setText('short')
startPosition = editorElement.getSc... | CoffeeScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | 8d6f93ae3e3c43c205d6b51aeee911525a7ded78 | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/8d6f93ae3e3c43c205d6b51aeee911525a7ded78/spec/scroll-spec.coffee | 125 | 168 | ||
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:4:completion | completion | pos390 = zsPos(390)
expect(pos390).toEqual(posEnd)
expect(editor.getCursorBufferPosition()).toEqual [0, 390]
pos340 = zsPos(340)
expect(pos340).toEqual(posEnd)
it "does nothing if all lines are short", ->
editor.setText('short')
startPosition = editorElement.getSc... | startPosition = null
beforeEach ->
startPosition = editorElement.getScrollLeft()
it "does nothing near the start of the line", ->
expect(zePos(1)).toEqual(startPosition)
expect(zePos(40)).toEqual(startPosition)
it "moves the cursor the nearest it can to the right edge of the... | CoffeeScript | CoffeeScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | 8d6f93ae3e3c43c205d6b51aeee911525a7ded78 | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/8d6f93ae3e3c43c205d6b51aeee911525a7ded78/spec/scroll-spec.coffee | 125 | 168 |
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:5:raw_corpus | raw_corpus | it "does nothing if all lines are short", ->
editor.setText('short')
startPosition = editorElement.getScrollLeft()
expect(zePos(1)).toEqual(startPosition)
expect(zePos(10)).toEqual(startPosition) | CoffeeScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | 8d6f93ae3e3c43c205d6b51aeee911525a7ded78 | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/8d6f93ae3e3c43c205d6b51aeee911525a7ded78/spec/scroll-spec.coffee | 170 | 174 | ||
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:5:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
it "does nothing if all lines are short", ->
editor.setText('short')
startPosition = editorElement.getScrollLeft()
expect(zePos(1)).toEqual(startPosition)
expect(zePos(10)).toEqual(startPosition)
``` | it("does nothing if all lines are short", function() {
var startPosition;
editor.setText('short');
startPosition = editorElement.getScrollLeft();
expect(zePos(1)).toEqual(startPosition);
return expect(zePos(10)).toEqual(startPosition);
}); | CoffeeScript | JavaScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | 8d6f93ae3e3c43c205d6b51aeee911525a7ded78 | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/8d6f93ae3e3c43c205d6b51aeee911525a7ded78/spec/scroll-spec.coffee | 170 | 174 |
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:5:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
it("does nothing if all lines are short", function() {
var startPosition;
editor.setText('short');
startPosition = editorElement.getScrollLeft();
expect(zePos(1)).toEqual(startPosition);
return expect(zePos(10)).toEqual(startPosition);
});
``` | it "does nothing if all lines are short", ->
editor.setText('short')
startPosition = editorElement.getScrollLeft()
expect(zePos(1)).toEqual(startPosition)
expect(zePos(10)).toEqual(startPosition) | JavaScript | CoffeeScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | 8d6f93ae3e3c43c205d6b51aeee911525a7ded78 | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/8d6f93ae3e3c43c205d6b51aeee911525a7ded78/spec/scroll-spec.coffee | 170 | 174 |
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:5:completion | completion | it "does nothing if all lines are short", ->
editor.setText('short') | startPosition = editorElement.getScrollLeft()
expect(zePos(1)).toEqual(startPosition)
expect(zePos(10)).toEqual(startPosition) | CoffeeScript | CoffeeScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | 8d6f93ae3e3c43c205d6b51aeee911525a7ded78 | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/8d6f93ae3e3c43c205d6b51aeee911525a7ded78/spec/scroll-spec.coffee | 170 | 174 |
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:1:raw_corpus | raw_corpus | {getVimState} = require './spec-helper'
describe "Scrolling", ->
[set, ensure, editor, editorElement, vimState] = []
beforeEach ->
getVimState (state, vim) ->
vimState = state
{editor, editorElement} = vimState
{set, ensure} = vim
jasmine.attachToDOM(editorElement)
describe "scrolli... | CoffeeScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | f373232c4f4dff5df558bac194ebcf3ea8773573 | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/f373232c4f4dff5df558bac194ebcf3ea8773573/spec/scroll-spec.coffee | 1 | 40 | ||
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
{getVimState} = require './spec-helper'
describe "Scrolling", ->
[set, ensure, editor, editorElement, vimState] = []
beforeEach ->
getVimState (state, vim) ->
vimState = state
{editor, editorElement} = vimState
{set, ensure} = vim
... | var getVimState;
({getVimState} = require('./spec-helper'));
describe("Scrolling", function() {
var editor, editorElement, ensure, set, vimState;
[set, ensure, editor, editorElement, vimState] = [];
beforeEach(function() {
return getVimState(function(state, vim) {
vimState = state;
({editor, edi... | CoffeeScript | JavaScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | f373232c4f4dff5df558bac194ebcf3ea8773573 | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/f373232c4f4dff5df558bac194ebcf3ea8773573/spec/scroll-spec.coffee | 1 | 40 |
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var getVimState;
({getVimState} = require('./spec-helper'));
describe("Scrolling", function() {
var editor, editorElement, ensure, set, vimState;
[set, ensure, editor, editorElement, vimState] = [];
beforeEach(function() {
return getVimState(function(st... | {getVimState} = require './spec-helper'
describe "Scrolling", ->
[set, ensure, editor, editorElement, vimState] = []
beforeEach ->
getVimState (state, vim) ->
vimState = state
{editor, editorElement} = vimState
{set, ensure} = vim
jasmine.attachToDOM(editorElement)
describe "scrolli... | JavaScript | CoffeeScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | f373232c4f4dff5df558bac194ebcf3ea8773573 | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/f373232c4f4dff5df558bac194ebcf3ea8773573/spec/scroll-spec.coffee | 1 | 40 |
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:1:completion | completion | {getVimState} = require './spec-helper'
describe "Scrolling", ->
[set, ensure, editor, editorElement, vimState] = []
beforeEach ->
getVimState (state, vim) ->
vimState = state
{editor, editorElement} = vimState
{set, ensure} = vim
jasmine.attachToDOM(editorElement)
describe "scrolli... | cursor: [1, 2]
text: """
100
200
300
400
500
600
700
800
900
1000
"""
expect(editorElement.getVisibleRowRange()).toEqual(initialRowRange)
describe "the ctrl-e and ctrl-y keybindings", ->
... | CoffeeScript | CoffeeScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | f373232c4f4dff5df558bac194ebcf3ea8773573 | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/f373232c4f4dff5df558bac194ebcf3ea8773573/spec/scroll-spec.coffee | 1 | 40 |
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:2:raw_corpus | raw_corpus | ensure '2 ctrl-e', cursor: [4, 2]
expect(editor.getFirstVisibleScreenRow()).toBe 3
expect(editor.getLastVisibleScreenRow()).toBe 8
ensure '2 ctrl-y', cursor: [2, 2]
expect(editor.getFirstVisibleScreenRow()).toBe 1
expect(editor.getLastVisibleScreenRow()).toBe 6
describe "redr... | CoffeeScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | f373232c4f4dff5df558bac194ebcf3ea8773573 | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/f373232c4f4dff5df558bac194ebcf3ea8773573/spec/scroll-spec.coffee | 42 | 83 | ||
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:2:completion | completion | ensure '2 ctrl-e', cursor: [4, 2]
expect(editor.getFirstVisibleScreenRow()).toBe 3
expect(editor.getLastVisibleScreenRow()).toBe 8
ensure '2 ctrl-y', cursor: [2, 2]
expect(editor.getFirstVisibleScreenRow()).toBe 1
expect(editor.getLastVisibleScreenRow()).toBe 6
describe "redr... | editorElement.setHeight(20 * 10)
editorElement.measureDimensions()
spyOn(editor, 'moveToFirstCharacterOfLine')
spyOn(editorElement, 'setScrollTop')
spyOn(editor, 'getFirstVisibleScreenRow').andReturn(90)
spyOn(editor, 'getLastVisibleScreenRow').andReturn(110)
spyOn(editorElement, 'p... | CoffeeScript | CoffeeScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | f373232c4f4dff5df558bac194ebcf3ea8773573 | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/f373232c4f4dff5df558bac194ebcf3ea8773573/spec/scroll-spec.coffee | 42 | 83 |
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:2:raw_corpus | raw_corpus | ensure '2 ctrl-e', cursor: [4, 2]
expect(editor.getFirstVisibleScreenRow()).toBe 3
expect(editor.getLastVisibleScreenRow()).toBe 8
ensure '2 ctrl-y', cursor: [2, 2]
expect(editor.getFirstVisibleScreenRow()).toBe 1
expect(editor.getLastVisibleScreenRow()).toBe 6
describe "scro... | CoffeeScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | 8fece313270dad09b99673faf2ae57e979e0e24b | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/8fece313270dad09b99673faf2ae57e979e0e24b/spec/scroll-spec.coffee | 42 | 80 | ||
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:2:completion | completion | ensure '2 ctrl-e', cursor: [4, 2]
expect(editor.getFirstVisibleScreenRow()).toBe 3
expect(editor.getLastVisibleScreenRow()).toBe 8
ensure '2 ctrl-y', cursor: [2, 2]
expect(editor.getFirstVisibleScreenRow()).toBe 1
expect(editor.getLastVisibleScreenRow()).toBe 6
describe "scro... | spyOn(editor, 'getLastVisibleScreenRow').andReturn(110)
spyOn(editorElement, 'pixelPositionForScreenPosition').andReturn({top: 1000, left: 0})
describe "the z<CR> keybinding", ->
it "moves the screen to position cursor at the top of the window and moves cursor to first non-blank in the line", ->
... | CoffeeScript | CoffeeScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | 8fece313270dad09b99673faf2ae57e979e0e24b | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/8fece313270dad09b99673faf2ae57e979e0e24b/spec/scroll-spec.coffee | 42 | 80 |
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:3:raw_corpus | raw_corpus | describe "the zz keybinding", ->
it "moves the screen to position cursor at the center of the window and leave cursor in the same column", ->
ensure 'z z'
expect(editorElement.setScrollTop).toHaveBeenCalledWith(900)
expect(editor.moveToFirstCharacterOfLine).not.toHaveBeenCalled()
desc... | CoffeeScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | 8fece313270dad09b99673faf2ae57e979e0e24b | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/8fece313270dad09b99673faf2ae57e979e0e24b/spec/scroll-spec.coffee | 82 | 120 | ||
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
describe "the zz keybinding", ->
it "moves the screen to position cursor at the center of the window and leave cursor in the same column", ->
ensure 'z z'
expect(editorElement.setScrollTop).toHaveBeenCalledWith(900)
expect(editor.mov... | describe("the zz keybinding", function() {
return it("moves the screen to position cursor at the center of the window and leave cursor in the same column", function() {
ensure('z z');
expect(editorElement.setScrollTop).toHaveBeenCalledWith(900);
return expect(editor.moveToFirstCharacterOfLine).not.toHaveB... | CoffeeScript | JavaScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | 8fece313270dad09b99673faf2ae57e979e0e24b | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/8fece313270dad09b99673faf2ae57e979e0e24b/spec/scroll-spec.coffee | 82 | 120 |
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
describe("the zz keybinding", function() {
return it("moves the screen to position cursor at the center of the window and leave cursor in the same column", function() {
ensure('z z');
expect(editorElement.setScrollTop).toHaveBeenCalledWith(900);
retur... | describe "the zz keybinding", ->
it "moves the screen to position cursor at the center of the window and leave cursor in the same column", ->
ensure 'z z'
expect(editorElement.setScrollTop).toHaveBeenCalledWith(900)
expect(editor.moveToFirstCharacterOfLine).not.toHaveBeenCalled()
desc... | JavaScript | CoffeeScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | 8fece313270dad09b99673faf2ae57e979e0e24b | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/8fece313270dad09b99673faf2ae57e979e0e24b/spec/scroll-spec.coffee | 82 | 120 |
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:3:completion | completion | describe "the zz keybinding", ->
it "moves the screen to position cursor at the center of the window and leave cursor in the same column", ->
ensure 'z z'
expect(editorElement.setScrollTop).toHaveBeenCalledWith(900)
expect(editor.moveToFirstCharacterOfLine).not.toHaveBeenCalled()
desc... | beforeEach ->
editorElement.setWidth(600)
editorElement.setHeight(600)
editorElement.style.lineHeight = "10px"
editorElement.style.font = "16px monospace"
editorElement.measureDimensions()
text = ""
for i in [100..199]
text += "#{i} "
editor.setText(text)
e... | CoffeeScript | CoffeeScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | 8fece313270dad09b99673faf2ae57e979e0e24b | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/8fece313270dad09b99673faf2ae57e979e0e24b/spec/scroll-spec.coffee | 82 | 120 |
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:4:raw_corpus | raw_corpus | beforeEach ->
startPosition = editorElement.getScrollLeft()
# FIXME: remove in future
xit "does nothing near the start of the line", ->
pos1 = zsPos(1)
expect(pos1).toEqual(startPosition)
it "moves the cursor the nearest it can to the left edge of the editor", ->
pos1... | CoffeeScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | 8fece313270dad09b99673faf2ae57e979e0e24b | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/8fece313270dad09b99673faf2ae57e979e0e24b/spec/scroll-spec.coffee | 122 | 162 | ||
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
beforeEach ->
startPosition = editorElement.getScrollLeft()
# FIXME: remove in future
xit "does nothing near the start of the line", ->
pos1 = zsPos(1)
expect(pos1).toEqual(startPosition)
it "moves the cursor the neares... | beforeEach(function() {
var startPosition;
return startPosition = editorElement.getScrollLeft();
});
// FIXME: remove in future
xit("does nothing near the start of the line", function() {
var pos1;
pos1 = zsPos(1);
return expect(pos1).toEqual(startPosition);
});
it("moves the cursor the nearest it can to th... | CoffeeScript | JavaScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | 8fece313270dad09b99673faf2ae57e979e0e24b | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/8fece313270dad09b99673faf2ae57e979e0e24b/spec/scroll-spec.coffee | 122 | 162 |
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
beforeEach(function() {
var startPosition;
return startPosition = editorElement.getScrollLeft();
});
// FIXME: remove in future
xit("does nothing near the start of the line", function() {
var pos1;
pos1 = zsPos(1);
return expect(pos1).toEqual(startPositi... | beforeEach ->
startPosition = editorElement.getScrollLeft()
# FIXME: remove in future
xit "does nothing near the start of the line", ->
pos1 = zsPos(1)
expect(pos1).toEqual(startPosition)
it "moves the cursor the nearest it can to the left edge of the editor", ->
pos1... | JavaScript | CoffeeScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | 8fece313270dad09b99673faf2ae57e979e0e24b | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/8fece313270dad09b99673faf2ae57e979e0e24b/spec/scroll-spec.coffee | 122 | 162 |
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:4:completion | completion | beforeEach ->
startPosition = editorElement.getScrollLeft()
# FIXME: remove in future
xit "does nothing near the start of the line", ->
pos1 = zsPos(1)
expect(pos1).toEqual(startPosition)
it "moves the cursor the nearest it can to the left edge of the editor", ->
pos1... | expect(pos390).toEqual(posEnd)
expect(editor.getCursorBufferPosition()).toEqual [0, 390]
pos340 = zsPos(340)
expect(pos340).toEqual(posEnd)
it "does nothing if all lines are short", ->
editor.setText('short')
startPosition = editorElement.getScrollLeft()
pos1 = zs... | CoffeeScript | CoffeeScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | 8fece313270dad09b99673faf2ae57e979e0e24b | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/8fece313270dad09b99673faf2ae57e979e0e24b/spec/scroll-spec.coffee | 122 | 162 |
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:5:raw_corpus | raw_corpus | startPosition = null
beforeEach ->
startPosition = editorElement.getScrollLeft()
it "does nothing near the start of the line", ->
expect(zePos(1)).toEqual(startPosition)
expect(zePos(40)).toEqual(startPosition)
it "moves the cursor the nearest it can to the right edge of the... | CoffeeScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | 8fece313270dad09b99673faf2ae57e979e0e24b | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/8fece313270dad09b99673faf2ae57e979e0e24b/spec/scroll-spec.coffee | 164 | 190 | ||
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:5:completion | completion | startPosition = null
beforeEach ->
startPosition = editorElement.getScrollLeft()
it "does nothing near the start of the line", ->
expect(zePos(1)).toEqual(startPosition)
expect(zePos(40)).toEqual(startPosition)
it "moves the cursor the nearest it can to the right edge of the... | # FIXME description is no longer appropriate
it "does nothing when very near the end of the line", ->
posEnd = zePos(399)
expect(zePos(397)).toBeLessThan(posEnd)
pos380 = zePos(380)
expect(pos380).toBeLessThan(posEnd)
expect(zePos(382) - pos380).toEqual(19)
it "does ... | CoffeeScript | CoffeeScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | 8fece313270dad09b99673faf2ae57e979e0e24b | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/8fece313270dad09b99673faf2ae57e979e0e24b/spec/scroll-spec.coffee | 164 | 190 |
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:2:raw_corpus | raw_corpus | ensure '2 ctrl-e', cursor: [4, 2]
expect(editor.getFirstVisibleScreenRow()).toBe 3
expect(editor.getLastVisibleScreenRow()).toBe 8
ensure '2 ctrl-y', cursor: [2, 2]
expect(editor.getFirstVisibleScreenRow()).toBe 1
expect(editor.getLastVisibleScreenRow()).toBe 6
describe "scro... | CoffeeScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | d882126ee4254bf564eb37b9f3a7cdd322482439 | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/d882126ee4254bf564eb37b9f3a7cdd322482439/spec/scroll-spec.coffee | 42 | 80 | ||
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:2:completion | completion | ensure '2 ctrl-e', cursor: [4, 2]
expect(editor.getFirstVisibleScreenRow()).toBe 3
expect(editor.getLastVisibleScreenRow()).toBe 8
ensure '2 ctrl-y', cursor: [2, 2]
expect(editor.getFirstVisibleScreenRow()).toBe 1
expect(editor.getLastVisibleScreenRow()).toBe 6
describe "scro... | spyOn(editor, 'getLastVisibleScreenRow').andReturn(110)
spyOn(editorElement, 'pixelPositionForScreenPosition').andReturn({top: 1000, left: 0})
describe "the z<CR> keybinding", ->
it "moves the screen to position cursor at the top of the window and moves cursor to first non-blank in the line", ->
... | CoffeeScript | CoffeeScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | d882126ee4254bf564eb37b9f3a7cdd322482439 | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/d882126ee4254bf564eb37b9f3a7cdd322482439/spec/scroll-spec.coffee | 42 | 80 |
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:3:raw_corpus | raw_corpus | describe "the zz keybinding", ->
it "moves the screen to position cursor at the center of the window and leave cursor in the same column", ->
ensure 'z z', {}
expect(editorElement.setScrollTop).toHaveBeenCalledWith(900)
expect(editor.moveToFirstCharacterOfLine).not.toHaveBeenCalled()
... | CoffeeScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | d882126ee4254bf564eb37b9f3a7cdd322482439 | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/d882126ee4254bf564eb37b9f3a7cdd322482439/spec/scroll-spec.coffee | 82 | 120 | ||
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
describe "the zz keybinding", ->
it "moves the screen to position cursor at the center of the window and leave cursor in the same column", ->
ensure 'z z', {}
expect(editorElement.setScrollTop).toHaveBeenCalledWith(900)
expect(editor... | describe("the zz keybinding", function() {
return it("moves the screen to position cursor at the center of the window and leave cursor in the same column", function() {
ensure('z z', {});
expect(editorElement.setScrollTop).toHaveBeenCalledWith(900);
return expect(editor.moveToFirstCharacterOfLine).not.toH... | CoffeeScript | JavaScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | d882126ee4254bf564eb37b9f3a7cdd322482439 | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/d882126ee4254bf564eb37b9f3a7cdd322482439/spec/scroll-spec.coffee | 82 | 120 |
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
describe("the zz keybinding", function() {
return it("moves the screen to position cursor at the center of the window and leave cursor in the same column", function() {
ensure('z z', {});
expect(editorElement.setScrollTop).toHaveBeenCalledWith(900);
r... | describe "the zz keybinding", ->
it "moves the screen to position cursor at the center of the window and leave cursor in the same column", ->
ensure 'z z', {}
expect(editorElement.setScrollTop).toHaveBeenCalledWith(900)
expect(editor.moveToFirstCharacterOfLine).not.toHaveBeenCalled()
... | JavaScript | CoffeeScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | d882126ee4254bf564eb37b9f3a7cdd322482439 | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/d882126ee4254bf564eb37b9f3a7cdd322482439/spec/scroll-spec.coffee | 82 | 120 |
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:3:completion | completion | describe "the zz keybinding", ->
it "moves the screen to position cursor at the center of the window and leave cursor in the same column", ->
ensure 'z z', {}
expect(editorElement.setScrollTop).toHaveBeenCalledWith(900)
expect(editor.moveToFirstCharacterOfLine).not.toHaveBeenCalled()
... | beforeEach ->
editorElement.setWidth(600)
editorElement.setHeight(600)
editorElement.style.lineHeight = "10px"
editorElement.style.font = "16px monospace"
editorElement.measureDimensions()
text = ""
for i in [100..199]
text += "#{i} "
editor.setText(text)
e... | CoffeeScript | CoffeeScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | d882126ee4254bf564eb37b9f3a7cdd322482439 | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/d882126ee4254bf564eb37b9f3a7cdd322482439/spec/scroll-spec.coffee | 82 | 120 |
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:4:raw_corpus | raw_corpus | beforeEach ->
startPosition = editorElement.getScrollLeft()
# FIXME: remove in future
xit "does nothing near the start of the line", ->
pos1 = zsPos(1)
expect(pos1).toEqual(startPosition)
it "moves the cursor the nearest it can to the left edge of the editor", ->
pos1... | CoffeeScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | d882126ee4254bf564eb37b9f3a7cdd322482439 | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/d882126ee4254bf564eb37b9f3a7cdd322482439/spec/scroll-spec.coffee | 122 | 162 | ||
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
beforeEach ->
startPosition = editorElement.getScrollLeft()
# FIXME: remove in future
xit "does nothing near the start of the line", ->
pos1 = zsPos(1)
expect(pos1).toEqual(startPosition)
it "moves the cursor the neares... | beforeEach(function() {
var startPosition;
return startPosition = editorElement.getScrollLeft();
});
// FIXME: remove in future
xit("does nothing near the start of the line", function() {
var pos1;
pos1 = zsPos(1);
return expect(pos1).toEqual(startPosition);
});
it("moves the cursor the nearest it can to th... | CoffeeScript | JavaScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | d882126ee4254bf564eb37b9f3a7cdd322482439 | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/d882126ee4254bf564eb37b9f3a7cdd322482439/spec/scroll-spec.coffee | 122 | 162 |
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
beforeEach(function() {
var startPosition;
return startPosition = editorElement.getScrollLeft();
});
// FIXME: remove in future
xit("does nothing near the start of the line", function() {
var pos1;
pos1 = zsPos(1);
return expect(pos1).toEqual(startPositi... | beforeEach ->
startPosition = editorElement.getScrollLeft()
# FIXME: remove in future
xit "does nothing near the start of the line", ->
pos1 = zsPos(1)
expect(pos1).toEqual(startPosition)
it "moves the cursor the nearest it can to the left edge of the editor", ->
pos1... | JavaScript | CoffeeScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | d882126ee4254bf564eb37b9f3a7cdd322482439 | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/d882126ee4254bf564eb37b9f3a7cdd322482439/spec/scroll-spec.coffee | 122 | 162 |
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:4:completion | completion | beforeEach ->
startPosition = editorElement.getScrollLeft()
# FIXME: remove in future
xit "does nothing near the start of the line", ->
pos1 = zsPos(1)
expect(pos1).toEqual(startPosition)
it "moves the cursor the nearest it can to the left edge of the editor", ->
pos1... | expect(pos390).toEqual(posEnd)
expect(editor.getCursorBufferPosition()).toEqual [0, 390]
pos340 = zsPos(340)
expect(pos340).toEqual(posEnd)
it "does nothing if all lines are short", ->
editor.setText('short')
startPosition = editorElement.getScrollLeft()
pos1 = zs... | CoffeeScript | CoffeeScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | d882126ee4254bf564eb37b9f3a7cdd322482439 | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/d882126ee4254bf564eb37b9f3a7cdd322482439/spec/scroll-spec.coffee | 122 | 162 |
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:1:raw_corpus | raw_corpus | {getVimState} = require './spec-helper'
describe "Scrolling", ->
[set, ensure, keystroke, editor, editorElement, vimState] = []
beforeEach ->
getVimState (state, vim) ->
vimState = state
{editor, editorElement} = vimState
{set, ensure, keystroke} = vim
jasmine.attachToDOM(editorElement... | CoffeeScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | 3dab6ad77714b7519505fb1e465f0b73d935fc40 | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/3dab6ad77714b7519505fb1e465f0b73d935fc40/spec/scroll-spec.coffee | 1 | 40 | ||
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
{getVimState} = require './spec-helper'
describe "Scrolling", ->
[set, ensure, keystroke, editor, editorElement, vimState] = []
beforeEach ->
getVimState (state, vim) ->
vimState = state
{editor, editorElement} = vimState
{set, ensure,... | var getVimState;
({getVimState} = require('./spec-helper'));
describe("Scrolling", function() {
var editor, editorElement, ensure, keystroke, set, vimState;
[set, ensure, keystroke, editor, editorElement, vimState] = [];
beforeEach(function() {
return getVimState(function(state, vim) {
vimState = stat... | CoffeeScript | JavaScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | 3dab6ad77714b7519505fb1e465f0b73d935fc40 | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/3dab6ad77714b7519505fb1e465f0b73d935fc40/spec/scroll-spec.coffee | 1 | 40 |
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var getVimState;
({getVimState} = require('./spec-helper'));
describe("Scrolling", function() {
var editor, editorElement, ensure, keystroke, set, vimState;
[set, ensure, keystroke, editor, editorElement, vimState] = [];
beforeEach(function() {
return g... | {getVimState} = require './spec-helper'
describe "Scrolling", ->
[set, ensure, keystroke, editor, editorElement, vimState] = []
beforeEach ->
getVimState (state, vim) ->
vimState = state
{editor, editorElement} = vimState
{set, ensure, keystroke} = vim
jasmine.attachToDOM(editorElement... | JavaScript | CoffeeScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | 3dab6ad77714b7519505fb1e465f0b73d935fc40 | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/3dab6ad77714b7519505fb1e465f0b73d935fc40/spec/scroll-spec.coffee | 1 | 40 |
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:1:completion | completion | {getVimState} = require './spec-helper'
describe "Scrolling", ->
[set, ensure, keystroke, editor, editorElement, vimState] = []
beforeEach ->
getVimState (state, vim) ->
vimState = state
{editor, editorElement} = vimState
{set, ensure, keystroke} = vim
jasmine.attachToDOM(editorElement... | cursor: [1, 2]
text: """
100
200
300
400
500
600
700
800
900
1000
"""
expect(editorElement.getVisibleRowRange()).toEqual(initialRowRange)
describe "the ctrl-e and ctrl-y keybindings", ->
... | CoffeeScript | CoffeeScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | 3dab6ad77714b7519505fb1e465f0b73d935fc40 | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/3dab6ad77714b7519505fb1e465f0b73d935fc40/spec/scroll-spec.coffee | 1 | 40 |
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:2:raw_corpus | raw_corpus | ensure '2 ctrl-e', cursor: [4, 2]
expect(editor.getFirstVisibleScreenRow()).toBe 3
expect(editor.getLastVisibleScreenRow()).toBe 8
ensure '2 ctrl-y', cursor: [2, 2]
expect(editor.getFirstVisibleScreenRow()).toBe 1
expect(editor.getLastVisibleScreenRow()).toBe 6
describe "scro... | CoffeeScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | 3dab6ad77714b7519505fb1e465f0b73d935fc40 | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/3dab6ad77714b7519505fb1e465f0b73d935fc40/spec/scroll-spec.coffee | 42 | 80 | ||
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:2:completion | completion | ensure '2 ctrl-e', cursor: [4, 2]
expect(editor.getFirstVisibleScreenRow()).toBe 3
expect(editor.getLastVisibleScreenRow()).toBe 8
ensure '2 ctrl-y', cursor: [2, 2]
expect(editor.getFirstVisibleScreenRow()).toBe 1
expect(editor.getLastVisibleScreenRow()).toBe 6
describe "scro... | spyOn(editor, 'getLastVisibleScreenRow').andReturn(110)
spyOn(editorElement, 'pixelPositionForScreenPosition').andReturn({top: 1000, left: 0})
describe "the z<CR> keybinding", ->
it "moves the screen to position cursor at the top of the window and moves cursor to first non-blank in the line", ->
... | CoffeeScript | CoffeeScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | 3dab6ad77714b7519505fb1e465f0b73d935fc40 | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/3dab6ad77714b7519505fb1e465f0b73d935fc40/spec/scroll-spec.coffee | 42 | 80 |
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:3:raw_corpus | raw_corpus | describe "the zz keybinding", ->
it "moves the screen to position cursor at the center of the window and leave cursor in the same column", ->
keystroke 'z z'
expect(editorElement.setScrollTop).toHaveBeenCalledWith(900)
expect(editor.moveToFirstCharacterOfLine).not.toHaveBeenCalled()
d... | CoffeeScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | 3dab6ad77714b7519505fb1e465f0b73d935fc40 | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/3dab6ad77714b7519505fb1e465f0b73d935fc40/spec/scroll-spec.coffee | 82 | 120 | ||
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
describe "the zz keybinding", ->
it "moves the screen to position cursor at the center of the window and leave cursor in the same column", ->
keystroke 'z z'
expect(editorElement.setScrollTop).toHaveBeenCalledWith(900)
expect(editor.... | describe("the zz keybinding", function() {
return it("moves the screen to position cursor at the center of the window and leave cursor in the same column", function() {
keystroke('z z');
expect(editorElement.setScrollTop).toHaveBeenCalledWith(900);
return expect(editor.moveToFirstCharacterOfLine).not.toHa... | CoffeeScript | JavaScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | 3dab6ad77714b7519505fb1e465f0b73d935fc40 | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/3dab6ad77714b7519505fb1e465f0b73d935fc40/spec/scroll-spec.coffee | 82 | 120 |
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
describe("the zz keybinding", function() {
return it("moves the screen to position cursor at the center of the window and leave cursor in the same column", function() {
keystroke('z z');
expect(editorElement.setScrollTop).toHaveBeenCalledWith(900);
re... | describe "the zz keybinding", ->
it "moves the screen to position cursor at the center of the window and leave cursor in the same column", ->
keystroke 'z z'
expect(editorElement.setScrollTop).toHaveBeenCalledWith(900)
expect(editor.moveToFirstCharacterOfLine).not.toHaveBeenCalled()
d... | JavaScript | CoffeeScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | 3dab6ad77714b7519505fb1e465f0b73d935fc40 | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/3dab6ad77714b7519505fb1e465f0b73d935fc40/spec/scroll-spec.coffee | 82 | 120 |
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:3:completion | completion | describe "the zz keybinding", ->
it "moves the screen to position cursor at the center of the window and leave cursor in the same column", ->
keystroke 'z z'
expect(editorElement.setScrollTop).toHaveBeenCalledWith(900)
expect(editor.moveToFirstCharacterOfLine).not.toHaveBeenCalled()
d... | beforeEach ->
editorElement.setWidth(600)
editorElement.setHeight(600)
editorElement.style.lineHeight = "10px"
editorElement.style.font = "16px monospace"
editorElement.measureDimensions()
text = ""
for i in [100..199]
text += "#{i} "
editor.setText(text)
e... | CoffeeScript | CoffeeScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | 3dab6ad77714b7519505fb1e465f0b73d935fc40 | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/3dab6ad77714b7519505fb1e465f0b73d935fc40/spec/scroll-spec.coffee | 82 | 120 |
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:4:raw_corpus | raw_corpus | beforeEach ->
startPosition = editorElement.getScrollLeft()
# FIXME: remove in future
xit "does nothing near the start of the line", ->
pos1 = zsPos(1)
expect(pos1).toEqual(startPosition)
it "moves the cursor the nearest it can to the left edge of the editor", ->
pos1... | CoffeeScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | 3dab6ad77714b7519505fb1e465f0b73d935fc40 | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/3dab6ad77714b7519505fb1e465f0b73d935fc40/spec/scroll-spec.coffee | 122 | 162 | ||
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
beforeEach ->
startPosition = editorElement.getScrollLeft()
# FIXME: remove in future
xit "does nothing near the start of the line", ->
pos1 = zsPos(1)
expect(pos1).toEqual(startPosition)
it "moves the cursor the neares... | beforeEach(function() {
var startPosition;
return startPosition = editorElement.getScrollLeft();
});
// FIXME: remove in future
xit("does nothing near the start of the line", function() {
var pos1;
pos1 = zsPos(1);
return expect(pos1).toEqual(startPosition);
});
it("moves the cursor the nearest it can to th... | CoffeeScript | JavaScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | 3dab6ad77714b7519505fb1e465f0b73d935fc40 | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/3dab6ad77714b7519505fb1e465f0b73d935fc40/spec/scroll-spec.coffee | 122 | 162 |
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
beforeEach(function() {
var startPosition;
return startPosition = editorElement.getScrollLeft();
});
// FIXME: remove in future
xit("does nothing near the start of the line", function() {
var pos1;
pos1 = zsPos(1);
return expect(pos1).toEqual(startPositi... | beforeEach ->
startPosition = editorElement.getScrollLeft()
# FIXME: remove in future
xit "does nothing near the start of the line", ->
pos1 = zsPos(1)
expect(pos1).toEqual(startPosition)
it "moves the cursor the nearest it can to the left edge of the editor", ->
pos1... | JavaScript | CoffeeScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | 3dab6ad77714b7519505fb1e465f0b73d935fc40 | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/3dab6ad77714b7519505fb1e465f0b73d935fc40/spec/scroll-spec.coffee | 122 | 162 |
t9md/atom-vim-mode-plus:spec/scroll-spec.coffee:4:completion | completion | beforeEach ->
startPosition = editorElement.getScrollLeft()
# FIXME: remove in future
xit "does nothing near the start of the line", ->
pos1 = zsPos(1)
expect(pos1).toEqual(startPosition)
it "moves the cursor the nearest it can to the left edge of the editor", ->
pos1... | expect(pos390).toEqual(posEnd)
expect(editor.getCursorBufferPosition()).toEqual [0, 390]
pos340 = zsPos(340)
expect(pos340).toEqual(posEnd)
it "does nothing if all lines are short", ->
editor.setText('short')
startPosition = editorElement.getScrollLeft()
pos1 = zs... | CoffeeScript | CoffeeScript | t9md/atom-vim-mode-plus | spec/scroll-spec.coffee | MIT | 3dab6ad77714b7519505fb1e465f0b73d935fc40 | 1,389 | https://github.com/t9md/atom-vim-mode-plus/blob/3dab6ad77714b7519505fb1e465f0b73d935fc40/spec/scroll-spec.coffee | 122 | 162 |
jianliaoim/talk-os:talk-web/test/spec/handlers/router.spec.coffee:1:raw_corpus | raw_corpus | Immutable = require 'immutable'
describe 'Handlers: router', ->
beforeEach ->
@routerHandler = require 'handlers/router'
describe 'Method: changeChannel', ->
_teamId = _roomId = _toId = null
beforeEach ->
_teamId = '_teamId'
_roomId = undefined
_toId = undefined
spyOn(@route... | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/handlers/router.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/handlers/router.spec.coffee | 1 | 50 | ||
jianliaoim/talk-os:talk-web/test/spec/handlers/router.spec.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Immutable = require 'immutable'
describe 'Handlers: router', ->
beforeEach ->
@routerHandler = require 'handlers/router'
describe 'Method: changeChannel', ->
_teamId = _roomId = _toId = null
beforeEach ->
_teamId = '_teamId'
_roomI... | var Immutable;
Immutable = require('immutable');
describe('Handlers: router', function() {
beforeEach(function() {
return this.routerHandler = require('handlers/router');
});
return describe('Method: changeChannel', function() {
var _roomId, _teamId, _toId;
_teamId = _roomId = _toId = null;
befo... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/test/spec/handlers/router.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/handlers/router.spec.coffee | 1 | 50 |
jianliaoim/talk-os:talk-web/test/spec/handlers/router.spec.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Immutable;
Immutable = require('immutable');
describe('Handlers: router', function() {
beforeEach(function() {
return this.routerHandler = require('handlers/router');
});
return describe('Method: changeChannel', function() {
var _roomId, _teamId... | Immutable = require 'immutable'
describe 'Handlers: router', ->
beforeEach ->
@routerHandler = require 'handlers/router'
describe 'Method: changeChannel', ->
_teamId = _roomId = _toId = null
beforeEach ->
_teamId = '_teamId'
_roomId = undefined
_toId = undefined
spyOn(@route... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/handlers/router.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/handlers/router.spec.coffee | 1 | 50 |
jianliaoim/talk-os:talk-web/test/spec/handlers/router.spec.coffee:1:completion | completion | Immutable = require 'immutable'
describe 'Handlers: router', ->
beforeEach ->
@routerHandler = require 'handlers/router'
describe 'Method: changeChannel', ->
_teamId = _roomId = _toId = null
beforeEach ->
_teamId = '_teamId'
_roomId = undefined
_toId = undefined
spyOn(@route... | it 'should goto chat page if _toId is defined', ->
_toId = '_toId'
@routerHandler.changeChannel(_teamId, _roomId, _toId)
expect(@routerHandler.room).not.toHaveBeenCalled()
expect(@routerHandler.chat).toHaveBeenCalledWith _teamId, _toId, {}
expect(@routerHandler.team).not.toHaveBeenCalled()... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/handlers/router.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/handlers/router.spec.coffee | 1 | 50 |
nevir/groc:lib/styles/default/behavior.coffee:1:raw_corpus | raw_corpus | setTableOfContentsActive = (active) ->
html$ = $('html')
if active
nav$.addClass 'active'
html$.addClass 'popped'
else
nav$.removeClass 'active'
html$.removeClass 'popped' | CoffeeScript | nevir/groc | lib/styles/default/behavior.coffee | MIT | 4945118095bb67f813fd1dd8c3406a8859c697ef | 579 | https://github.com/nevir/groc/blob/4945118095bb67f813fd1dd8c3406a8859c697ef/lib/styles/default/behavior.coffee | 11 | 19 | ||
nevir/groc:lib/styles/default/behavior.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
setTableOfContentsActive = (active) ->
html$ = $('html')
if active
nav$.addClass 'active'
html$.addClass 'popped'
else
nav$.removeClass 'active'
html$.removeClass 'popped'
``` | var setTableOfContentsActive;
setTableOfContentsActive = function(active) {
var html$;
html$ = $('html');
if (active) {
nav$.addClass('active');
return html$.addClass('popped');
} else {
nav$.removeClass('active');
return html$.removeClass('popped');
}
}; | CoffeeScript | JavaScript | nevir/groc | lib/styles/default/behavior.coffee | MIT | 4945118095bb67f813fd1dd8c3406a8859c697ef | 579 | https://github.com/nevir/groc/blob/4945118095bb67f813fd1dd8c3406a8859c697ef/lib/styles/default/behavior.coffee | 11 | 19 |
nevir/groc:lib/styles/default/behavior.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var setTableOfContentsActive;
setTableOfContentsActive = function(active) {
var html$;
html$ = $('html');
if (active) {
nav$.addClass('active');
return html$.addClass('popped');
} else {
nav$.removeClass('active');
return html$.removeClass(... | setTableOfContentsActive = (active) ->
html$ = $('html')
if active
nav$.addClass 'active'
html$.addClass 'popped'
else
nav$.removeClass 'active'
html$.removeClass 'popped' | JavaScript | CoffeeScript | nevir/groc | lib/styles/default/behavior.coffee | MIT | 4945118095bb67f813fd1dd8c3406a8859c697ef | 579 | https://github.com/nevir/groc/blob/4945118095bb67f813fd1dd8c3406a8859c697ef/lib/styles/default/behavior.coffee | 11 | 19 |
nevir/groc:lib/styles/default/behavior.coffee:1:completion | completion | setTableOfContentsActive = (active) ->
html$ = $('html')
if active | nav$.addClass 'active'
html$.addClass 'popped'
else
nav$.removeClass 'active'
html$.removeClass 'popped' | CoffeeScript | CoffeeScript | nevir/groc | lib/styles/default/behavior.coffee | MIT | 4945118095bb67f813fd1dd8c3406a8859c697ef | 579 | https://github.com/nevir/groc/blob/4945118095bb67f813fd1dd8c3406a8859c697ef/lib/styles/default/behavior.coffee | 11 | 19 |
nevir/groc:lib/styles/default/behavior.coffee:2:raw_corpus | raw_corpus | toggleTableOfContents = ->
setTableOfContentsActive not nav$.hasClass 'active'
# ### Node Navigation
currentNode$ = null | CoffeeScript | nevir/groc | lib/styles/default/behavior.coffee | MIT | 4945118095bb67f813fd1dd8c3406a8859c697ef | 579 | https://github.com/nevir/groc/blob/4945118095bb67f813fd1dd8c3406a8859c697ef/lib/styles/default/behavior.coffee | 21 | 25 | ||
nevir/groc:lib/styles/default/behavior.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
toggleTableOfContents = ->
setTableOfContentsActive not nav$.hasClass 'active'
# ### Node Navigation
currentNode$ = null
``` | var currentNode$, toggleTableOfContents;
toggleTableOfContents = function() {
return setTableOfContentsActive(!nav$.hasClass('active'));
};
// ### Node Navigation
currentNode$ = null; | CoffeeScript | JavaScript | nevir/groc | lib/styles/default/behavior.coffee | MIT | 4945118095bb67f813fd1dd8c3406a8859c697ef | 579 | https://github.com/nevir/groc/blob/4945118095bb67f813fd1dd8c3406a8859c697ef/lib/styles/default/behavior.coffee | 21 | 25 |
nevir/groc:lib/styles/default/behavior.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var currentNode$, toggleTableOfContents;
toggleTableOfContents = function() {
return setTableOfContentsActive(!nav$.hasClass('active'));
};
// ### Node Navigation
currentNode$ = null;
``` | toggleTableOfContents = ->
setTableOfContentsActive not nav$.hasClass 'active'
# ### Node Navigation
currentNode$ = null | JavaScript | CoffeeScript | nevir/groc | lib/styles/default/behavior.coffee | MIT | 4945118095bb67f813fd1dd8c3406a8859c697ef | 579 | https://github.com/nevir/groc/blob/4945118095bb67f813fd1dd8c3406a8859c697ef/lib/styles/default/behavior.coffee | 21 | 25 |
nevir/groc:lib/styles/default/behavior.coffee:2:completion | completion | toggleTableOfContents = ->
setTableOfContentsActive not nav$.hasClass 'active' | # ### Node Navigation
currentNode$ = null | CoffeeScript | CoffeeScript | nevir/groc | lib/styles/default/behavior.coffee | MIT | 4945118095bb67f813fd1dd8c3406a8859c697ef | 579 | https://github.com/nevir/groc/blob/4945118095bb67f813fd1dd8c3406a8859c697ef/lib/styles/default/behavior.coffee | 21 | 25 |
nevir/groc:lib/styles/default/behavior.coffee:3:raw_corpus | raw_corpus | focusCurrentNode = ->
# We use the first child's offset top rather than toc$.offset().top because there may be borders
# or other stylistic tweaks that further offset the scrollTop.
currentNodeTop = currentNode$.offset().top - toc$.children(':visible').first().offset().top
currentNodeBottom = currentNodeTop ... | CoffeeScript | nevir/groc | lib/styles/default/behavior.coffee | MIT | 4945118095bb67f813fd1dd8c3406a8859c697ef | 579 | https://github.com/nevir/groc/blob/4945118095bb67f813fd1dd8c3406a8859c697ef/lib/styles/default/behavior.coffee | 27 | 39 | ||
nevir/groc:lib/styles/default/behavior.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
focusCurrentNode = ->
# We use the first child's offset top rather than toc$.offset().top because there may be borders
# or other stylistic tweaks that further offset the scrollTop.
currentNodeTop = currentNode$.offset().top - toc$.children(':visible').f... | var focusCurrentNode;
focusCurrentNode = function() {
var currentNodeBottom, currentNodeTop;
// We use the first child's offset top rather than toc$.offset().top because there may be borders
// or other stylistic tweaks that further offset the scrollTop.
currentNodeTop = currentNode$.offset().top - toc$.childr... | CoffeeScript | JavaScript | nevir/groc | lib/styles/default/behavior.coffee | MIT | 4945118095bb67f813fd1dd8c3406a8859c697ef | 579 | https://github.com/nevir/groc/blob/4945118095bb67f813fd1dd8c3406a8859c697ef/lib/styles/default/behavior.coffee | 27 | 39 |
nevir/groc:lib/styles/default/behavior.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var focusCurrentNode;
focusCurrentNode = function() {
var currentNodeBottom, currentNodeTop;
// We use the first child's offset top rather than toc$.offset().top because there may be borders
// or other stylistic tweaks that further offset the scrollTop.
c... | focusCurrentNode = ->
# We use the first child's offset top rather than toc$.offset().top because there may be borders
# or other stylistic tweaks that further offset the scrollTop.
currentNodeTop = currentNode$.offset().top - toc$.children(':visible').first().offset().top
currentNodeBottom = currentNodeTop ... | JavaScript | CoffeeScript | nevir/groc | lib/styles/default/behavior.coffee | MIT | 4945118095bb67f813fd1dd8c3406a8859c697ef | 579 | https://github.com/nevir/groc/blob/4945118095bb67f813fd1dd8c3406a8859c697ef/lib/styles/default/behavior.coffee | 27 | 39 |
nevir/groc:lib/styles/default/behavior.coffee:3:completion | completion | focusCurrentNode = ->
# We use the first child's offset top rather than toc$.offset().top because there may be borders
# or other stylistic tweaks that further offset the scrollTop.
currentNodeTop = currentNode$.offset().top - toc$.children(':visible').first().offset().top
currentNodeBottom = currentNodeTop ... | # If the current node is partially or fully above the top of the viewport, scroll it into view.
if currentNodeTop < toc$.scrollTop()
toc$.scrollTop currentNodeTop
# Similarly, if we're below the bottom of the viewport, scroll up enough to make it visible.
if currentNodeBottom > toc$.scrollTop() + toc$.height... | CoffeeScript | CoffeeScript | nevir/groc | lib/styles/default/behavior.coffee | MIT | 4945118095bb67f813fd1dd8c3406a8859c697ef | 579 | https://github.com/nevir/groc/blob/4945118095bb67f813fd1dd8c3406a8859c697ef/lib/styles/default/behavior.coffee | 27 | 39 |
nevir/groc:lib/styles/default/behavior.coffee:4:raw_corpus | raw_corpus | setCurrentNodeExpanded = (expanded) ->
if expanded
currentNode$.addClass 'expanded'
else
if currentNode$.hasClass 'expanded'
currentNode$.removeClass 'expanded'
# We collapse up to the node's parent if the current node is already collapsed. This allows
# a user to quickly spam left to move u... | CoffeeScript | nevir/groc | lib/styles/default/behavior.coffee | MIT | 4945118095bb67f813fd1dd8c3406a8859c697ef | 579 | https://github.com/nevir/groc/blob/4945118095bb67f813fd1dd8c3406a8859c697ef/lib/styles/default/behavior.coffee | 41 | 54 | ||
nevir/groc:lib/styles/default/behavior.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
setCurrentNodeExpanded = (expanded) ->
if expanded
currentNode$.addClass 'expanded'
else
if currentNode$.hasClass 'expanded'
currentNode$.removeClass 'expanded'
# We collapse up to the node's parent if the current node is already collapsed.... | var setCurrentNodeExpanded;
setCurrentNodeExpanded = function(expanded) {
var parents$;
if (expanded) {
currentNode$.addClass('expanded');
} else {
if (currentNode$.hasClass('expanded')) {
currentNode$.removeClass('expanded');
} else {
// We collapse up to the node's parent if the current... | CoffeeScript | JavaScript | nevir/groc | lib/styles/default/behavior.coffee | MIT | 4945118095bb67f813fd1dd8c3406a8859c697ef | 579 | https://github.com/nevir/groc/blob/4945118095bb67f813fd1dd8c3406a8859c697ef/lib/styles/default/behavior.coffee | 41 | 54 |
nevir/groc:lib/styles/default/behavior.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var setCurrentNodeExpanded;
setCurrentNodeExpanded = function(expanded) {
var parents$;
if (expanded) {
currentNode$.addClass('expanded');
} else {
if (currentNode$.hasClass('expanded')) {
currentNode$.removeClass('expanded');
} else {
... | setCurrentNodeExpanded = (expanded) ->
if expanded
currentNode$.addClass 'expanded'
else
if currentNode$.hasClass 'expanded'
currentNode$.removeClass 'expanded'
# We collapse up to the node's parent if the current node is already collapsed. This allows
# a user to quickly spam left to move u... | JavaScript | CoffeeScript | nevir/groc | lib/styles/default/behavior.coffee | MIT | 4945118095bb67f813fd1dd8c3406a8859c697ef | 579 | https://github.com/nevir/groc/blob/4945118095bb67f813fd1dd8c3406a8859c697ef/lib/styles/default/behavior.coffee | 41 | 54 |
nevir/groc:lib/styles/default/behavior.coffee:4:completion | completion | setCurrentNodeExpanded = (expanded) ->
if expanded
currentNode$.addClass 'expanded'
else
if currentNode$.hasClass 'expanded'
currentNode$.removeClass 'expanded' | # We collapse up to the node's parent if the current node is already collapsed. This allows
# a user to quickly spam left to move up the tree.
else
parents$ = currentNode$.parents('li')
selectNode parents$.first() if parents$.length > 0
focusCurrentNode() | CoffeeScript | CoffeeScript | nevir/groc | lib/styles/default/behavior.coffee | MIT | 4945118095bb67f813fd1dd8c3406a8859c697ef | 579 | https://github.com/nevir/groc/blob/4945118095bb67f813fd1dd8c3406a8859c697ef/lib/styles/default/behavior.coffee | 41 | 54 |
nevir/groc:lib/styles/default/behavior.coffee:5:raw_corpus | raw_corpus | selectNode = (newNode$) ->
# Remove first, in case it's the same node
currentNode$.removeClass 'selected'
newNode$.addClass 'selected'
currentNode$ = newNode$
focusCurrentNode() | CoffeeScript | nevir/groc | lib/styles/default/behavior.coffee | MIT | 4945118095bb67f813fd1dd8c3406a8859c697ef | 579 | https://github.com/nevir/groc/blob/4945118095bb67f813fd1dd8c3406a8859c697ef/lib/styles/default/behavior.coffee | 56 | 62 | ||
nevir/groc:lib/styles/default/behavior.coffee:5:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
selectNode = (newNode$) ->
# Remove first, in case it's the same node
currentNode$.removeClass 'selected'
newNode$.addClass 'selected'
currentNode$ = newNode$
focusCurrentNode()
``` | var selectNode;
selectNode = function(newNode$) {
var currentNode$;
// Remove first, in case it's the same node
currentNode$.removeClass('selected');
newNode$.addClass('selected');
currentNode$ = newNode$;
return focusCurrentNode();
}; | CoffeeScript | JavaScript | nevir/groc | lib/styles/default/behavior.coffee | MIT | 4945118095bb67f813fd1dd8c3406a8859c697ef | 579 | https://github.com/nevir/groc/blob/4945118095bb67f813fd1dd8c3406a8859c697ef/lib/styles/default/behavior.coffee | 56 | 62 |
nevir/groc:lib/styles/default/behavior.coffee:5:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var selectNode;
selectNode = function(newNode$) {
var currentNode$;
// Remove first, in case it's the same node
currentNode$.removeClass('selected');
newNode$.addClass('selected');
currentNode$ = newNode$;
return focusCurrentNode();
};
``` | selectNode = (newNode$) ->
# Remove first, in case it's the same node
currentNode$.removeClass 'selected'
newNode$.addClass 'selected'
currentNode$ = newNode$
focusCurrentNode() | JavaScript | CoffeeScript | nevir/groc | lib/styles/default/behavior.coffee | MIT | 4945118095bb67f813fd1dd8c3406a8859c697ef | 579 | https://github.com/nevir/groc/blob/4945118095bb67f813fd1dd8c3406a8859c697ef/lib/styles/default/behavior.coffee | 56 | 62 |
nevir/groc:lib/styles/default/behavior.coffee:5:completion | completion | selectNode = (newNode$) ->
# Remove first, in case it's the same node
currentNode$.removeClass 'selected' | newNode$.addClass 'selected'
currentNode$ = newNode$
focusCurrentNode() | CoffeeScript | CoffeeScript | nevir/groc | lib/styles/default/behavior.coffee | MIT | 4945118095bb67f813fd1dd8c3406a8859c697ef | 579 | https://github.com/nevir/groc/blob/4945118095bb67f813fd1dd8c3406a8859c697ef/lib/styles/default/behavior.coffee | 56 | 62 |
nevir/groc:lib/styles/default/behavior.coffee:6:raw_corpus | raw_corpus | selectNodeByDocumentPath = (documentPath, headerSlug=null) ->
currentNode$ = fileMap[documentPath]
if headerSlug
for link in currentNode$.find '.outline a'
urlChunks = $(link).attr('href').split '#'
if urlChunks[1] == headerSlug
currentNode$ = $(link).parents('li').first()
console.l... | CoffeeScript | nevir/groc | lib/styles/default/behavior.coffee | MIT | 4945118095bb67f813fd1dd8c3406a8859c697ef | 579 | https://github.com/nevir/groc/blob/4945118095bb67f813fd1dd8c3406a8859c697ef/lib/styles/default/behavior.coffee | 64 | 78 | ||
nevir/groc:lib/styles/default/behavior.coffee:6:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
selectNodeByDocumentPath = (documentPath, headerSlug=null) ->
currentNode$ = fileMap[documentPath]
if headerSlug
for link in currentNode$.find '.outline a'
urlChunks = $(link).attr('href').split '#'
if urlChunks[1] == headerSlug
curre... | var selectNodeByDocumentPath;
selectNodeByDocumentPath = function(documentPath, headerSlug = null) {
var currentNode$, i, len, link, ref, urlChunks;
currentNode$ = fileMap[documentPath];
if (headerSlug) {
ref = currentNode$.find('.outline a');
for (i = 0, len = ref.length; i < len; i++) {
link = re... | CoffeeScript | JavaScript | nevir/groc | lib/styles/default/behavior.coffee | MIT | 4945118095bb67f813fd1dd8c3406a8859c697ef | 579 | https://github.com/nevir/groc/blob/4945118095bb67f813fd1dd8c3406a8859c697ef/lib/styles/default/behavior.coffee | 64 | 78 |
nevir/groc:lib/styles/default/behavior.coffee:6:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var selectNodeByDocumentPath;
selectNodeByDocumentPath = function(documentPath, headerSlug = null) {
var currentNode$, i, len, link, ref, urlChunks;
currentNode$ = fileMap[documentPath];
if (headerSlug) {
ref = currentNode$.find('.outline a');
for (i... | selectNodeByDocumentPath = (documentPath, headerSlug=null) ->
currentNode$ = fileMap[documentPath]
if headerSlug
for link in currentNode$.find '.outline a'
urlChunks = $(link).attr('href').split '#'
if urlChunks[1] == headerSlug
currentNode$ = $(link).parents('li').first()
console.l... | JavaScript | CoffeeScript | nevir/groc | lib/styles/default/behavior.coffee | MIT | 4945118095bb67f813fd1dd8c3406a8859c697ef | 579 | https://github.com/nevir/groc/blob/4945118095bb67f813fd1dd8c3406a8859c697ef/lib/styles/default/behavior.coffee | 64 | 78 |
nevir/groc:lib/styles/default/behavior.coffee:6:completion | completion | selectNodeByDocumentPath = (documentPath, headerSlug=null) ->
currentNode$ = fileMap[documentPath]
if headerSlug
for link in currentNode$.find '.outline a'
urlChunks = $(link).attr('href').split '#'
if urlChunks[1] == headerSlug | currentNode$ = $(link).parents('li').first()
console.log urlChunks, "(#{headerSlug})"
break
currentNode$.addClass 'selected expanded'
currentNode$.parents('li').addClass 'expanded'
focusCurrentNode() | CoffeeScript | CoffeeScript | nevir/groc | lib/styles/default/behavior.coffee | MIT | 4945118095bb67f813fd1dd8c3406a8859c697ef | 579 | https://github.com/nevir/groc/blob/4945118095bb67f813fd1dd8c3406a8859c697ef/lib/styles/default/behavior.coffee | 64 | 78 |
nevir/groc:lib/styles/default/behavior.coffee:7:raw_corpus | raw_corpus | moveCurrentNode = (up) ->
visibleNodes$ = toc$.find 'li:visible'
# Fall back to the first node if anything goes wrong
newIndex = 0
for node, i in visibleNodes$
if node == currentNode$[0]
newIndex = if up then i - 1 else i + 1
newIndex = 0 if newIndex < 0
newIndex = visibleNodes$.length - ... | CoffeeScript | nevir/groc | lib/styles/default/behavior.coffee | MIT | 4945118095bb67f813fd1dd8c3406a8859c697ef | 579 | https://github.com/nevir/groc/blob/4945118095bb67f813fd1dd8c3406a8859c697ef/lib/styles/default/behavior.coffee | 80 | 92 | ||
nevir/groc:lib/styles/default/behavior.coffee:7:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
moveCurrentNode = (up) ->
visibleNodes$ = toc$.find 'li:visible'
# Fall back to the first node if anything goes wrong
newIndex = 0
for node, i in visibleNodes$
if node == currentNode$[0]
newIndex = if up then i - 1 else i + 1
newIndex = 0... | var moveCurrentNode;
moveCurrentNode = function(up) {
var i, j, len, newIndex, node, visibleNodes$;
visibleNodes$ = toc$.find('li:visible');
// Fall back to the first node if anything goes wrong
newIndex = 0;
for (i = j = 0, len = visibleNodes$.length; j < len; i = ++j) {
node = visibleNodes$[i];
if ... | CoffeeScript | JavaScript | nevir/groc | lib/styles/default/behavior.coffee | MIT | 4945118095bb67f813fd1dd8c3406a8859c697ef | 579 | https://github.com/nevir/groc/blob/4945118095bb67f813fd1dd8c3406a8859c697ef/lib/styles/default/behavior.coffee | 80 | 92 |
nevir/groc:lib/styles/default/behavior.coffee:7:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var moveCurrentNode;
moveCurrentNode = function(up) {
var i, j, len, newIndex, node, visibleNodes$;
visibleNodes$ = toc$.find('li:visible');
// Fall back to the first node if anything goes wrong
newIndex = 0;
for (i = j = 0, len = visibleNodes$.length; j... | moveCurrentNode = (up) ->
visibleNodes$ = toc$.find 'li:visible'
# Fall back to the first node if anything goes wrong
newIndex = 0
for node, i in visibleNodes$
if node == currentNode$[0]
newIndex = if up then i - 1 else i + 1
newIndex = 0 if newIndex < 0
newIndex = visibleNodes$.length - ... | JavaScript | CoffeeScript | nevir/groc | lib/styles/default/behavior.coffee | MIT | 4945118095bb67f813fd1dd8c3406a8859c697ef | 579 | https://github.com/nevir/groc/blob/4945118095bb67f813fd1dd8c3406a8859c697ef/lib/styles/default/behavior.coffee | 80 | 92 |
nevir/groc:lib/styles/default/behavior.coffee:7:completion | completion | moveCurrentNode = (up) ->
visibleNodes$ = toc$.find 'li:visible'
# Fall back to the first node if anything goes wrong
newIndex = 0
for node, i in visibleNodes$ | if node == currentNode$[0]
newIndex = if up then i - 1 else i + 1
newIndex = 0 if newIndex < 0
newIndex = visibleNodes$.length - 1 if newIndex > visibleNodes$.length - 1
break
selectNode $(visibleNodes$[newIndex]) | CoffeeScript | CoffeeScript | nevir/groc | lib/styles/default/behavior.coffee | MIT | 4945118095bb67f813fd1dd8c3406a8859c697ef | 579 | https://github.com/nevir/groc/blob/4945118095bb67f813fd1dd8c3406a8859c697ef/lib/styles/default/behavior.coffee | 80 | 92 |
nevir/groc:lib/styles/default/behavior.coffee:8:raw_corpus | raw_corpus | visitCurrentNode = ->
labelLink$ = currentNode$.children('a.label')
window.location = labelLink$.attr 'href' if labelLink$.length > 0
# ## DOM Construction
#
# Navigation and the table of contents are entirely managed by us. | CoffeeScript | nevir/groc | lib/styles/default/behavior.coffee | MIT | 4945118095bb67f813fd1dd8c3406a8859c697ef | 579 | https://github.com/nevir/groc/blob/4945118095bb67f813fd1dd8c3406a8859c697ef/lib/styles/default/behavior.coffee | 94 | 101 | ||
nevir/groc:lib/styles/default/behavior.coffee:8:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
visitCurrentNode = ->
labelLink$ = currentNode$.children('a.label')
window.location = labelLink$.attr 'href' if labelLink$.length > 0
# ## DOM Construction
#
# Navigation and the table of contents are entirely managed by us.
``` | var visitCurrentNode;
visitCurrentNode = function() {
var labelLink$;
labelLink$ = currentNode$.children('a.label');
if (labelLink$.length > 0) {
return window.location = labelLink$.attr('href');
}
};
// ## DOM Construction
// Navigation and the table of contents are entirely managed by us. | CoffeeScript | JavaScript | nevir/groc | lib/styles/default/behavior.coffee | MIT | 4945118095bb67f813fd1dd8c3406a8859c697ef | 579 | https://github.com/nevir/groc/blob/4945118095bb67f813fd1dd8c3406a8859c697ef/lib/styles/default/behavior.coffee | 94 | 101 |
nevir/groc:lib/styles/default/behavior.coffee:8:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var visitCurrentNode;
visitCurrentNode = function() {
var labelLink$;
labelLink$ = currentNode$.children('a.label');
if (labelLink$.length > 0) {
return window.location = labelLink$.attr('href');
}
};
// ## DOM Construction
// Navigation and the tabl... | visitCurrentNode = ->
labelLink$ = currentNode$.children('a.label')
window.location = labelLink$.attr 'href' if labelLink$.length > 0
# ## DOM Construction
#
# Navigation and the table of contents are entirely managed by us. | JavaScript | CoffeeScript | nevir/groc | lib/styles/default/behavior.coffee | MIT | 4945118095bb67f813fd1dd8c3406a8859c697ef | 579 | https://github.com/nevir/groc/blob/4945118095bb67f813fd1dd8c3406a8859c697ef/lib/styles/default/behavior.coffee | 94 | 101 |
nevir/groc:lib/styles/default/behavior.coffee:10:raw_corpus | raw_corpus | buildNav = (relativeRoot) ->
nav$ = $("""
<nav>
<ul class="tools">
<li class="github"><a href="https://github.com/nevir/groc" title="Project source on GitHub">Project source on GitHub</a></li>
<li class="toggle">Table of Contents</li>
<li class="search"><input id="search" type="searc... | CoffeeScript | nevir/groc | lib/styles/default/behavior.coffee | MIT | 4945118095bb67f813fd1dd8c3406a8859c697ef | 579 | https://github.com/nevir/groc/blob/4945118095bb67f813fd1dd8c3406a8859c697ef/lib/styles/default/behavior.coffee | 104 | 121 | ||
nevir/groc:lib/styles/default/behavior.coffee:10:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
buildNav = (relativeRoot) ->
nav$ = $("""
<nav>
<ul class="tools">
<li class="github"><a href="https://github.com/nevir/groc" title="Project source on GitHub">Project source on GitHub</a></li>
<li class="toggle">Table of Contents</li>
... | var buildNav;
buildNav = function(relativeRoot) {
var i, len, nav$, node, toc$;
nav$ = $(`<nav>
<ul class="tools">
<li class="github"><a href="https://github.com/nevir/groc" title="Project source on GitHub">Project source on GitHub</a></li>
<li class="toggle">Table of Contents</li>
<li class="search"... | CoffeeScript | JavaScript | nevir/groc | lib/styles/default/behavior.coffee | MIT | 4945118095bb67f813fd1dd8c3406a8859c697ef | 579 | https://github.com/nevir/groc/blob/4945118095bb67f813fd1dd8c3406a8859c697ef/lib/styles/default/behavior.coffee | 104 | 121 |
nevir/groc:lib/styles/default/behavior.coffee:10:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var buildNav;
buildNav = function(relativeRoot) {
var i, len, nav$, node, toc$;
nav$ = $(`<nav>
<ul class="tools">
<li class="github"><a href="https://github.com/nevir/groc" title="Project source on GitHub">Project source on GitHub</a></li>
<li class... | buildNav = (relativeRoot) ->
nav$ = $("""
<nav>
<ul class="tools">
<li class="github"><a href="https://github.com/nevir/groc" title="Project source on GitHub">Project source on GitHub</a></li>
<li class="toggle">Table of Contents</li>
<li class="search"><input id="search" type="searc... | JavaScript | CoffeeScript | nevir/groc | lib/styles/default/behavior.coffee | MIT | 4945118095bb67f813fd1dd8c3406a8859c697ef | 579 | https://github.com/nevir/groc/blob/4945118095bb67f813fd1dd8c3406a8859c697ef/lib/styles/default/behavior.coffee | 104 | 121 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.