Sha256: 31eb3b16842d4034bf43669fc2b5f0195d588a80c7dac97f9b53f3a5abd8723e

Contents?: true

Size: 1.33 KB

Versions: 5

Compression:

Stored size: 1.33 KB

Contents

describe('update', function(){
  
  var k;
  var first;
  var last;
  
  beforeEach(function(){
    //fake
    first = re.e('update')
    
    k = re.e('update')
    
    last = re.e('update')
  })
  
  it('update first', function(){
    
    is(k.updateFirst())
    var l = 0;
    eq(re._c.update.l[l], k)
  })
  
  it('update last', function(){
    is(k.updateLast())
    var l = re._c.update.l.length-1;
    eq(re._c.update.l[l], k)
  })
  
  it('update after', function(){
    is(k.updateAfter(last))
    
    var him = re._c.update.l.indexOf(last)
    eq(re._c.update.l[him+1], k)
  })
  
  it('update before', function(){
    is(k.updateBefore(last))
    
    var him = re._c.update.l.indexOf(last)
    eq(re._c.update.l[him-1], k)
    
  })
  
  it('should update all', function(){
    
    var called = false;
    var called2 = false;
    var val = 0;
    
    k.on('update', function(v){
      called = true;
      val = v;
    })
    
    k.on('update', function(){
      called2 = true
    })
    
    re.c('update').update(10)
    
    ok(called2)
    ok(called)
    eq(val, 10)
    
    k.dispose();
  })
  
  it('updatable', function(){
    
    var n;
    
    k.on('update',function(v){
      n = v
    });
    
    k.trigger('update', 10)
    
    eq(n, 10)
    
    k.updatable = false
    
    k.trigger('update', 0)
    
    eq(n, 0)
  })
})

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
entityjs-0.4.1 spec/javascripts/src/cycle/update_spec.js
entityjs-0.4.0 spec/javascripts/src/cycle/update_spec.js
entityjs-0.3.2 spec/javascripts/src/cycle/update_spec.js
entityjs-0.3.1 spec/javascripts/src/cycle/update_spec.js
entityjs-0.3.0 spec/javascripts/src/cycle/update_spec.js