Sha256: 457eb47b64f58e36af81ff2c27b6c8e8478b8567c7ca528a5c1995741102b281

Contents?: true

Size: 1.02 KB

Versions: 2

Compression:

Stored size: 1.02 KB

Contents

describe('flicker', function(){
	
	var e;

	beforeEach(function(){
    
		e = re.e().attr({
      health:0,
      flick:function(v){
        this.health += v; 
      }
    })
    .comp('flicker');
    
	});

	it('addFlicker', function(){
		
    e.addFlicker('heal', 5, 200, [10])
    
    is(e.flicker_reels['heal'])
	});
  
  it('removeFlicker', function(){
    
    is(e.addFlicker('heal', 5, 200, [10]))
    
    is(e.flicker_reels['heal'])
    
    is(e.removeFlicker('heal'))
    
    eq(e.flicker_reels['heal'], null)
  })
  
  it('flicker', function(){
    
    e.addFlicker('heal', 2, 100, [5, 5])
    
    var called = false;
    var called2 = false;
    
    e.on('flicker:start', function(){
      called = true;
    })
    .on('flicker:end', function(v){
      called2 = true;
      is(v, 'string')
    })
    
    e.flicker('heal')
    
    ok(e.flickering('heal'))
    
    ok(e.flickering())
    
    ok(called)
    
    //manually call update
    e.flicker_update(0.9)
    
    eq(e.health, 20)
      
    ok(called2)
  })
  
});

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
entityjs-0.3.1 spec/javascripts/src/pattern/flicker_spec.js
entityjs-0.3.0 spec/javascripts/src/pattern/flicker_spec.js