diff options
Diffstat (limited to 'install/ui/test')
-rw-r--r-- | install/ui/test/framework_tests.js | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/install/ui/test/framework_tests.js b/install/ui/test/framework_tests.js index e82a54a5f..296e74ebe 100644 --- a/install/ui/test/framework_tests.js +++ b/install/ui/test/framework_tests.js @@ -33,6 +33,28 @@ module('framework',{ that.foo = spec.foo || 'facet_foo'; that.baz = spec.baz || 'facet_baz'; that.bar = spec.bar || 'facet_bar'; + this._.on('pre_with_events', this.preevent_handler, this); + this._.on('post_with_events', this.postevent_handler, this); + }); + + that._.method('with_events', function(first, second) { + this.with_events_called = true; + this.with_events_attrs = [first, second]; + }, { + pre_event: true, + post_event: true + }); + + that._.method('preevent_handler', function(first, second) { + that.preevent_handler_called = true; + this.preevent_handler_bound = true; + this.preevent_handler_attrs = [first, second]; + }); + + that._.method('postevent_handler', function(first, second) { + that.postevent_handler_called = true; + this.postevent_handler_bound = true; + this.postevent_handler_attrs = [first, second]; }); return that; @@ -79,4 +101,22 @@ test("Build and inheritence" ,function() { same(details_facet.foo, 'facet_foo', "Property - ancestor's default"); same(details_facet.baz, 'details_baz', "Property - child's default"); same(details_facet.bar, 'custom_bar', "Property - custom"); + + //test method calls and pre/post events + + var attrs = ["first", "second"]; + details_facet.with_events(attrs[0], attrs[1]); + + ok(details_facet.with_events_called, "With events called."); + same(details_facet.with_events_attrs, attrs, "With event called with good attrs"); + + ok(details_facet.preevent_handler_called, "Pre event called."); + ok(details_facet.preevent_handler_bound, "Pre event correctly bounded."); + same(details_facet.preevent_handler_attrs, attrs, "Pre event called with good attrs"); + + ok(details_facet.postevent_handler_called, "Post event called."); + ok(details_facet.postevent_handler_bound, "Post event correctly bounded."); + same(details_facet.postevent_handler_attrs, attrs, "Post event called with good attrs"); + + //calls }); |