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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Atraci/Atraci:coffee/_utils.coffee:1:completion | completion | class Utils
@filterSymbols: (name) ->
return name.replace(/([.*+?^=!:${}()|\[\]\/\\ ])/g, '')
@getYoutubePlaylistId: (link) ->
re = ///
^.*(youtu.be\/|list=)
([^#\&\?]*).*
///
match = link.match(re) | if match and match[2]
return match[2]
else
return undefined
@createRandomPlaylistName: (playlistId = '') ->
randomId = playlistId.split('').sort(() ->
return 0.5 - Math.random()
).join('')
return l10n.get('playlist') + '-' + randomId.substr(0, 5) | CoffeeScript | CoffeeScript | Atraci/Atraci | coffee/_utils.coffee | MIT | d3fd00622f5f2e6c5d402c7a1ef2cd693f35e9ca | 800 | https://github.com/Atraci/Atraci/blob/d3fd00622f5f2e6c5d402c7a1ef2cd693f35e9ca/coffee/_utils.coffee | 1 | 21 |
Atraci/Atraci:coffee/_utils.coffee:1:raw_corpus | raw_corpus | class Utils
@filterSymbols: (name) ->
return name.replace(/([.*+?^=!:${}()|\[\]\/\\ ])/g, '')
@getYoutubePlaylistId: (link) ->
re = ///
^.*(youtu.be\/|list=)
([^#\&\?]*).*
///
match = link.match(re)
if match and match[2]
return match[2]
else
return undefined | CoffeeScript | Atraci/Atraci | coffee/_utils.coffee | MIT | a87e771f914303d41e4c8bd67fa64779e80a96b4 | 800 | https://github.com/Atraci/Atraci/blob/a87e771f914303d41e4c8bd67fa64779e80a96b4/coffee/_utils.coffee | 1 | 14 | ||
Atraci/Atraci:coffee/_utils.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class Utils
@filterSymbols: (name) ->
return name.replace(/([.*+?^=!:${}()|\[\]\/\\ ])/g, '')
@getYoutubePlaylistId: (link) ->
re = ///
^.*(youtu.be\/|list=)
([^#\&\?]*).*
///
match = link.match(re)
if match and match[2]
... | var Utils;
Utils = class Utils {
static filterSymbols(name) {
return name.replace(/([.*+?^=!:${}()|\[\]\/\\ ])/g, '');
}
static getYoutubePlaylistId(link) {
var match, re;
re = /^.*(youtu.be\/|list=)([^#\&\?]*).*/;
match = link.match(re);
if (match && match[2]) {
return match[2];
}... | CoffeeScript | JavaScript | Atraci/Atraci | coffee/_utils.coffee | MIT | a87e771f914303d41e4c8bd67fa64779e80a96b4 | 800 | https://github.com/Atraci/Atraci/blob/a87e771f914303d41e4c8bd67fa64779e80a96b4/coffee/_utils.coffee | 1 | 14 |
Atraci/Atraci:coffee/_utils.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Utils;
Utils = class Utils {
static filterSymbols(name) {
return name.replace(/([.*+?^=!:${}()|\[\]\/\\ ])/g, '');
}
static getYoutubePlaylistId(link) {
var match, re;
re = /^.*(youtu.be\/|list=)([^#\&\?]*).*/;
match = link.match(re);
... | class Utils
@filterSymbols: (name) ->
return name.replace(/([.*+?^=!:${}()|\[\]\/\\ ])/g, '')
@getYoutubePlaylistId: (link) ->
re = ///
^.*(youtu.be\/|list=)
([^#\&\?]*).*
///
match = link.match(re)
if match and match[2]
return match[2]
else
return undefined | JavaScript | CoffeeScript | Atraci/Atraci | coffee/_utils.coffee | MIT | a87e771f914303d41e4c8bd67fa64779e80a96b4 | 800 | https://github.com/Atraci/Atraci/blob/a87e771f914303d41e4c8bd67fa64779e80a96b4/coffee/_utils.coffee | 1 | 14 |
Atraci/Atraci:coffee/_utils.coffee:1:completion | completion | class Utils
@filterSymbols: (name) ->
return name.replace(/([.*+?^=!:${}()|\[\]\/\\ ])/g, '')
@getYoutubePlaylistId: (link) ->
re = ///
^.*(youtu.be\/|list=) | ([^#\&\?]*).*
///
match = link.match(re)
if match and match[2]
return match[2]
else
return undefined | CoffeeScript | CoffeeScript | Atraci/Atraci | coffee/_utils.coffee | MIT | a87e771f914303d41e4c8bd67fa64779e80a96b4 | 800 | https://github.com/Atraci/Atraci/blob/a87e771f914303d41e4c8bd67fa64779e80a96b4/coffee/_utils.coffee | 1 | 14 |
Atraci/Atraci:coffee/_utils.coffee:1:raw_corpus | raw_corpus | class Utils
@filterSymbols: (name) ->
return name.replace(/[^\w]/gi, '') | CoffeeScript | Atraci/Atraci | coffee/_utils.coffee | MIT | 47800ef59ea583716fd8459f1c27bbb5a58037e7 | 800 | https://github.com/Atraci/Atraci/blob/47800ef59ea583716fd8459f1c27bbb5a58037e7/coffee/_utils.coffee | 1 | 3 | ||
Atraci/Atraci:coffee/_utils.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class Utils
@filterSymbols: (name) ->
return name.replace(/[^\w]/gi, '')
``` | var Utils;
Utils = class Utils {
static filterSymbols(name) {
return name.replace(/[^\w]/gi, '');
}
}; | CoffeeScript | JavaScript | Atraci/Atraci | coffee/_utils.coffee | MIT | 47800ef59ea583716fd8459f1c27bbb5a58037e7 | 800 | https://github.com/Atraci/Atraci/blob/47800ef59ea583716fd8459f1c27bbb5a58037e7/coffee/_utils.coffee | 1 | 3 |
Atraci/Atraci:coffee/_utils.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Utils;
Utils = class Utils {
static filterSymbols(name) {
return name.replace(/[^\w]/gi, '');
}
};
``` | class Utils
@filterSymbols: (name) ->
return name.replace(/[^\w]/gi, '') | JavaScript | CoffeeScript | Atraci/Atraci | coffee/_utils.coffee | MIT | 47800ef59ea583716fd8459f1c27bbb5a58037e7 | 800 | https://github.com/Atraci/Atraci/blob/47800ef59ea583716fd8459f1c27bbb5a58037e7/coffee/_utils.coffee | 1 | 3 |
mojotech/pioneer:src/support/Widget.coffee:1:raw_corpus | raw_corpus | module.exports = ->
World = @
@Widgets = {}
class @Widget
@extend: (protoProps, staticProps) ->
parent = @
if Object.hasOwnProperty(protoProps, 'constructor')
child = protoProps.constructor
else
child = -> parent.apply(@, arguments)
child.copyProperties @
chi... | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | dafc9c890823c64cb225d53c575d3d6afba17055 | 523 | https://github.com/mojotech/pioneer/blob/dafc9c890823c64cb225d53c575d3d6afba17055/src/support/Widget.coffee | 1 | 50 | ||
mojotech/pioneer:src/support/Widget.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = ->
World = @
@Widgets = {}
class @Widget
@extend: (protoProps, staticProps) ->
parent = @
if Object.hasOwnProperty(protoProps, 'constructor')
child = protoProps.constructor
else
child = -> parent.ap... | module.exports = function() {
var World;
World = this;
this.Widgets = {};
return this.Widget = (function() {
class Widget {
static extend(protoProps, staticProps) {
var Surrogate, child, parent;
parent = this;
if (Object.hasOwnProperty(protoProps, 'constructor')) {
ch... | CoffeeScript | JavaScript | mojotech/pioneer | src/support/Widget.coffee | MIT | dafc9c890823c64cb225d53c575d3d6afba17055 | 523 | https://github.com/mojotech/pioneer/blob/dafc9c890823c64cb225d53c575d3d6afba17055/src/support/Widget.coffee | 1 | 50 |
mojotech/pioneer:src/support/Widget.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
module.exports = function() {
var World;
World = this;
this.Widgets = {};
return this.Widget = (function() {
class Widget {
static extend(protoProps, staticProps) {
var Surrogate, child, parent;
parent = this;
if (Object.ha... | module.exports = ->
World = @
@Widgets = {}
class @Widget
@extend: (protoProps, staticProps) ->
parent = @
if Object.hasOwnProperty(protoProps, 'constructor')
child = protoProps.constructor
else
child = -> parent.apply(@, arguments)
child.copyProperties @
chi... | JavaScript | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | dafc9c890823c64cb225d53c575d3d6afba17055 | 523 | https://github.com/mojotech/pioneer/blob/dafc9c890823c64cb225d53c575d3d6afba17055/src/support/Widget.coffee | 1 | 50 |
mojotech/pioneer:src/support/Widget.coffee:1:completion | completion | module.exports = ->
World = @
@Widgets = {}
class @Widget
@extend: (protoProps, staticProps) ->
parent = @
if Object.hasOwnProperty(protoProps, 'constructor')
child = protoProps.constructor
else
child = -> parent.apply(@, arguments)
child.copyProperties @
chi... | child.__super__ = @::
child
@find = (attributes) ->
_this = _.extend(new this, attributes)
_this.find().then (el) ->
_this.el = el
_this
constructor: (attributes = {}) ->
_.extend @, attributes
@initialize.apply @, arguments
# Defines a noop initialize met... | CoffeeScript | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | dafc9c890823c64cb225d53c575d3d6afba17055 | 523 | https://github.com/mojotech/pioneer/blob/dafc9c890823c64cb225d53c575d3d6afba17055/src/support/Widget.coffee | 1 | 50 |
mojotech/pioneer:src/support/Widget.coffee:2:raw_corpus | raw_corpus | click: (selector) ->
@find(selector).click()
fill: (selector, value) ->
el = @find(selector)
el.clear().then ->
el.sendKeys(value)
read: (selector) ->
selected = @find(selector)
selected.getAttribute('value').then (value) ->
value or selected.getText()
find: ... | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | dafc9c890823c64cb225d53c575d3d6afba17055 | 523 | https://github.com/mojotech/pioneer/blob/dafc9c890823c64cb225d53c575d3d6afba17055/src/support/Widget.coffee | 51 | 100 | ||
mojotech/pioneer:src/support/Widget.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
click: (selector) ->
@find(selector).click()
fill: (selector, value) ->
el = @find(selector)
el.clear().then ->
el.sendKeys(value)
read: (selector) ->
selected = @find(selector)
selected.getAttribute('value').then (... | ({
click: function(selector) {
return this.find(selector).click();
},
fill: function(selector, value) {
var el;
el = this.find(selector);
return el.clear().then(function() {
return el.sendKeys(value);
});
},
read: function(selector) {
var selected;
selected = this.find(select... | CoffeeScript | JavaScript | mojotech/pioneer | src/support/Widget.coffee | MIT | dafc9c890823c64cb225d53c575d3d6afba17055 | 523 | https://github.com/mojotech/pioneer/blob/dafc9c890823c64cb225d53c575d3d6afba17055/src/support/Widget.coffee | 51 | 100 |
mojotech/pioneer:src/support/Widget.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
click: function(selector) {
return this.find(selector).click();
},
fill: function(selector, value) {
var el;
el = this.find(selector);
return el.clear().then(function() {
return el.sendKeys(value);
});
},
read: function(select... | click: (selector) ->
@find(selector).click()
fill: (selector, value) ->
el = @find(selector)
el.clear().then ->
el.sendKeys(value)
read: (selector) ->
selected = @find(selector)
selected.getAttribute('value').then (value) ->
value or selected.getText()
find: ... | JavaScript | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | dafc9c890823c64cb225d53c575d3d6afba17055 | 523 | https://github.com/mojotech/pioneer/blob/dafc9c890823c64cb225d53c575d3d6afba17055/src/support/Widget.coffee | 51 | 100 |
mojotech/pioneer:src/support/Widget.coffee:2:completion | completion | click: (selector) ->
@find(selector).click()
fill: (selector, value) ->
el = @find(selector)
el.clear().then ->
el.sendKeys(value)
read: (selector) ->
selected = @find(selector)
selected.getAttribute('value').then (value) ->
value or selected.getText()
find: ... | @driver.isElementPresent(Driver.By.css(@root))
findAll: (selector) ->
@driver.findElements(Driver.By.css(@_selector(selector)))
_selector: (selector) ->
@root + (if selector then " #{selector}" else '')
_map: (collection, callback) ->
results = []
_reduce = (p, f, i) ->
p.... | CoffeeScript | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | dafc9c890823c64cb225d53c575d3d6afba17055 | 523 | https://github.com/mojotech/pioneer/blob/dafc9c890823c64cb225d53c575d3d6afba17055/src/support/Widget.coffee | 51 | 100 |
mojotech/pioneer:src/support/Widget.coffee:3:raw_corpus | raw_corpus | _.object(read)
_name: (name) ->
"[name='#{name}']"
_type: (type) ->
"[type='#{type}']"
class @Widget.Form extends @Widget.Fields
submitSelector: ->
@_type('submit')
submitWith: (values) =>
@fillAll(values)
@click @submitSelector()
class @Widget.List extends @Widget... | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | dafc9c890823c64cb225d53c575d3d6afba17055 | 523 | https://github.com/mojotech/pioneer/blob/dafc9c890823c64cb225d53c575d3d6afba17055/src/support/Widget.coffee | 101 | 136 | ||
mojotech/pioneer:src/support/Widget.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
_.object(read)
_name: (name) ->
"[name='#{name}']"
_type: (type) ->
"[type='#{type}']"
class @Widget.Form extends @Widget.Fields
submitSelector: ->
@_type('submit')
submitWith: (values) =>
@fillAll(values)
@clic... | var ref,
boundMethodCheck = function(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new Error('Bound instance method accessed before binding'); } };
_.object(read)({
_name: function(name) {
return `[name='${name}']`;
},
_type: function(type) {
return `[type='${type}']`;
}
})... | CoffeeScript | JavaScript | mojotech/pioneer | src/support/Widget.coffee | MIT | dafc9c890823c64cb225d53c575d3d6afba17055 | 523 | https://github.com/mojotech/pioneer/blob/dafc9c890823c64cb225d53c575d3d6afba17055/src/support/Widget.coffee | 101 | 136 |
mojotech/pioneer:src/support/Widget.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var ref,
boundMethodCheck = function(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new Error('Bound instance method accessed before binding'); } };
_.object(read)({
_name: function(name) {
return `[name='${name}']`;
},
_type:... | _.object(read)
_name: (name) ->
"[name='#{name}']"
_type: (type) ->
"[type='#{type}']"
class @Widget.Form extends @Widget.Fields
submitSelector: ->
@_type('submit')
submitWith: (values) =>
@fillAll(values)
@click @submitSelector()
class @Widget.List extends @Widget... | JavaScript | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | dafc9c890823c64cb225d53c575d3d6afba17055 | 523 | https://github.com/mojotech/pioneer/blob/dafc9c890823c64cb225d53c575d3d6afba17055/src/support/Widget.coffee | 101 | 136 |
mojotech/pioneer:src/support/Widget.coffee:3:completion | completion | _.object(read)
_name: (name) ->
"[name='#{name}']"
_type: (type) ->
"[type='#{type}']"
class @Widget.Form extends @Widget.Fields
submitSelector: ->
@_type('submit')
submitWith: (values) =>
@fillAll(values)
@click @submitSelector()
class @Widget.List extends @Widget... | itemClass: World.Widget
at: (index) ->
@items().then (items) ->
items[index]
map: (iter) ->
@items().then (items) -> $.map(items, iter)
filter: (iter) ->
@items().then (items) -> $.filter(items, iter)
items: ->
@findAll(@itemSelector).then (items) =>
_.map ite... | CoffeeScript | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | dafc9c890823c64cb225d53c575d3d6afba17055 | 523 | https://github.com/mojotech/pioneer/blob/dafc9c890823c64cb225d53c575d3d6afba17055/src/support/Widget.coffee | 101 | 136 |
mojotech/pioneer:src/support/Widget.coffee:1:raw_corpus | raw_corpus | module.exports = ->
World = @
@Widgets = {}
class @Widget
@extend: (protoProps, staticProps) ->
parent = @
if Object.hasOwnProperty(protoProps, 'constructor')
child = protoProps.constructor
else
child = -> parent.apply(@, arguments)
child.copyProperties @
chi... | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | 7910326f39f4a7fc35757d8cd22a929255638771 | 523 | https://github.com/mojotech/pioneer/blob/7910326f39f4a7fc35757d8cd22a929255638771/src/support/Widget.coffee | 1 | 50 | ||
mojotech/pioneer:src/support/Widget.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = ->
World = @
@Widgets = {}
class @Widget
@extend: (protoProps, staticProps) ->
parent = @
if Object.hasOwnProperty(protoProps, 'constructor')
child = protoProps.constructor
else
child = -> parent.ap... | module.exports = function() {
var World;
World = this;
this.Widgets = {};
return this.Widget = (function() {
class Widget {
static extend(protoProps, staticProps) {
var Surrogate, child, parent;
parent = this;
if (Object.hasOwnProperty(protoProps, 'constructor')) {
ch... | CoffeeScript | JavaScript | mojotech/pioneer | src/support/Widget.coffee | MIT | 7910326f39f4a7fc35757d8cd22a929255638771 | 523 | https://github.com/mojotech/pioneer/blob/7910326f39f4a7fc35757d8cd22a929255638771/src/support/Widget.coffee | 1 | 50 |
mojotech/pioneer:src/support/Widget.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
module.exports = function() {
var World;
World = this;
this.Widgets = {};
return this.Widget = (function() {
class Widget {
static extend(protoProps, staticProps) {
var Surrogate, child, parent;
parent = this;
if (Object.ha... | module.exports = ->
World = @
@Widgets = {}
class @Widget
@extend: (protoProps, staticProps) ->
parent = @
if Object.hasOwnProperty(protoProps, 'constructor')
child = protoProps.constructor
else
child = -> parent.apply(@, arguments)
child.copyProperties @
chi... | JavaScript | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | 7910326f39f4a7fc35757d8cd22a929255638771 | 523 | https://github.com/mojotech/pioneer/blob/7910326f39f4a7fc35757d8cd22a929255638771/src/support/Widget.coffee | 1 | 50 |
mojotech/pioneer:src/support/Widget.coffee:1:completion | completion | module.exports = ->
World = @
@Widgets = {}
class @Widget
@extend: (protoProps, staticProps) ->
parent = @
if Object.hasOwnProperty(protoProps, 'constructor')
child = protoProps.constructor
else
child = -> parent.apply(@, arguments)
child.copyProperties @
chi... | child
constructor: (attributes = {}) ->
_.extend @, attributes
@initialize.apply @, arguments
# Defines a noop initialize method intended to be
# overridden by the user when extending a Widget base class
initialize: ->
world: World
# use a getter to lazily initialize driver
... | CoffeeScript | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | 7910326f39f4a7fc35757d8cd22a929255638771 | 523 | https://github.com/mojotech/pioneer/blob/7910326f39f4a7fc35757d8cd22a929255638771/src/support/Widget.coffee | 1 | 50 |
mojotech/pioneer:src/support/Widget.coffee:2:raw_corpus | raw_corpus | el.sendKeys(value)
read: (selector) ->
selected = @find(selector)
selected.getAttribute('value').then (value) ->
value or selected.getText()
find: (selector) ->
_selector = Driver.By.css(@_selector(selector))
_isPresent = =>
@driver.isElementPresent(_selector)
@... | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | 7910326f39f4a7fc35757d8cd22a929255638771 | 523 | https://github.com/mojotech/pioneer/blob/7910326f39f4a7fc35757d8cd22a929255638771/src/support/Widget.coffee | 51 | 100 | ||
mojotech/pioneer:src/support/Widget.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
el.sendKeys(value)
read: (selector) ->
selected = @find(selector)
selected.getAttribute('value').then (value) ->
value or selected.getText()
find: (selector) ->
_selector = Driver.By.css(@_selector(selector))
_isPresent ... | el.sendKeys(value)({
read: function(selector) {
var selected;
selected = this.find(selector);
return selected.getAttribute('value').then(function(value) {
return value || selected.getText();
});
},
find: function(selector) {
var _isPresent, _selector;
_selector = Driver.By.css(this._... | CoffeeScript | JavaScript | mojotech/pioneer | src/support/Widget.coffee | MIT | 7910326f39f4a7fc35757d8cd22a929255638771 | 523 | https://github.com/mojotech/pioneer/blob/7910326f39f4a7fc35757d8cd22a929255638771/src/support/Widget.coffee | 51 | 100 |
mojotech/pioneer:src/support/Widget.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
el.sendKeys(value)({
read: function(selector) {
var selected;
selected = this.find(selector);
return selected.getAttribute('value').then(function(value) {
return value || selected.getText();
});
},
find: function(selector) {
var _isP... | el.sendKeys(value)
read: (selector) ->
selected = @find(selector)
selected.getAttribute('value').then (value) ->
value or selected.getText()
find: (selector) ->
_selector = Driver.By.css(@_selector(selector))
_isPresent = =>
@driver.isElementPresent(_selector)
@... | JavaScript | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | 7910326f39f4a7fc35757d8cd22a929255638771 | 523 | https://github.com/mojotech/pioneer/blob/7910326f39f4a7fc35757d8cd22a929255638771/src/support/Widget.coffee | 51 | 100 |
mojotech/pioneer:src/support/Widget.coffee:2:completion | completion | el.sendKeys(value)
read: (selector) ->
selected = @find(selector)
selected.getAttribute('value').then (value) ->
value or selected.getText()
find: (selector) ->
_selector = Driver.By.css(@_selector(selector))
_isPresent = =>
@driver.isElementPresent(_selector)
@... | @root + (if selector then " #{selector}" else '')
_map: (collection, callback) ->
results = []
_reduce = (p, f, i) ->
p.then ->
callback(f, i).then (v) -> results.push(v)
_.reduce(collection, _reduce, Driver.promise.fulfilled())
.then -> results
class @Widget.Fields e... | CoffeeScript | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | 7910326f39f4a7fc35757d8cd22a929255638771 | 523 | https://github.com/mojotech/pioneer/blob/7910326f39f4a7fc35757d8cd22a929255638771/src/support/Widget.coffee | 51 | 100 |
mojotech/pioneer:src/support/Widget.coffee:3:raw_corpus | raw_corpus | "[type='#{type}']"
class @Widget.Form extends @Widget.Fields
submitSelector: ->
@_type('submit')
submitWith: (values) =>
@fillAll(values)
@click @submitSelector()
class @Widget.List extends @Widget
itemSelector: 'li'
itemClass: World.Widget
at: (index) ->
@items().th... | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | 7910326f39f4a7fc35757d8cd22a929255638771 | 523 | https://github.com/mojotech/pioneer/blob/7910326f39f4a7fc35757d8cd22a929255638771/src/support/Widget.coffee | 101 | 130 | ||
mojotech/pioneer:src/support/Widget.coffee:3:completion | completion | "[type='#{type}']"
class @Widget.Form extends @Widget.Fields
submitSelector: ->
@_type('submit')
submitWith: (values) =>
@fillAll(values)
@click @submitSelector()
class @Widget.List extends @Widget
itemSelector: 'li'
itemClass: World.Widget | at: (index) ->
@items().then (items) ->
items[index]
map: (iter) ->
@items().then (items) -> $.map(items, iter)
filter: (iter) ->
@items().then (items) -> $.filter(items, iter)
items: ->
@findAll(@itemSelector).then (items) =>
_.map items, (item, i) =>
se... | CoffeeScript | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | 7910326f39f4a7fc35757d8cd22a929255638771 | 523 | https://github.com/mojotech/pioneer/blob/7910326f39f4a7fc35757d8cd22a929255638771/src/support/Widget.coffee | 101 | 130 |
mojotech/pioneer:src/support/Widget.coffee:3:raw_corpus | raw_corpus | "[type='#{type}']"
class @Widget.Form extends @Widget.Fields
submitSelector: ->
@_type('submit')
submitWith: (values) =>
@fillAll(values)
@click @submitSelector()
class @Widget.List extends @Widget
itemSelector: 'li'
itemClass: World.Widget
map: (iter) ->
@items().th... | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | a571d736532744849c01011d25ce1fadbb5b27cf | 523 | https://github.com/mojotech/pioneer/blob/a571d736532744849c01011d25ce1fadbb5b27cf/src/support/Widget.coffee | 101 | 126 | ||
mojotech/pioneer:src/support/Widget.coffee:3:completion | completion | "[type='#{type}']"
class @Widget.Form extends @Widget.Fields
submitSelector: ->
@_type('submit')
submitWith: (values) =>
@fillAll(values)
@click @submitSelector()
class @Widget.List extends @Widget
itemSelector: 'li' | itemClass: World.Widget
map: (iter) ->
@items().then (items) -> $.map(items, iter)
filter: (iter) ->
@items().then (items) -> $.filter(items, iter)
items: ->
@findAll(@itemSelector).then (items) =>
_.map items, (item, i) =>
sel = "#{@root} #{@itemSelector}:nth-child(#{... | CoffeeScript | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | a571d736532744849c01011d25ce1fadbb5b27cf | 523 | https://github.com/mojotech/pioneer/blob/a571d736532744849c01011d25ce1fadbb5b27cf/src/support/Widget.coffee | 101 | 126 |
mojotech/pioneer:src/support/Widget.coffee:2:raw_corpus | raw_corpus | el.sendKeys(value)
read: (selector) ->
selected = @find(selector)
selected.getAttribute('value').then (value) ->
value or selected.getText()
find: (selector) ->
_selector = Driver.By.css(@_selector(selector))
_isPresent = =>
@driver.isElementPresent(_selector)
@... | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | 9ab7c02994a3d95c8d5f52e645b29a08186eb782 | 523 | https://github.com/mojotech/pioneer/blob/9ab7c02994a3d95c8d5f52e645b29a08186eb782/src/support/Widget.coffee | 51 | 100 | ||
mojotech/pioneer:src/support/Widget.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
el.sendKeys(value)
read: (selector) ->
selected = @find(selector)
selected.getAttribute('value').then (value) ->
value or selected.getText()
find: (selector) ->
_selector = Driver.By.css(@_selector(selector))
_isPresent ... | el.sendKeys(value)({
read: function(selector) {
var selected;
selected = this.find(selector);
return selected.getAttribute('value').then(function(value) {
return value || selected.getText();
});
},
find: function(selector) {
var _isPresent, _selector;
_selector = Driver.By.css(this._... | CoffeeScript | JavaScript | mojotech/pioneer | src/support/Widget.coffee | MIT | 9ab7c02994a3d95c8d5f52e645b29a08186eb782 | 523 | https://github.com/mojotech/pioneer/blob/9ab7c02994a3d95c8d5f52e645b29a08186eb782/src/support/Widget.coffee | 51 | 100 |
mojotech/pioneer:src/support/Widget.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
el.sendKeys(value)({
read: function(selector) {
var selected;
selected = this.find(selector);
return selected.getAttribute('value').then(function(value) {
return value || selected.getText();
});
},
find: function(selector) {
var _isP... | el.sendKeys(value)
read: (selector) ->
selected = @find(selector)
selected.getAttribute('value').then (value) ->
value or selected.getText()
find: (selector) ->
_selector = Driver.By.css(@_selector(selector))
_isPresent = =>
@driver.isElementPresent(_selector)
@... | JavaScript | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | 9ab7c02994a3d95c8d5f52e645b29a08186eb782 | 523 | https://github.com/mojotech/pioneer/blob/9ab7c02994a3d95c8d5f52e645b29a08186eb782/src/support/Widget.coffee | 51 | 100 |
mojotech/pioneer:src/support/Widget.coffee:2:completion | completion | el.sendKeys(value)
read: (selector) ->
selected = @find(selector)
selected.getAttribute('value').then (value) ->
value or selected.getText()
find: (selector) ->
_selector = Driver.By.css(@_selector(selector))
_isPresent = =>
@driver.isElementPresent(_selector)
@... | results = []
_reduce = (p, f, i) ->
p.then ->
callback(f, i).then (v) -> results.push(v)
_.reduce(collection, _reduce, Driver.promise.fulfilled())
.then -> results
class @Widget.Fields extends @Widget
fillAll: (values) ->
@_map @fields, (f) => @fill(@_name(f), values[f... | CoffeeScript | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | 9ab7c02994a3d95c8d5f52e645b29a08186eb782 | 523 | https://github.com/mojotech/pioneer/blob/9ab7c02994a3d95c8d5f52e645b29a08186eb782/src/support/Widget.coffee | 51 | 100 |
mojotech/pioneer:src/support/Widget.coffee:3:raw_corpus | raw_corpus | submitSelector: ->
@_type('submit')
submitWith: (values) =>
@fillAll(values)
@click @submitSelector()
class @Widget.List extends @Widget
itemSelector: 'li'
itemClass: World.Widget
items: ->
@findAll(@itemSelector).then (items) =>
_.map items, (item, i) =>
s... | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | 9ab7c02994a3d95c8d5f52e645b29a08186eb782 | 523 | https://github.com/mojotech/pioneer/blob/9ab7c02994a3d95c8d5f52e645b29a08186eb782/src/support/Widget.coffee | 101 | 116 | ||
mojotech/pioneer:src/support/Widget.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
submitSelector: ->
@_type('submit')
submitWith: (values) =>
@fillAll(values)
@click @submitSelector()
class @Widget.List extends @Widget
itemSelector: 'li'
itemClass: World.Widget
items: ->
@findAll(@itemSelector).then... | ({
submitSelector: function() {
return this._type('submit');
},
submitWith: (values) => {
this.fillAll(values);
return this.click(this.submitSelector());
}
});
this.Widget.List = (function() {
class List extends this.Widget {
items() {
return this.findAll(this.itemSelector).then((items)... | CoffeeScript | JavaScript | mojotech/pioneer | src/support/Widget.coffee | MIT | 9ab7c02994a3d95c8d5f52e645b29a08186eb782 | 523 | https://github.com/mojotech/pioneer/blob/9ab7c02994a3d95c8d5f52e645b29a08186eb782/src/support/Widget.coffee | 101 | 116 |
mojotech/pioneer:src/support/Widget.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
submitSelector: function() {
return this._type('submit');
},
submitWith: (values) => {
this.fillAll(values);
return this.click(this.submitSelector());
}
});
this.Widget.List = (function() {
class List extends this.Widget {
items() {
... | submitSelector: ->
@_type('submit')
submitWith: (values) =>
@fillAll(values)
@click @submitSelector()
class @Widget.List extends @Widget
itemSelector: 'li'
itemClass: World.Widget
items: ->
@findAll(@itemSelector).then (items) =>
_.map items, (item, i) =>
s... | JavaScript | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | 9ab7c02994a3d95c8d5f52e645b29a08186eb782 | 523 | https://github.com/mojotech/pioneer/blob/9ab7c02994a3d95c8d5f52e645b29a08186eb782/src/support/Widget.coffee | 101 | 116 |
mojotech/pioneer:src/support/Widget.coffee:3:completion | completion | submitSelector: ->
@_type('submit')
submitWith: (values) =>
@fillAll(values)
@click @submitSelector()
class @Widget.List extends @Widget | itemSelector: 'li'
itemClass: World.Widget
items: ->
@findAll(@itemSelector).then (items) =>
_.map items, (item, i) =>
sel = "#{@root} #{@itemSelector}:nth-child(#{i + 1})"
new @itemClass(root: sel) | CoffeeScript | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | 9ab7c02994a3d95c8d5f52e645b29a08186eb782 | 523 | https://github.com/mojotech/pioneer/blob/9ab7c02994a3d95c8d5f52e645b29a08186eb782/src/support/Widget.coffee | 101 | 116 |
mojotech/pioneer:src/support/Widget.coffee:1:raw_corpus | raw_corpus | module.exports = ->
World = @
@Widgets = {}
class @Widget
@extend: (protoProps, staticProps) ->
if Object.hasOwnProperty(protoProps, 'constructor')
child = protoProps.constructor
else
child = => @apply(@, arguments)
child.copyProperties @
child.copyProperties stat... | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | 1d336d42555a16da74acdf89591d212077010c9f | 523 | https://github.com/mojotech/pioneer/blob/1d336d42555a16da74acdf89591d212077010c9f/src/support/Widget.coffee | 1 | 50 | ||
mojotech/pioneer:src/support/Widget.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = ->
World = @
@Widgets = {}
class @Widget
@extend: (protoProps, staticProps) ->
if Object.hasOwnProperty(protoProps, 'constructor')
child = protoProps.constructor
else
child = => @apply(@, arguments)
... | module.exports = function() {
var World;
World = this;
this.Widgets = {};
return this.Widget = (function() {
class Widget {
static extend(protoProps, staticProps) {
var Surrogate, child;
if (Object.hasOwnProperty(protoProps, 'constructor')) {
child = protoProps.constructor;
... | CoffeeScript | JavaScript | mojotech/pioneer | src/support/Widget.coffee | MIT | 1d336d42555a16da74acdf89591d212077010c9f | 523 | https://github.com/mojotech/pioneer/blob/1d336d42555a16da74acdf89591d212077010c9f/src/support/Widget.coffee | 1 | 50 |
mojotech/pioneer:src/support/Widget.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
module.exports = function() {
var World;
World = this;
this.Widgets = {};
return this.Widget = (function() {
class Widget {
static extend(protoProps, staticProps) {
var Surrogate, child;
if (Object.hasOwnProperty(protoProps, 'const... | module.exports = ->
World = @
@Widgets = {}
class @Widget
@extend: (protoProps, staticProps) ->
if Object.hasOwnProperty(protoProps, 'constructor')
child = protoProps.constructor
else
child = => @apply(@, arguments)
child.copyProperties @
child.copyProperties stat... | JavaScript | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | 1d336d42555a16da74acdf89591d212077010c9f | 523 | https://github.com/mojotech/pioneer/blob/1d336d42555a16da74acdf89591d212077010c9f/src/support/Widget.coffee | 1 | 50 |
mojotech/pioneer:src/support/Widget.coffee:1:completion | completion | module.exports = ->
World = @
@Widgets = {}
class @Widget
@extend: (protoProps, staticProps) ->
if Object.hasOwnProperty(protoProps, 'constructor')
child = protoProps.constructor
else
child = => @apply(@, arguments)
child.copyProperties @
child.copyProperties stat... | child
constructor: (attributes = {}) ->
_.extend @, attributes
@initialize.apply @, arguments
# Defines a noop initialize method intended to be
# overridden by the user when extending a Widget base class
initialize: ->
world: World
# use a getter to lazily initialize driver
... | CoffeeScript | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | 1d336d42555a16da74acdf89591d212077010c9f | 523 | https://github.com/mojotech/pioneer/blob/1d336d42555a16da74acdf89591d212077010c9f/src/support/Widget.coffee | 1 | 50 |
mojotech/pioneer:src/support/Widget.coffee:1:raw_corpus | raw_corpus | module.exports = ->
World = @
@Widgets = {}
class @Widget
@extend: (protoProps, staticProps) ->
if Object.hasOwnProperty(protoProps, 'constructor')
child = protoProps.constructor
else
child = => @apply(@, arguments)
child.copyProperties @
child.copyProperties stat... | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | 93eb93b8129ca65f45c40845697bfa75094f36f6 | 523 | https://github.com/mojotech/pioneer/blob/93eb93b8129ca65f45c40845697bfa75094f36f6/src/support/Widget.coffee | 1 | 50 | ||
mojotech/pioneer:src/support/Widget.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = ->
World = @
@Widgets = {}
class @Widget
@extend: (protoProps, staticProps) ->
if Object.hasOwnProperty(protoProps, 'constructor')
child = protoProps.constructor
else
child = => @apply(@, arguments)
... | module.exports = function() {
var World;
World = this;
this.Widgets = {};
return this.Widget = (function() {
class Widget {
static extend(protoProps, staticProps) {
var Surrogate, child;
if (Object.hasOwnProperty(protoProps, 'constructor')) {
child = protoProps.constructor;
... | CoffeeScript | JavaScript | mojotech/pioneer | src/support/Widget.coffee | MIT | 93eb93b8129ca65f45c40845697bfa75094f36f6 | 523 | https://github.com/mojotech/pioneer/blob/93eb93b8129ca65f45c40845697bfa75094f36f6/src/support/Widget.coffee | 1 | 50 |
mojotech/pioneer:src/support/Widget.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
module.exports = function() {
var World;
World = this;
this.Widgets = {};
return this.Widget = (function() {
class Widget {
static extend(protoProps, staticProps) {
var Surrogate, child;
if (Object.hasOwnProperty(protoProps, 'const... | module.exports = ->
World = @
@Widgets = {}
class @Widget
@extend: (protoProps, staticProps) ->
if Object.hasOwnProperty(protoProps, 'constructor')
child = protoProps.constructor
else
child = => @apply(@, arguments)
child.copyProperties @
child.copyProperties stat... | JavaScript | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | 93eb93b8129ca65f45c40845697bfa75094f36f6 | 523 | https://github.com/mojotech/pioneer/blob/93eb93b8129ca65f45c40845697bfa75094f36f6/src/support/Widget.coffee | 1 | 50 |
mojotech/pioneer:src/support/Widget.coffee:1:completion | completion | module.exports = ->
World = @
@Widgets = {}
class @Widget
@extend: (protoProps, staticProps) ->
if Object.hasOwnProperty(protoProps, 'constructor')
child = protoProps.constructor
else
child = => @apply(@, arguments)
child.copyProperties @
child.copyProperties stat... | child
constructor: (attributes = {}) ->
_.extend @, attributes
world: World
# use a getter to lazily initialize driver
@getter 'driver', ->
@_driver || World.driver
click: (selector) ->
@find(selector).click()
fill: (selector, value) ->
el = @find(selector)
el... | CoffeeScript | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | 93eb93b8129ca65f45c40845697bfa75094f36f6 | 523 | https://github.com/mojotech/pioneer/blob/93eb93b8129ca65f45c40845697bfa75094f36f6/src/support/Widget.coffee | 1 | 50 |
mojotech/pioneer:src/support/Widget.coffee:2:raw_corpus | raw_corpus | find: (selector) ->
_selector = Driver.By.css(@_selector(selector))
_isPresent = =>
@driver.isElementPresent(_selector)
@driver.wait(_isPresent, 10000, "#{_selector} not found")
@driver.findElement(_selector)
isPresent: ->
@driver.isElementPresent(Driver.By.css(@root))
... | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | 93eb93b8129ca65f45c40845697bfa75094f36f6 | 523 | https://github.com/mojotech/pioneer/blob/93eb93b8129ca65f45c40845697bfa75094f36f6/src/support/Widget.coffee | 51 | 100 | ||
mojotech/pioneer:src/support/Widget.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
find: (selector) ->
_selector = Driver.By.css(@_selector(selector))
_isPresent = =>
@driver.isElementPresent(_selector)
@driver.wait(_isPresent, 10000, "#{_selector} not found")
@driver.findElement(_selector)
isPresent: ->
... | var ref,
boundMethodCheck = function(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new Error('Bound instance method accessed before binding'); } };
({
find: function(selector) {
var _isPresent, _selector;
_selector = Driver.By.css(this._selector(selector));
_isPresent = () =>... | CoffeeScript | JavaScript | mojotech/pioneer | src/support/Widget.coffee | MIT | 93eb93b8129ca65f45c40845697bfa75094f36f6 | 523 | https://github.com/mojotech/pioneer/blob/93eb93b8129ca65f45c40845697bfa75094f36f6/src/support/Widget.coffee | 51 | 100 |
mojotech/pioneer:src/support/Widget.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var ref,
boundMethodCheck = function(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new Error('Bound instance method accessed before binding'); } };
({
find: function(selector) {
var _isPresent, _selector;
_selector = Driver.B... | find: (selector) ->
_selector = Driver.By.css(@_selector(selector))
_isPresent = =>
@driver.isElementPresent(_selector)
@driver.wait(_isPresent, 10000, "#{_selector} not found")
@driver.findElement(_selector)
isPresent: ->
@driver.isElementPresent(Driver.By.css(@root))
... | JavaScript | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | 93eb93b8129ca65f45c40845697bfa75094f36f6 | 523 | https://github.com/mojotech/pioneer/blob/93eb93b8129ca65f45c40845697bfa75094f36f6/src/support/Widget.coffee | 51 | 100 |
mojotech/pioneer:src/support/Widget.coffee:2:completion | completion | find: (selector) ->
_selector = Driver.By.css(@_selector(selector))
_isPresent = =>
@driver.isElementPresent(_selector)
@driver.wait(_isPresent, 10000, "#{_selector} not found")
@driver.findElement(_selector)
isPresent: ->
@driver.isElementPresent(Driver.By.css(@root))
... | class @Widget.Fields extends @Widget
fillAll: (values) ->
@_map @fields, (f) => @fill(@_name(f), values[f])
readAll: ->
_readAll = (f) =>
@read(@_name(f)).then (v) -> [f, v]
@_map(@fields, _readAll).then (read) ->
_.object(read)
_name: (name) ->
"[name='#{name}']"
... | CoffeeScript | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | 93eb93b8129ca65f45c40845697bfa75094f36f6 | 523 | https://github.com/mojotech/pioneer/blob/93eb93b8129ca65f45c40845697bfa75094f36f6/src/support/Widget.coffee | 51 | 100 |
mojotech/pioneer:src/support/Widget.coffee:3:raw_corpus | raw_corpus | class @Widget.List extends @Widget
itemSelector: 'li'
itemClass: World.Widget
items: ->
@findAll(@itemSelector).then (items) =>
_.map items, (item, i) =>
sel = "#{@root} #{@itemSelector}:nth-child(#{i + 1})"
new @itemClass(root: sel) | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | 93eb93b8129ca65f45c40845697bfa75094f36f6 | 523 | https://github.com/mojotech/pioneer/blob/93eb93b8129ca65f45c40845697bfa75094f36f6/src/support/Widget.coffee | 101 | 110 | ||
mojotech/pioneer:src/support/Widget.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class @Widget.List extends @Widget
itemSelector: 'li'
itemClass: World.Widget
items: ->
@findAll(@itemSelector).then (items) =>
_.map items, (item, i) =>
sel = "#{@root} #{@itemSelector}:nth-child(#{i + 1})"
new @ite... | this.Widget.List = (function() {
class List extends this.Widget {
items() {
return this.findAll(this.itemSelector).then((items) => {
return _.map(items, (item, i) => {
var sel;
sel = `${this.root} ${this.itemSelector}:nth-child(${i + 1})`;
return new this.itemClass({
... | CoffeeScript | JavaScript | mojotech/pioneer | src/support/Widget.coffee | MIT | 93eb93b8129ca65f45c40845697bfa75094f36f6 | 523 | https://github.com/mojotech/pioneer/blob/93eb93b8129ca65f45c40845697bfa75094f36f6/src/support/Widget.coffee | 101 | 110 |
mojotech/pioneer:src/support/Widget.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
this.Widget.List = (function() {
class List extends this.Widget {
items() {
return this.findAll(this.itemSelector).then((items) => {
return _.map(items, (item, i) => {
var sel;
sel = `${this.root} ${this.itemSelector}:nth-chi... | class @Widget.List extends @Widget
itemSelector: 'li'
itemClass: World.Widget
items: ->
@findAll(@itemSelector).then (items) =>
_.map items, (item, i) =>
sel = "#{@root} #{@itemSelector}:nth-child(#{i + 1})"
new @itemClass(root: sel) | JavaScript | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | 93eb93b8129ca65f45c40845697bfa75094f36f6 | 523 | https://github.com/mojotech/pioneer/blob/93eb93b8129ca65f45c40845697bfa75094f36f6/src/support/Widget.coffee | 101 | 110 |
mojotech/pioneer:src/support/Widget.coffee:3:completion | completion | class @Widget.List extends @Widget
itemSelector: 'li'
itemClass: World.Widget | items: ->
@findAll(@itemSelector).then (items) =>
_.map items, (item, i) =>
sel = "#{@root} #{@itemSelector}:nth-child(#{i + 1})"
new @itemClass(root: sel) | CoffeeScript | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | 93eb93b8129ca65f45c40845697bfa75094f36f6 | 523 | https://github.com/mojotech/pioneer/blob/93eb93b8129ca65f45c40845697bfa75094f36f6/src/support/Widget.coffee | 101 | 110 |
mojotech/pioneer:src/support/Widget.coffee:1:raw_corpus | raw_corpus | module.exports = ->
World = @
@Widgets = {}
class @Widget
@extend: (protoProps, staticProps) ->
if Object.hasOwnProperty(protoProps, 'constructor')
child = protoProps.constructor
else
child = => @apply(@, arguments)
child.copyProperties @
child.copyProperties stat... | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | 933627efb01af6f175330ca5b05cb068854954d0 | 523 | https://github.com/mojotech/pioneer/blob/933627efb01af6f175330ca5b05cb068854954d0/src/support/Widget.coffee | 1 | 50 | ||
mojotech/pioneer:src/support/Widget.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = ->
World = @
@Widgets = {}
class @Widget
@extend: (protoProps, staticProps) ->
if Object.hasOwnProperty(protoProps, 'constructor')
child = protoProps.constructor
else
child = => @apply(@, arguments)
... | module.exports = function() {
var World;
World = this;
this.Widgets = {};
return this.Widget = (function() {
class Widget {
static extend(protoProps, staticProps) {
var Surrogate, child;
if (Object.hasOwnProperty(protoProps, 'constructor')) {
child = protoProps.constructor;
... | CoffeeScript | JavaScript | mojotech/pioneer | src/support/Widget.coffee | MIT | 933627efb01af6f175330ca5b05cb068854954d0 | 523 | https://github.com/mojotech/pioneer/blob/933627efb01af6f175330ca5b05cb068854954d0/src/support/Widget.coffee | 1 | 50 |
mojotech/pioneer:src/support/Widget.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
module.exports = function() {
var World;
World = this;
this.Widgets = {};
return this.Widget = (function() {
class Widget {
static extend(protoProps, staticProps) {
var Surrogate, child;
if (Object.hasOwnProperty(protoProps, 'const... | module.exports = ->
World = @
@Widgets = {}
class @Widget
@extend: (protoProps, staticProps) ->
if Object.hasOwnProperty(protoProps, 'constructor')
child = protoProps.constructor
else
child = => @apply(@, arguments)
child.copyProperties @
child.copyProperties stat... | JavaScript | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | 933627efb01af6f175330ca5b05cb068854954d0 | 523 | https://github.com/mojotech/pioneer/blob/933627efb01af6f175330ca5b05cb068854954d0/src/support/Widget.coffee | 1 | 50 |
mojotech/pioneer:src/support/Widget.coffee:1:completion | completion | module.exports = ->
World = @
@Widgets = {}
class @Widget
@extend: (protoProps, staticProps) ->
if Object.hasOwnProperty(protoProps, 'constructor')
child = protoProps.constructor
else
child = => @apply(@, arguments)
child.copyProperties @
child.copyProperties stat... | child
constructor: (attributes = {}) ->
_.extend @, attributes
world: World
# use a getter to lazily initialize driver
@getter 'driver', ->
@_driver || World.driver
click: (selector) ->
@find(selector).click()
fill: (selector, value) ->
@find(selector).sendKeys(valu... | CoffeeScript | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | 933627efb01af6f175330ca5b05cb068854954d0 | 523 | https://github.com/mojotech/pioneer/blob/933627efb01af6f175330ca5b05cb068854954d0/src/support/Widget.coffee | 1 | 50 |
mojotech/pioneer:src/support/Widget.coffee:2:raw_corpus | raw_corpus | _selector = Driver.By.css(@_selector(selector))
_isPresent = =>
@driver.isElementPresent(_selector)
@driver.wait(_isPresent, 10000, "#{_selector} not found")
@driver.findElement(_selector)
isPresent: ->
@driver.isElementPresent(Driver.By.css(@root))
findAll: (selector) ->
... | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | 933627efb01af6f175330ca5b05cb068854954d0 | 523 | https://github.com/mojotech/pioneer/blob/933627efb01af6f175330ca5b05cb068854954d0/src/support/Widget.coffee | 51 | 100 | ||
mojotech/pioneer:src/support/Widget.coffee:2:completion | completion | _selector = Driver.By.css(@_selector(selector))
_isPresent = =>
@driver.isElementPresent(_selector)
@driver.wait(_isPresent, 10000, "#{_selector} not found")
@driver.findElement(_selector)
isPresent: ->
@driver.isElementPresent(Driver.By.css(@root))
findAll: (selector) ->
... | fillAll: (values) ->
@_map @fields, (f) => @fill(@_name(f), values[f])
readAll: ->
_readAll = (f) =>
@read(@_name(f)).then (v) -> [f, v]
@_map(@fields, _readAll).then (read) ->
_.object(read)
_name: (name) ->
"[name='#{name}']"
_type: (type) ->
"[type='#{typ... | CoffeeScript | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | 933627efb01af6f175330ca5b05cb068854954d0 | 523 | https://github.com/mojotech/pioneer/blob/933627efb01af6f175330ca5b05cb068854954d0/src/support/Widget.coffee | 51 | 100 |
mojotech/pioneer:src/support/Widget.coffee:3:raw_corpus | raw_corpus | itemSelector: 'li'
itemClass: World.Widget
items: ->
@findAll(@itemSelector).then (items) =>
_.map items, (item, i) =>
sel = "#{@root} #{@itemSelector}:nth-child(#{i + 1})"
new @itemClass(root: sel) | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | 933627efb01af6f175330ca5b05cb068854954d0 | 523 | https://github.com/mojotech/pioneer/blob/933627efb01af6f175330ca5b05cb068854954d0/src/support/Widget.coffee | 101 | 108 | ||
mojotech/pioneer:src/support/Widget.coffee:3:completion | completion | itemSelector: 'li'
itemClass: World.Widget
items: -> | @findAll(@itemSelector).then (items) =>
_.map items, (item, i) =>
sel = "#{@root} #{@itemSelector}:nth-child(#{i + 1})"
new @itemClass(root: sel) | CoffeeScript | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | 933627efb01af6f175330ca5b05cb068854954d0 | 523 | https://github.com/mojotech/pioneer/blob/933627efb01af6f175330ca5b05cb068854954d0/src/support/Widget.coffee | 101 | 108 |
mojotech/pioneer:src/support/Widget.coffee:1:raw_corpus | raw_corpus | module.exports = ->
World = @
@Widgets = {}
class @Widget
constructor: (attributes = {}) ->
_.extend @, attributes
world: World
# use a getter to lazily initialize driver
@getter 'driver', ->
@_driver || World.driver
click: (selector) ->
@find(selector).click()
f... | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | e9fdc7a7ba2009bbc9b1ac7e53b8659124d901f9 | 523 | https://github.com/mojotech/pioneer/blob/e9fdc7a7ba2009bbc9b1ac7e53b8659124d901f9/src/support/Widget.coffee | 1 | 50 | ||
mojotech/pioneer:src/support/Widget.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = ->
World = @
@Widgets = {}
class @Widget
constructor: (attributes = {}) ->
_.extend @, attributes
world: World
# use a getter to lazily initialize driver
@getter 'driver', ->
@_driver || World.driver
... | module.exports = function() {
var World;
World = this;
this.Widgets = {};
return this.Widget = (function() {
class Widget {
constructor(attributes = {}) {
_.extend(this, attributes);
}
click(selector) {
return this.find(selector).click();
}
fill(selector, valu... | CoffeeScript | JavaScript | mojotech/pioneer | src/support/Widget.coffee | MIT | e9fdc7a7ba2009bbc9b1ac7e53b8659124d901f9 | 523 | https://github.com/mojotech/pioneer/blob/e9fdc7a7ba2009bbc9b1ac7e53b8659124d901f9/src/support/Widget.coffee | 1 | 50 |
mojotech/pioneer:src/support/Widget.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
module.exports = function() {
var World;
World = this;
this.Widgets = {};
return this.Widget = (function() {
class Widget {
constructor(attributes = {}) {
_.extend(this, attributes);
}
click(selector) {
return this.fin... | module.exports = ->
World = @
@Widgets = {}
class @Widget
constructor: (attributes = {}) ->
_.extend @, attributes
world: World
# use a getter to lazily initialize driver
@getter 'driver', ->
@_driver || World.driver
click: (selector) ->
@find(selector).click()
f... | JavaScript | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | e9fdc7a7ba2009bbc9b1ac7e53b8659124d901f9 | 523 | https://github.com/mojotech/pioneer/blob/e9fdc7a7ba2009bbc9b1ac7e53b8659124d901f9/src/support/Widget.coffee | 1 | 50 |
mojotech/pioneer:src/support/Widget.coffee:1:completion | completion | module.exports = ->
World = @
@Widgets = {}
class @Widget
constructor: (attributes = {}) ->
_.extend @, attributes
world: World
# use a getter to lazily initialize driver
@getter 'driver', ->
@_driver || World.driver
click: (selector) ->
@find(selector).click()
f... | find: (selector) ->
_selector = Driver.By.css(@_selector(selector))
_isPresent = =>
@driver.isElementPresent(_selector)
@driver.wait(_isPresent, 10000, "#{_selector} not found")
@driver.findElement(_selector)
isPresent: ->
@driver.isElementPresent(Driver.By.css(@root))
... | CoffeeScript | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | e9fdc7a7ba2009bbc9b1ac7e53b8659124d901f9 | 523 | https://github.com/mojotech/pioneer/blob/e9fdc7a7ba2009bbc9b1ac7e53b8659124d901f9/src/support/Widget.coffee | 1 | 50 |
mojotech/pioneer:src/support/Widget.coffee:2:raw_corpus | raw_corpus | class @Widget.Fields extends @Widget
fillAll: (values) ->
@_map @fields, (f) => @fill(@_name(f), values[f])
readAll: ->
_readAll = (f) =>
@read(@_name(f)).then (v) -> [f, v]
@_map(@fields, _readAll).then (read) ->
_.object(read)
_name: (name) ->
"[name='#{name}']"
... | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | e9fdc7a7ba2009bbc9b1ac7e53b8659124d901f9 | 523 | https://github.com/mojotech/pioneer/blob/e9fdc7a7ba2009bbc9b1ac7e53b8659124d901f9/src/support/Widget.coffee | 51 | 85 | ||
mojotech/pioneer:src/support/Widget.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class @Widget.Fields extends @Widget
fillAll: (values) ->
@_map @fields, (f) => @fill(@_name(f), values[f])
readAll: ->
_readAll = (f) =>
@read(@_name(f)).then (v) -> [f, v]
@_map(@fields, _readAll).then (read) ->
_.obj... | var ref,
boundMethodCheck = function(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new Error('Bound instance method accessed before binding'); } };
this.Widget.Fields = class Fields extends this.Widget {
fillAll(values) {
return this._map(this.fields, (f) => {
return this.fill(... | CoffeeScript | JavaScript | mojotech/pioneer | src/support/Widget.coffee | MIT | e9fdc7a7ba2009bbc9b1ac7e53b8659124d901f9 | 523 | https://github.com/mojotech/pioneer/blob/e9fdc7a7ba2009bbc9b1ac7e53b8659124d901f9/src/support/Widget.coffee | 51 | 85 |
mojotech/pioneer:src/support/Widget.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var ref,
boundMethodCheck = function(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new Error('Bound instance method accessed before binding'); } };
this.Widget.Fields = class Fields extends this.Widget {
fillAll(values) {
return ... | class @Widget.Fields extends @Widget
fillAll: (values) ->
@_map @fields, (f) => @fill(@_name(f), values[f])
readAll: ->
_readAll = (f) =>
@read(@_name(f)).then (v) -> [f, v]
@_map(@fields, _readAll).then (read) ->
_.object(read)
_name: (name) ->
"[name='#{name}']"
... | JavaScript | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | e9fdc7a7ba2009bbc9b1ac7e53b8659124d901f9 | 523 | https://github.com/mojotech/pioneer/blob/e9fdc7a7ba2009bbc9b1ac7e53b8659124d901f9/src/support/Widget.coffee | 51 | 85 |
mojotech/pioneer:src/support/Widget.coffee:2:completion | completion | class @Widget.Fields extends @Widget
fillAll: (values) ->
@_map @fields, (f) => @fill(@_name(f), values[f])
readAll: ->
_readAll = (f) =>
@read(@_name(f)).then (v) -> [f, v]
@_map(@fields, _readAll).then (read) ->
_.object(read)
_name: (name) ->
"[name='#{name}']"
... | class @Widget.Form extends @Widget.Fields
submitSelector: ->
@_type('submit')
submitWith: (values) =>
@fillAll(values)
@click @submitSelector()
class @Widget.List extends @Widget
itemSelector: 'li'
itemClass: World.Widget
items: ->
@findAll(@itemSelector).then (items) =>... | CoffeeScript | CoffeeScript | mojotech/pioneer | src/support/Widget.coffee | MIT | e9fdc7a7ba2009bbc9b1ac7e53b8659124d901f9 | 523 | https://github.com/mojotech/pioneer/blob/e9fdc7a7ba2009bbc9b1ac7e53b8659124d901f9/src/support/Widget.coffee | 51 | 85 |
octoblu/meshblu:src/models/authenticator.coffee:1:raw_corpus | raw_corpus | _ = require 'lodash'
uuid = require 'uuid'
async = require 'async'
JobManager = require 'meshblu-core-job-manager'
class AuthenticatorError extends Error
name: 'AuthenticatorError'
constructor: (@code, @status) ->
@message = "#{@code}: #{@status}"
class Authenticator
constructor: (options={}, dependencies={... | CoffeeScript | octoblu/meshblu | src/models/authenticator.coffee | MIT | 12672e10627e690e2e56bba865f71c38b8a90f25 | 815 | https://github.com/octoblu/meshblu/blob/12672e10627e690e2e56bba865f71c38b8a90f25/src/models/authenticator.coffee | 1 | 50 | ||
octoblu/meshblu:src/models/authenticator.coffee:1:completion | completion | _ = require 'lodash'
uuid = require 'uuid'
async = require 'async'
JobManager = require 'meshblu-core-job-manager'
class AuthenticatorError extends Error
name: 'AuthenticatorError'
constructor: (@code, @status) ->
@message = "#{@code}: #{@status}"
class Authenticator
constructor: (options={}, dependencies={... | authenticate: (id, token, callback) ->
responseId = @uuid.v1()
metadata =
auth:
uuid: id
token: token
jobType: 'authenticate'
responseId: responseId
options =
responseId: responseId
metadata: metadata
@jobManager.createRequest options, (error) =>
r... | CoffeeScript | CoffeeScript | octoblu/meshblu | src/models/authenticator.coffee | MIT | 12672e10627e690e2e56bba865f71c38b8a90f25 | 815 | https://github.com/octoblu/meshblu/blob/12672e10627e690e2e56bba865f71c38b8a90f25/src/models/authenticator.coffee | 1 | 50 |
octoblu/meshblu:src/models/authenticator.coffee:2:raw_corpus | raw_corpus | data = JSON.parse rawData
return callback new AuthenticatorError(metadata.code, metadata.status) if metadata.code > 299
callback null, data.authenticated
module.exports = Authenticator | CoffeeScript | octoblu/meshblu | src/models/authenticator.coffee | MIT | 12672e10627e690e2e56bba865f71c38b8a90f25 | 815 | https://github.com/octoblu/meshblu/blob/12672e10627e690e2e56bba865f71c38b8a90f25/src/models/authenticator.coffee | 51 | 57 | ||
octoblu/meshblu:src/models/authenticator.coffee:2:completion | completion | data = JSON.parse rawData
return callback new AuthenticatorError(metadata.code, metadata.status) if metadata.code > 299 | callback null, data.authenticated
module.exports = Authenticator | CoffeeScript | CoffeeScript | octoblu/meshblu | src/models/authenticator.coffee | MIT | 12672e10627e690e2e56bba865f71c38b8a90f25 | 815 | https://github.com/octoblu/meshblu/blob/12672e10627e690e2e56bba865f71c38b8a90f25/src/models/authenticator.coffee | 51 | 57 |
jashkenas/coffeescript:test/repl.coffee:1:raw_corpus | raw_corpus | class MockInputStream extends Stream
constructor: ->
super()
@readable = true
resume: ->
emitLine: (val) ->
@emit 'data', Buffer.from("#{val}\n") | CoffeeScript | jashkenas/coffeescript | test/repl.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/test/repl.coffee | 11 | 19 | ||
jashkenas/coffeescript:test/repl.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class MockInputStream extends Stream
constructor: ->
super()
@readable = true
resume: ->
emitLine: (val) ->
@emit 'data', Buffer.from("#{val}\n")
``` | var MockInputStream;
MockInputStream = class MockInputStream extends Stream {
constructor() {
super();
this.readable = true;
}
resume() {}
emitLine(val) {
return this.emit('data', Buffer.from(`${val}\n`));
}
}; | CoffeeScript | JavaScript | jashkenas/coffeescript | test/repl.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/test/repl.coffee | 11 | 19 |
jashkenas/coffeescript:test/repl.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var MockInputStream;
MockInputStream = class MockInputStream extends Stream {
constructor() {
super();
this.readable = true;
}
resume() {}
emitLine(val) {
return this.emit('data', Buffer.from(`${val}\n`));
}
};
``` | class MockInputStream extends Stream
constructor: ->
super()
@readable = true
resume: ->
emitLine: (val) ->
@emit 'data', Buffer.from("#{val}\n") | JavaScript | CoffeeScript | jashkenas/coffeescript | test/repl.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/test/repl.coffee | 11 | 19 |
jashkenas/coffeescript:test/repl.coffee:1:completion | completion | class MockInputStream extends Stream
constructor: ->
super()
@readable = true | resume: ->
emitLine: (val) ->
@emit 'data', Buffer.from("#{val}\n") | CoffeeScript | CoffeeScript | jashkenas/coffeescript | test/repl.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/test/repl.coffee | 11 | 19 |
jashkenas/coffeescript:test/repl.coffee:2:raw_corpus | raw_corpus | class MockOutputStream extends Stream
constructor: ->
super()
@writable = true
@written = []
write: (data) ->
# console.log 'output write', arguments
@written.push data
lastWrite: (fromEnd = -1) ->
@written[@written.length - 1 + fromEnd].replace /\r?\n$/, ''
# Create a dummy history fil... | CoffeeScript | jashkenas/coffeescript | test/repl.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/test/repl.coffee | 21 | 36 | ||
jashkenas/coffeescript:test/repl.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class MockOutputStream extends Stream
constructor: ->
super()
@writable = true
@written = []
write: (data) ->
# console.log 'output write', arguments
@written.push data
lastWrite: (fromEnd = -1) ->
@written[@written.length - 1 + fr... | var MockOutputStream, historyFile;
MockOutputStream = class MockOutputStream extends Stream {
constructor() {
super();
this.writable = true;
this.written = [];
}
write(data) {
// console.log 'output write', arguments
return this.written.push(data);
}
lastWrite(fromEnd = -1) {
return... | CoffeeScript | JavaScript | jashkenas/coffeescript | test/repl.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/test/repl.coffee | 21 | 36 |
jashkenas/coffeescript:test/repl.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var MockOutputStream, historyFile;
MockOutputStream = class MockOutputStream extends Stream {
constructor() {
super();
this.writable = true;
this.written = [];
}
write(data) {
// console.log 'output write', arguments
return this.written.... | class MockOutputStream extends Stream
constructor: ->
super()
@writable = true
@written = []
write: (data) ->
# console.log 'output write', arguments
@written.push data
lastWrite: (fromEnd = -1) ->
@written[@written.length - 1 + fromEnd].replace /\r?\n$/, ''
# Create a dummy history fil... | JavaScript | CoffeeScript | jashkenas/coffeescript | test/repl.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/test/repl.coffee | 21 | 36 |
jashkenas/coffeescript:test/repl.coffee:2:completion | completion | class MockOutputStream extends Stream
constructor: ->
super()
@writable = true
@written = []
write: (data) ->
# console.log 'output write', arguments | @written.push data
lastWrite: (fromEnd = -1) ->
@written[@written.length - 1 + fromEnd].replace /\r?\n$/, ''
# Create a dummy history file
historyFile = path.join os.tmpdir(), '.coffee_history_test'
fs.writeFileSync historyFile, '1 + 2\n' | CoffeeScript | CoffeeScript | jashkenas/coffeescript | test/repl.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/test/repl.coffee | 21 | 36 |
jashkenas/coffeescript:test/repl.coffee:3:raw_corpus | raw_corpus | testRepl = (desc, fn) ->
input = new MockInputStream
output = new MockOutputStream
repl = Repl.start {input, output, historyFile}
test desc, -> fn input, output, repl
ctrlV = { ctrl: true, name: 'v'}
testRepl 'reads history file', (input, output, repl) ->
input.emitLine repl.history[0]
eq '3', output.las... | CoffeeScript | jashkenas/coffeescript | test/repl.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/test/repl.coffee | 38 | 87 | ||
jashkenas/coffeescript:test/repl.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
testRepl = (desc, fn) ->
input = new MockInputStream
output = new MockOutputStream
repl = Repl.start {input, output, historyFile}
test desc, -> fn input, output, repl
ctrlV = { ctrl: true, name: 'v'}
testRepl 'reads history file', (input, output, repl)... | var ctrlV, testRepl;
testRepl = function(desc, fn) {
var input, output, repl;
input = new MockInputStream();
output = new MockOutputStream();
repl = Repl.start({input, output, historyFile});
return test(desc, function() {
return fn(input, output, repl);
});
};
ctrlV = {
ctrl: true,
name: 'v'
};
t... | CoffeeScript | JavaScript | jashkenas/coffeescript | test/repl.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/test/repl.coffee | 38 | 87 |
jashkenas/coffeescript:test/repl.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var ctrlV, testRepl;
testRepl = function(desc, fn) {
var input, output, repl;
input = new MockInputStream();
output = new MockOutputStream();
repl = Repl.start({input, output, historyFile});
return test(desc, function() {
return fn(input, output, rep... | testRepl = (desc, fn) ->
input = new MockInputStream
output = new MockOutputStream
repl = Repl.start {input, output, historyFile}
test desc, -> fn input, output, repl
ctrlV = { ctrl: true, name: 'v'}
testRepl 'reads history file', (input, output, repl) ->
input.emitLine repl.history[0]
eq '3', output.las... | JavaScript | CoffeeScript | jashkenas/coffeescript | test/repl.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/test/repl.coffee | 38 | 87 |
jashkenas/coffeescript:test/repl.coffee:3:completion | completion | testRepl = (desc, fn) ->
input = new MockInputStream
output = new MockOutputStream
repl = Repl.start {input, output, historyFile}
test desc, -> fn input, output, repl
ctrlV = { ctrl: true, name: 'v'}
testRepl 'reads history file', (input, output, repl) ->
input.emitLine repl.history[0]
eq '3', output.las... | testRepl "output in inspect mode", (input, output) ->
input.emitLine '"1 + 1\\n"'
eq "'1 + 1\\n'", output.lastWrite()
testRepl "variables are saved", (input, output) ->
input.emitLine "foo = 'foo'"
input.emitLine 'foobar = "#{foo}bar"'
eq "'foobar'", output.lastWrite()
testRepl "empty command evaluates to u... | CoffeeScript | CoffeeScript | jashkenas/coffeescript | test/repl.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/test/repl.coffee | 38 | 87 |
jashkenas/coffeescript:test/repl.coffee:4:raw_corpus | raw_corpus | testRepl "ctrl-v toggles multiline prompt", (input, output) ->
input.emit 'keypress', null, ctrlV
eq '------> ', output.lastWrite(0)
input.emit 'keypress', null, ctrlV
eq 'coffee> ', output.lastWrite(0)
testRepl "multiline continuation changes prompt", (input, output) ->
input.emit 'keypress', null, ctrlV
... | CoffeeScript | jashkenas/coffeescript | test/repl.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/test/repl.coffee | 88 | 137 | ||
jashkenas/coffeescript:test/repl.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
testRepl "ctrl-v toggles multiline prompt", (input, output) ->
input.emit 'keypress', null, ctrlV
eq '------> ', output.lastWrite(0)
input.emit 'keypress', null, ctrlV
eq 'coffee> ', output.lastWrite(0)
testRepl "multiline continuation changes prompt", (... | testRepl("ctrl-v toggles multiline prompt", function(input, output) {
input.emit('keypress', null, ctrlV);
eq('------> ', output.lastWrite(0));
input.emit('keypress', null, ctrlV);
return eq('coffee> ', output.lastWrite(0));
});
testRepl("multiline continuation changes prompt", function(input, output) {
inpu... | CoffeeScript | JavaScript | jashkenas/coffeescript | test/repl.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/test/repl.coffee | 88 | 137 |
jashkenas/coffeescript:test/repl.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
testRepl("ctrl-v toggles multiline prompt", function(input, output) {
input.emit('keypress', null, ctrlV);
eq('------> ', output.lastWrite(0));
input.emit('keypress', null, ctrlV);
return eq('coffee> ', output.lastWrite(0));
});
testRepl("multiline continu... | testRepl "ctrl-v toggles multiline prompt", (input, output) ->
input.emit 'keypress', null, ctrlV
eq '------> ', output.lastWrite(0)
input.emit 'keypress', null, ctrlV
eq 'coffee> ', output.lastWrite(0)
testRepl "multiline continuation changes prompt", (input, output) ->
input.emit 'keypress', null, ctrlV
... | JavaScript | CoffeeScript | jashkenas/coffeescript | test/repl.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/test/repl.coffee | 88 | 137 |
jashkenas/coffeescript:test/repl.coffee:4:completion | completion | testRepl "ctrl-v toggles multiline prompt", (input, output) ->
input.emit 'keypress', null, ctrlV
eq '------> ', output.lastWrite(0)
input.emit 'keypress', null, ctrlV
eq 'coffee> ', output.lastWrite(0)
testRepl "multiline continuation changes prompt", (input, output) ->
input.emit 'keypress', null, ctrlV
... | input.emitLine 'a'
eq '2', output.lastWrite()
testRepl "existential assignment of previously declared variable", (input, output) ->
input.emitLine 'a = null'
input.emitLine 'a ?= 42'
eq '42', output.lastWrite()
testRepl "keeps running after runtime error", (input, output) ->
input.emitLine 'a = b'
input.e... | CoffeeScript | CoffeeScript | jashkenas/coffeescript | test/repl.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/test/repl.coffee | 88 | 137 |
jashkenas/coffeescript:test/repl.coffee:3:raw_corpus | raw_corpus | testRepl = (desc, fn) ->
input = new MockInputStream
output = new MockOutputStream
repl = Repl.start {input, output, historyFile}
test desc, -> fn input, output, repl
ctrlV = { ctrl: true, name: 'v'}
testRepl 'reads history file', (input, output, repl) ->
input.emitLine repl.rli.history[0]
eq '3', output... | CoffeeScript | jashkenas/coffeescript | test/repl.coffee | MIT | 5a43b2d7c560934f2f4b069ecf31eb21429e477a | 16,577 | https://github.com/jashkenas/coffeescript/blob/5a43b2d7c560934f2f4b069ecf31eb21429e477a/test/repl.coffee | 38 | 87 | ||
jashkenas/coffeescript:test/repl.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
testRepl = (desc, fn) ->
input = new MockInputStream
output = new MockOutputStream
repl = Repl.start {input, output, historyFile}
test desc, -> fn input, output, repl
ctrlV = { ctrl: true, name: 'v'}
testRepl 'reads history file', (input, output, repl)... | var ctrlV, testRepl;
testRepl = function(desc, fn) {
var input, output, repl;
input = new MockInputStream();
output = new MockOutputStream();
repl = Repl.start({input, output, historyFile});
return test(desc, function() {
return fn(input, output, repl);
});
};
ctrlV = {
ctrl: true,
name: 'v'
};
t... | CoffeeScript | JavaScript | jashkenas/coffeescript | test/repl.coffee | MIT | 5a43b2d7c560934f2f4b069ecf31eb21429e477a | 16,577 | https://github.com/jashkenas/coffeescript/blob/5a43b2d7c560934f2f4b069ecf31eb21429e477a/test/repl.coffee | 38 | 87 |
jashkenas/coffeescript:test/repl.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var ctrlV, testRepl;
testRepl = function(desc, fn) {
var input, output, repl;
input = new MockInputStream();
output = new MockOutputStream();
repl = Repl.start({input, output, historyFile});
return test(desc, function() {
return fn(input, output, rep... | testRepl = (desc, fn) ->
input = new MockInputStream
output = new MockOutputStream
repl = Repl.start {input, output, historyFile}
test desc, -> fn input, output, repl
ctrlV = { ctrl: true, name: 'v'}
testRepl 'reads history file', (input, output, repl) ->
input.emitLine repl.rli.history[0]
eq '3', output... | JavaScript | CoffeeScript | jashkenas/coffeescript | test/repl.coffee | MIT | 5a43b2d7c560934f2f4b069ecf31eb21429e477a | 16,577 | https://github.com/jashkenas/coffeescript/blob/5a43b2d7c560934f2f4b069ecf31eb21429e477a/test/repl.coffee | 38 | 87 |
jashkenas/coffeescript:test/repl.coffee:3:completion | completion | testRepl = (desc, fn) ->
input = new MockInputStream
output = new MockOutputStream
repl = Repl.start {input, output, historyFile}
test desc, -> fn input, output, repl
ctrlV = { ctrl: true, name: 'v'}
testRepl 'reads history file', (input, output, repl) ->
input.emitLine repl.rli.history[0]
eq '3', output... | testRepl "output in inspect mode", (input, output) ->
input.emitLine '"1 + 1\\n"'
eq "'1 + 1\\n'", output.lastWrite()
testRepl "variables are saved", (input, output) ->
input.emitLine "foo = 'foo'"
input.emitLine 'foobar = "#{foo}bar"'
eq "'foobar'", output.lastWrite()
testRepl "empty command evaluates to u... | CoffeeScript | CoffeeScript | jashkenas/coffeescript | test/repl.coffee | MIT | 5a43b2d7c560934f2f4b069ecf31eb21429e477a | 16,577 | https://github.com/jashkenas/coffeescript/blob/5a43b2d7c560934f2f4b069ecf31eb21429e477a/test/repl.coffee | 38 | 87 |
jashkenas/coffeescript:test/repl.coffee:4:raw_corpus | raw_corpus | testRepl "ctrl-v toggles multiline prompt", (input, output) ->
input.emit 'keypress', null, ctrlV
eq '------> ', output.lastWrite(0)
input.emit 'keypress', null, ctrlV
eq 'coffee> ', output.lastWrite(0)
testRepl "multiline continuation changes prompt", (input, output) ->
input.emit 'keypress', null, ctrlV
... | CoffeeScript | jashkenas/coffeescript | test/repl.coffee | MIT | 3f4b03bcff3e80ea5ed838c67e81fda106d83f21 | 16,577 | https://github.com/jashkenas/coffeescript/blob/3f4b03bcff3e80ea5ed838c67e81fda106d83f21/test/repl.coffee | 88 | 137 | ||
jashkenas/coffeescript:test/repl.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
testRepl "ctrl-v toggles multiline prompt", (input, output) ->
input.emit 'keypress', null, ctrlV
eq '------> ', output.lastWrite(0)
input.emit 'keypress', null, ctrlV
eq 'coffee> ', output.lastWrite(0)
testRepl "multiline continuation changes prompt", (... | testRepl("ctrl-v toggles multiline prompt", function(input, output) {
input.emit('keypress', null, ctrlV);
eq('------> ', output.lastWrite(0));
input.emit('keypress', null, ctrlV);
return eq('coffee> ', output.lastWrite(0));
});
testRepl("multiline continuation changes prompt", function(input, output) {
inpu... | CoffeeScript | JavaScript | jashkenas/coffeescript | test/repl.coffee | MIT | 3f4b03bcff3e80ea5ed838c67e81fda106d83f21 | 16,577 | https://github.com/jashkenas/coffeescript/blob/3f4b03bcff3e80ea5ed838c67e81fda106d83f21/test/repl.coffee | 88 | 137 |
jashkenas/coffeescript:test/repl.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
testRepl("ctrl-v toggles multiline prompt", function(input, output) {
input.emit('keypress', null, ctrlV);
eq('------> ', output.lastWrite(0));
input.emit('keypress', null, ctrlV);
return eq('coffee> ', output.lastWrite(0));
});
testRepl("multiline continu... | testRepl "ctrl-v toggles multiline prompt", (input, output) ->
input.emit 'keypress', null, ctrlV
eq '------> ', output.lastWrite(0)
input.emit 'keypress', null, ctrlV
eq 'coffee> ', output.lastWrite(0)
testRepl "multiline continuation changes prompt", (input, output) ->
input.emit 'keypress', null, ctrlV
... | JavaScript | CoffeeScript | jashkenas/coffeescript | test/repl.coffee | MIT | 3f4b03bcff3e80ea5ed838c67e81fda106d83f21 | 16,577 | https://github.com/jashkenas/coffeescript/blob/3f4b03bcff3e80ea5ed838c67e81fda106d83f21/test/repl.coffee | 88 | 137 |
jashkenas/coffeescript:test/repl.coffee:4:completion | completion | testRepl "ctrl-v toggles multiline prompt", (input, output) ->
input.emit 'keypress', null, ctrlV
eq '------> ', output.lastWrite(0)
input.emit 'keypress', null, ctrlV
eq 'coffee> ', output.lastWrite(0)
testRepl "multiline continuation changes prompt", (input, output) ->
input.emit 'keypress', null, ctrlV
... | input.emitLine 'a'
eq '2', output.lastWrite()
testRepl "existential assignment of previously declared variable", (input, output) ->
input.emitLine 'a = null'
input.emitLine 'a ?= 42'
eq '42', output.lastWrite()
testRepl "keeps running after runtime error", (input, output) ->
input.emitLine 'a = b'
input.e... | CoffeeScript | CoffeeScript | jashkenas/coffeescript | test/repl.coffee | MIT | 3f4b03bcff3e80ea5ed838c67e81fda106d83f21 | 16,577 | https://github.com/jashkenas/coffeescript/blob/3f4b03bcff3e80ea5ed838c67e81fda106d83f21/test/repl.coffee | 88 | 137 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.