summaryrefslogtreecommitdiffstats
path: root/install/static/test/entity_tests.js
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2010-11-19 23:52:33 -0600
committerAdam Young <ayoung@redhat.com>2010-11-30 14:58:30 -0500
commitc90bff232dcc9dbab2cd6d5a1bb482cb1c5f16f9 (patch)
treee270c50dbff183e94590bd20d0d8e42100abc390 /install/static/test/entity_tests.js
parentd644d17adf117321747db1e4e22a771fbea3b09e (diff)
downloadfreeipa.git-c90bff232dcc9dbab2cd6d5a1bb482cb1c5f16f9.tar.gz
freeipa.git-c90bff232dcc9dbab2cd6d5a1bb482cb1c5f16f9.tar.xz
freeipa.git-c90bff232dcc9dbab2cd6d5a1bb482cb1c5f16f9.zip
Multicolumn association facet
The association facet has been modified to support multiple columns. By default the facet will have one column which is the primary key of the associated object (e.g. username of a group member), so the existing code will work like before. Other fields (e.g. user's full name) can be added by subclassing the ipa_association_facet class and specifying the additional columns to display. These additional fields will be retrieved using a batch operation. Previously a single association facet instance will be used for all associations in an entity. Now each association will have its own association facet. This way each association facet can be customized differently as needed. The <entity>-enroll URL parameter has been removed because it's no longer needed. The ipa_entity.create_association_facets() is provided to generate the default association facets with one column for the primary key. The column click handler has been moved out of ipa_column to provide more flexibility for customization. The get_action_panel() and get_client_area() have been modified to search within the entity's container. The group entity has been fully converted to use the new UI framework. Association facets that have been modified to use multiple columns are: - User Group's member_user - HBAC Service Group's member_hbacsvc - SUDO Command Group's member_sudocmd - Service's managedby_host New test data files have been added. Unit tests have been updated.
Diffstat (limited to 'install/static/test/entity_tests.js')
-rw-r--r--install/static/test/entity_tests.js47
1 files changed, 25 insertions, 22 deletions
diff --git a/install/static/test/entity_tests.js b/install/static/test/entity_tests.js
index 8f016efe..504775eb 100644
--- a/install/static/test/entity_tests.js
+++ b/install/static/test/entity_tests.js
@@ -83,57 +83,60 @@ test('Testing ipa_facet_setup_views().', function() {
IPA.add_entity(entity);
- entity.add_facet(ipa_search_facet({
+ var facet = ipa_search_facet({
'name': 'search',
'label': 'Search'
- }));
-
-
- var facet = ipa_association_facet({
- 'name': 'associate'
});
entity.add_facet(facet);
+ entity.create_association_facets();
+
var container = $('<div/>');
+ entity.init();
+ entity.setup(container);
+
var counter = 0;
- IPA.switch_and_show_page = function(entity_name, facet_name, other_entity) {
+ IPA.switch_and_show_page = function(entity_name, facet_name, pkey) {
counter++;
};
- facet.create_action_panel(container);
-
//Container now has two divs, one for the action panel one for content
- var list = container.children().last().children();
- var views = list.children();
+ var action_panel = facet.get_action_panel();
+ ok(action_panel.length, 'action panel exists');
+
+ var ul = $('ul', action_panel);
+
+ var views = ul.children();
equals(
- views.length, 5,
+ views.length, 6,
'Checking number of views'
);
- facet = views.first();
- ok( facet.hasClass('entity-search',
+ var li = views.first();
+ ok( li.hasClass('search-facet'),
'Checking the search facet'
);
- facet = facet.next();
+ li = li.next(); // skip action controls
var attribute_members = IPA.metadata['user'].attribute_members;
- for (attribute_member in attribute_members) {
+ for (var attribute_member in attribute_members) {
var objects = attribute_members[attribute_member];
for (var i = 0; i < objects.length; i++) {
var object = objects[i];
+ var title = attribute_member+'_'+object;
+
+ li = li.next();
+ var value = li.attr('title');
equals(
- facet.attr('title'), object,
- 'Checking the '+object+' facet'
+ value, title,
+ 'Checking the '+title+' facet'
);
- facet = facet.next();
}
}
- var action_panel = $('.action-panel', container);
- ok(action_panel.length, 'action panel exists');
var pkey_input = $('input[name=pkey]', action_panel);
ok(pkey_input.length,'pkey input exists');
var search_facets = $('li.search-facet', action_panel);
@@ -148,7 +151,7 @@ test('Testing ipa_facet_setup_views().', function() {
entity_facet.click();
}
-// equals(4, counter,'four clicks');
+ equals(counter, 0, 'links are disabled');
IPA.switch_and_show_page = orig_switch_and_show_page;
});