Example #1
0
 it('if compute is set false they will not be autocomputed', function(){
   attr.autocompute = false
   var a = attr(returnsOne)
   assert(a.computed == null )
   assert(a() == returnsOne )
 })
Example #2
0
 it('should show the first slide', function(){
   assert(this.view.current === 0);
 });
Example #3
0
 it('should have the first indicator active', function(){
   assert(hasClass(this.view.indicators[0], 'is-active'));
   assert(hasClass(this.view.indicators[1], 'is-active') === false);
   assert(hasClass(this.view.indicators[2], 'is-active') === false);
   assert(hasClass(this.view.indicators[2], 'is-active') === false);
 });
Example #4
0
 it('should not do anything if it is disabled', function(){
   this.view.setEnabled(false);
   this.view.show(1);
   assert(this.view.current === 0, this.view.current);
 });
Example #5
0
 it('should be created', function(){
   assert(this.el.querySelector('.slideshow__next'));
   assert(this.el.querySelector('.slideshow__previous'));
   assert(this.el.querySelector('.js-indicators'));
 });
Example #6
0
 it('should set values on initialization', function(){
   var el = domify('<div><p data-text="name"></p></div>')[0];
   var user = { name: 'Tobi' };
   var view = reactive(el, user);
   assert('Tobi' == el.children[0].textContent);
 })
Example #7
0
 b.on('foo', function (bar, twoThousand) {
   assert(bar === 'bar', 'bar should be ' + bar);
   assert(2000 === twoThousand);
   done();
 });
Example #8
0
 a.change(function(val, old) {
   assert(val == 2)
   assert(old == 1)
   run = true
 })
Example #9
0
 it('should have no dependencies', function(){
   var a = attr(1)
   
   assert( a.dependencies == null )
 })
Example #10
0
 it('should increment by first arg', function(){
   var a = attr(1)
   
   a.incr(-10)
   assert( a() == -9)
 })
Example #11
0
 it('should return an attr', function(){
   assert(attr() != null)
 })
Example #12
0
 it('should increment', function(){
   var a = attr(1)
   
   a.incr()
   assert( a() == 2)
 })
Example #13
0
 it('should toggle', function(){
   var a = attr(true)
   
   a.toggle()    
   assert( a() == false)
 })
Example #14
0
 it('should set its old to current when set', function(){
   var a = attr(1)
   a("hello")
   assert( a.old == 1 )
 })
Example #15
0
 it('should uncheck when falsey', function(){
   var el = domify('<div><input data-checked="agree" /></div>')[0];
   var user = { agree: false };
   var view = reactive(el, user);
   assert(null == el.children[0].getAttribute('checked'));
 })
Example #16
0
 todo1.on('saving', function () {
   assert(false);
 });
Example #17
0
 it('should set attribute value', function(){
   var el = domify('<div><input type="text" data-value="name" /></div>')[0];
   var user = { name: 'Tobi' };
   var view = reactive(el, user);
   assert('Tobi' == el.children[0].value);
 })
Example #18
0
 todo2.on('saving', function () {
   assert(true);
 });
Example #19
0
 date: function(date, fmt){
   assert(now == date);
   assert(fmt == '%Y/%M/%d');
   return 'formatted date';
 }
Example #20
0
 user.todos().last().on('saving', function () {
   assert(true);
 });
Example #21
0
 it('should mixin Emitter methods', function () {
   for (var key in Emitter.prototype) {
     assert(Sprite[key] === Emitter.prototype[key], 'key : ' + key);
   }
 });
Example #22
0
 user.todos().first().on('save', function () {
   assert(user.todos().first().id() === 1);
 });
Example #23
0
 it('should not do anything if it already on a slide', function(){
   this.view.show(0);
   assert(this.view.enabled === true);
 });
Example #24
0
File: test.js Project: apily/route
 it('should support wildcards', function(){
   var route = new Route('/file/*');
   var ret = route.match('/file/js/jquery.js');
   assert('js/jquery.js' == ret[0]);
 });
Example #25
0
 it('should have four slides', function(){
   assert(this.view.slides.length === 4);
 });
Example #26
0
File: test.js Project: apily/route
 it('should decode the params', function(){
   var route = new Route('/user/:name');
   var ret = route.match('/user/tj%20holowaychuk');
   assert('tj holowaychuk' == ret.name);
 });
Example #27
0
  it('should have the correct slide classes on load', function(){    
    assert(hasClass(this.view.slides[0], 'is-current'));
    assert(hasClass(this.view.slides[0], 'is-previous') === false);
    assert(hasClass(this.view.slides[0], 'is-next') === false);

    assert(hasClass(this.view.slides[1], 'is-current') === false);
    assert(hasClass(this.view.slides[1], 'is-previous') === false);
    assert(hasClass(this.view.slides[1], 'is-next'));

    assert(hasClass(this.view.slides[2], 'is-current') === false);
    assert(hasClass(this.view.slides[2], 'is-previous') === false);
    assert(hasClass(this.view.slides[2], 'is-next') === false);

    assert(hasClass(this.view.slides[3], 'is-current') === false);
    assert(hasClass(this.view.slides[3], 'is-previous'));
    assert(hasClass(this.view.slides[3], 'is-next') === false);
  });
Example #28
0
 it('should remove .show when truthy', function(){
   var el = domify('<div><p data-hide="file" class="file show">Has a file</p></div>')[0];
   var item = { file: 'some.png' };
   var view = reactive(el, item);
   assert('file hide' == el.children[0].className);
 })
Example #29
0
  it('should show a slide', function(){
    this.view.show(1);

    assert(hasClass(this.view.slides[0], 'is-current') === false);
    assert(hasClass(this.view.slides[0], 'is-previous') === true);
    assert(hasClass(this.view.slides[0], 'is-next') === false);

    assert(hasClass(this.view.slides[1], 'is-current') === true);
    assert(hasClass(this.view.slides[1], 'is-previous') === false);
    assert(hasClass(this.view.slides[1], 'is-next') === false);

    assert(hasClass(this.view.slides[2], 'is-current') === false);
    assert(hasClass(this.view.slides[2], 'is-previous') === false);
    assert(hasClass(this.view.slides[2], 'is-next') === true);

    assert(hasClass(this.view.slides[3], 'is-current') === false);
    assert(hasClass(this.view.slides[3], 'is-previous') === false);
    assert(hasClass(this.view.slides[3], 'is-next') === false);
  });
Example #30
0
 it('is a computed attr', function(){
   var a = attr(returnsOne)
   assert(a.computed == true )
   assert(a() == 1 )
 })