From 6f6d50f37f21db2a5591fa44c962eea04b82f596 Mon Sep 17 00:00:00 2001 From: Adam Young Date: Mon, 7 Feb 2011 23:02:43 -0500 Subject: target section without radio buttons ACI target section refactored into an array of widget-like objects. The radio buttons have been replaced by a select box. THe select is not visible on the details page. --- install/ui/test/aci_tests.js | 41 +++++++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 10 deletions(-) (limited to 'install/ui/test/aci_tests.js') diff --git a/install/ui/test/aci_tests.js b/install/ui/test/aci_tests.js index d1a5cb6bf..ff8b5de04 100644 --- a/install/ui/test/aci_tests.js +++ b/install/ui/test/aci_tests.js @@ -130,33 +130,54 @@ test("IPA.rights_widget.", function() { test("Testing aci grouptarget.", function() { var sample_data_filter_only = {"targetgroup":"ipausers"}; target_section.load(sample_data_filter_only); - ok($('#aci_by_group')[0].checked, 'aci_by_group control selected'); - ok ($('#targetgroup-entity-select option').length > 2,'group select populated'); -}); + var selected = $(target_section.type_select+":selected"); + same(selected.val(), 'targetgroup' , 'group control selected'); + ok ($('#targetgroup-entity-select option').length > 2, + 'group select populated'); +}); -test("Testing aci object type.", function() { +test("Testing type target.", function() { var sample_data_filter_only = {"type":"hostgroup"}; + target_section.load(sample_data_filter_only); - ok($('.aci-attribute', target_container).length > 4); - ok($('#aci_by_type')[0].checked, 'aci_by_type control selected'); + var selected = $(target_section.type_select+":selected"); + same(selected.val(), 'type', 'type selected'); + + $("input[type=checkbox]").attr("checked",true); + var response_record = {}; + target_section.save(response_record); + same(response_record.type, sample_data_filter_only.type, + "saved type matches sample data"); + ok((response_record.attrs.length > 10), + "response length shows some attrs set"); }); -test("Testing aci filter only.", function() { +test("Testing filter target.", function() { var sample_data_filter_only = {"filter":"somevalue"}; target_section.load(sample_data_filter_only); - var filter_radio = $('#aci_by_filter'); + var selected = $(target_section.type_select+":selected"); + same(selected.val(), 'filter', 'filter selected'); +}); + + + +test("Testing subtree target.", function() { - ok(filter_radio.length,'find "filter_only_radio" control'); - ok(filter_radio[0].checked,'filter_only_radio control is checked'); + var sample_data = { + subtree:"ldap:///cn=*,cn=roles,cn=accounts,dc=example,dc=co"}; + target_section.load(sample_data); + var record = {}; + target_section.save(record); + same(record.subtree, sample_data.subtree, 'subtree set correctly'); }); -- cgit