Ejemplo n.º 1
0
			it('should work', function(){
				var key = action({
					keydown: spy
				})
				car.action('keydown=>keydown', key)
				runKeyDown(car)
			})
Ejemplo n.º 2
0
			it('should work with hooks defined at bind time', function(){
				var dispatch = action(function(e){
					this.dispatch('down')
				}).on('down', spy)

				Car.prototype.action('keydown', dispatch)
				runKeyDown(new Car)
			})
Ejemplo n.º 3
0
			it('should copy all attributes of the action when instantiated', function(){
				var dispatch = action({
					myattr: {},
					stdin: chai.spy(function(){
						this.should.not.equal(dispatch)
						this.should.deep.equal(dispatch)
						this.stdin.should.equal(dispatch.stdin)
						this.myattr.should.not.equal(dispatch.myattr)
					})
				})
				Car.prototype.action('keydown', dispatch)
				happen.keydown(new Car().el)
				dispatch.stdin.should.have.been.called(1)
			})
Ejemplo n.º 4
0
			it('should maintain identity across actions', function(){
				var first
				var dispatch = action({
					stdin: chai.spy(function(){
						this.should.not.equal(dispatch)
						if (first) this.should.equal(first)
						else first = this
					})
				})
				Car.prototype.action('keydown', dispatch)
				Car.prototype.action('keyup', dispatch)
				var car = new Car
				happen.keydown(car.el)
				happen.keyup(car.el)
				dispatch.stdin.should.have.been.called(2)
			})
Ejemplo n.º 5
0
module.exports = function(){
	var path = 'BODY '
	return action(function delegator(e, pres){
		var view = pres.view
		if (e.target === view) return

		if (view.parentNode.querySelector(path) !== view) {
			path = unique(view) + ' '
		}
		var selectors = this.pins
		for (var selector in selectors) {
			var targ = find(view, e.target, path + selector)
			if (targ) {
				e.delegate = targ
				this.dispatch(selector, e, pres)
			}
		}
	})
}
Ejemplo n.º 6
0
export function getImages() {
	action('/run/_albums/get_images', templateGetImages);
}
Ejemplo n.º 7
0
export function refreshAlbum() {
	action('/run_cmd/album/refresh', templateRefresh);
}
Ejemplo n.º 8
0
export function createAlbum() {
	action('/run_cmd/album/create', templateNew);
}
Ejemplo n.º 9
0
export function deportAlbum() {
	action('/run_cmd/album/deport', templateDeport);
}
Ejemplo n.º 10
0
			.map(res => action('response', {
				success: (typeof res.error == 'undefined' || !res.error),
				title: 'Created',
				text: ((typeof res.error == 'undefined' || !res.error) && res.body.length) ? 'User ' + res.body[0].email + ' created with ID ' + res.body[0].id + '.' : 'An unknown error occured, please try again later.'
			}))
Ejemplo n.º 11
0
export function reloadEditorials() {
	action('/run/_editorials/reload_table', templateReload);
}
Ejemplo n.º 12
0
export function createBanner() {
	action('/run_cmd/banner/create', templateCreate);
}
Ejemplo n.º 13
0
export function importAlbum() {
	action('/run_cmd/album/import', templateImport);
}
Ejemplo n.º 14
0
export function deportEditorial() {
	action('/run_cmd/editorial/deport', templateDeport);
}
Ejemplo n.º 15
0
export function refreshBanner() {
	action('/run_cmd/banner/refresh', templateRefresh);
}
Ejemplo n.º 16
0
export function reloadBanners() {
	action('/run/_banners/reload_table', templateReload);
}
Ejemplo n.º 17
0
			it('should work', function(){
				Car.prototype.action('keydown=>keydown', action({
					keydown: spy
				}))
				runKeyDown(new Car)
			})
Ejemplo n.º 18
0
export function importBanner() {
	action('/run_cmd/banner/import', templateImport);
}
Ejemplo n.º 19
0
export function getImages() {
	action('/run/_banners/get_images', templateGetImages);
}
Ejemplo n.º 20
0
export function importEditorial() {
	action('/run_cmd/editorial/import', templateImport);
}
Ejemplo n.º 21
0
		input$: DOM.select('input').events('input').map(ev => action('input', {target: ev.target.name, value: ev.target.value})),
Ejemplo n.º 22
0
export function refreshEditorial() {
	action('/run_cmd/editorial/refresh', templateRefresh);
}
Ejemplo n.º 23
0
		submit$: DOM.select('button').events('click').map(ev => action('submit', {target: ev.target.name})),
Ejemplo n.º 24
0
export function getImages() {
	action('/run/_editorials/get_images', templateGetImages);
}
Ejemplo n.º 25
0
export function deportBanner() {
	action('/run_cmd/banner/deport', templateDeport);
}