From d966056bb0e24693fcd05be690f724e921492df3 Mon Sep 17 00:00:00 2001 From: Endi Sukma Dewata Date: Tue, 28 Sep 2010 10:19:05 -0400 Subject: Test suite for association. New test cases have been added to test SerialAssociator and BulkAssociator using mockup objects. Also fixed a bug in BulkAssociator. Moved switch_view() out of ipa_entity_generate_views() in entity.js to allow unit testing using mockup objects. Updated the test case to validate click event on facets. --- install/static/test/entity_tests.js | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'install/static/test/entity_tests.js') diff --git a/install/static/test/entity_tests.js b/install/static/test/entity_tests.js index 297928ba..78fa2d4f 100644 --- a/install/static/test/entity_tests.js +++ b/install/static/test/entity_tests.js @@ -78,7 +78,13 @@ test("Testing ipa_entity_generate_views().", function() { ); var container = $("
"); - ipa_entity_generate_views("user", container); + + var counter = 0; + var callback = function() { + counter++; + }; + + ipa_entity_generate_views("user", container, callback); var list = container.children(); var facets = list.children(); @@ -92,16 +98,20 @@ test("Testing ipa_entity_generate_views().", function() { equals( search.attr("title"), "search", - "Checking the first facet" + "Checking the search facet" ) + search.click(); + var details = search.next(); equals( details.attr("title"), "details", - "Checking the second facet" + "Checking the details facet" ) + details.click(); + var facet = details.next(); var attribute_members = ipa_objs["user"].attribute_members; for (attribute_member in attribute_members) { @@ -111,10 +121,17 @@ test("Testing ipa_entity_generate_views().", function() { equals( facet.attr("title"), object, - "Checking the next facet" + "Checking the "+object+" facet" ); + facet.click(); + facet = facet.next(); } } + + equals( + counter, 6, + "Checking callback invocations" + ); }); -- cgit