From 6790af75bf49ab951041453197ecf7bcb189bafb Mon Sep 17 00:00:00 2001 From: Marko Vuksanovic Date: Thu, 20 Mar 2014 13:17:33 +1100 Subject: [PATCH 1/2] fix(Jasmine): Execute AfterEach methods This change fixes the problem that functions defined using afterEach in unit tests were not run. --- test/jasmine_syntax.dart | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/jasmine_syntax.dart b/test/jasmine_syntax.dart index d50b8fb62..557c3bcce 100644 --- a/test/jasmine_syntax.dart +++ b/test/jasmine_syntax.dart @@ -55,9 +55,8 @@ describe(name, fn, [bool exclusive=false]) { try { unit.group(name, () { unit.setUp(currentDescribe.setUp); - fn(); - unit.tearDown(currentDescribe.tearDown); + fn(); }); } finally { currentDescribe = lastDescribe; From ead96d7a9347a3ecf390c91ad0cc518d17386280 Mon Sep 17 00:00:00 2001 From: Marko Vuksanovic Date: Thu, 20 Mar 2014 13:19:36 +1100 Subject: [PATCH 2/2] chore(EventHandler): Clean up EventHandler tests --- test/core_dom/event_handler_spec.dart | 6 ------ 1 file changed, 6 deletions(-) diff --git a/test/core_dom/event_handler_spec.dart b/test/core_dom/event_handler_spec.dart index c84fd05ec..6dab7ae1c 100644 --- a/test/core_dom/event_handler_spec.dart +++ b/test/core_dom/event_handler_spec.dart @@ -31,7 +31,6 @@ main() { module..value(Element, document.body); }); - // Not sure why this doesn't work. afterEach(() { document.body.children.clear(); }); @@ -45,7 +44,6 @@ main() { document.querySelector('[on-abc]').dispatchEvent(new Event('abc')); var fooScope = _.getScope(document.querySelector('[foo]')); expect(fooScope.context['ctrl'].invoked).toEqual(true); - document.body.children.clear(); })); it('shoud register and handle event with long name', inject((TestBed _) { @@ -57,7 +55,6 @@ main() { document.querySelector('[on-my-new-event]').dispatchEvent(new Event('myNewEvent')); var fooScope = _.getScope(document.querySelector('[foo]')); expect(fooScope.context['ctrl'].invoked).toEqual(true); - document.body.children.clear(); })); it('shoud have model updates applied correctly', inject((TestBed _) { @@ -69,7 +66,6 @@ main() { el.dispatchEvent(new Event('abc')); _.rootScope.apply(); expect(el.text).toEqual("new description"); - document.body.children.clear(); })); it('shoud register event when shadow dom is used', async((TestBed _) { @@ -82,7 +78,6 @@ main() { span.dispatchEvent(new CustomEvent('abc')); var ctrl = _.rootScope.context['ctrl']; expect(ctrl.invoked).toEqual(true); - document.body.children.clear(); })); it('shoud handle event within content only once', async(inject((TestBed _) { @@ -102,7 +97,6 @@ main() { var fooScope = _.getScope(document.querySelector('[foo]')); expect(fooScope.context['ctrl'].invoked).toEqual(true); - document.body.children.clear(); }))); }); }