ded / klass

a utility for creating expressive classes in JavaScript
753 stars 78 forks source link

Test case not testing anything (constructor bubbling) #25

Open bcowgill opened 9 years ago

bcowgill commented 9 years ago

This test case will show green even when it fails: Commenting out the Baz initialize function shows a test pass. You need to change ok(false,...) in both Foo and Bar's initialize function to have an actual test.

test('object literal with initialize shouldn\'t bubble constructor', 1, function () { var Foo = $k({ initialize: function() { ok(true, 'object literal with initialize shouldn\'t bubble constructor'); } });

var Bar = Foo.extend({
  initialize: function() {
    ok(true, 'object literal with initialize shouldn\'t bubble constructor');
  }
});

var Baz = Bar.extend({
  initialize: function() {
    ok(true, 'object literal with initialize shouldn\'t bubble constructor');
  }
});

//should only fire Baz's init
var baz = new Baz();

})