From 80324fcb23ba6559487ba29074b608dc2bbf4945 Mon Sep 17 00:00:00 2001 From: Petr Vobornik Date: Fri, 7 Mar 2014 16:52:42 +0100 Subject: webui: fix unit tests UI unit tests were broken since main RCUE work. This patch fixes them all except aci, which will be fixed along with update of aci UI. Reviewed-By: Adam Misnyovszki Reviewed-By: Petr Viktorin --- install/ui/test/all_tests.html | 2 -- install/ui/test/association_tests.html | 2 -- install/ui/test/certificate_tests.html | 2 -- install/ui/test/details_tests.html | 2 -- install/ui/test/details_tests.js | 38 +++++++++++++++++----------------- install/ui/test/entity_tests.html | 2 -- install/ui/test/ipa_tests.html | 3 --- install/ui/test/ipa_tests.js | 25 +++++++++------------- install/ui/test/navigation_tests.html | 2 -- install/ui/test/ordered_map_tests.html | 3 --- install/ui/test/utils_tests.html | 2 -- install/ui/test/widget_tests.html | 2 -- 12 files changed, 29 insertions(+), 56 deletions(-) diff --git a/install/ui/test/all_tests.html b/install/ui/test/all_tests.html index dc4e6c832..e9cd6bb80 100644 --- a/install/ui/test/all_tests.html +++ b/install/ui/test/all_tests.html @@ -5,8 +5,6 @@ - - diff --git a/install/ui/test/association_tests.html b/install/ui/test/association_tests.html index 13fd53027..6c203831b 100644 --- a/install/ui/test/association_tests.html +++ b/install/ui/test/association_tests.html @@ -5,8 +5,6 @@ - - diff --git a/install/ui/test/certificate_tests.html b/install/ui/test/certificate_tests.html index 23672862c..d4953da04 100755 --- a/install/ui/test/certificate_tests.html +++ b/install/ui/test/certificate_tests.html @@ -5,8 +5,6 @@ - - diff --git a/install/ui/test/details_tests.html b/install/ui/test/details_tests.html index fb9fbc5bd..061dc5664 100644 --- a/install/ui/test/details_tests.html +++ b/install/ui/test/details_tests.html @@ -5,8 +5,6 @@ - - diff --git a/install/ui/test/details_tests.js b/install/ui/test/details_tests.js index 85fb270fd..87315b5a8 100644 --- a/install/ui/test/details_tests.js +++ b/install/ui/test/details_tests.js @@ -88,26 +88,26 @@ test("Testing IPA.details_section.create().", function() { var container = $("
"); section.create(container); - var table = $('table', container); + var section_el = $('.details-section', container); same( - table.length, 1, - 'Verifying table'); + section_el.length, 1, + 'Verifying section element'); - var rows = $('tr', table); + var controls = $('.control-group', section_el); same( - rows.length, fields.length, - 'Verifying table rows'); + controls.length, fields.length, + 'Verifying number of controls'); for (var i=0; i - - diff --git a/install/ui/test/ipa_tests.html b/install/ui/test/ipa_tests.html index 31b208d0e..cfe779a84 100644 --- a/install/ui/test/ipa_tests.html +++ b/install/ui/test/ipa_tests.html @@ -3,11 +3,8 @@ Core Test Suite - - - diff --git a/install/ui/test/ipa_tests.js b/install/ui/test/ipa_tests.js index 258abe7d6..8ac782ef8 100644 --- a/install/ui/test/ipa_tests.js +++ b/install/ui/test/ipa_tests.js @@ -218,24 +218,27 @@ test("Testing unsuccessful IPA.command().", function() { on_error: error_handler }).execute(); + function click_button(name) { + var dialog = $('#error_dialog'); + var btn = $('button[name='+name+']', dialog).first(); + btn.trigger('click'); + } + var dialog = $('#error_dialog'); - var ui_dialog = dialog.parent('.ui-dialog'); equals( ajax_counter, 1, "Checking ajax invocation counter"); ok( - ui_dialog.length === 1 && dialog.dialog('isOpen'), + dialog.length === 1, "The dialog box is created and open."); ok( success_handler_counter === 0 && error_handler_counter === 0, "Initially none of the handlers are called."); - // search the retry button from the beginning - var retry = $('button', ui_dialog).first(); - retry.trigger('click'); + click_button('retry'); equals( ajax_counter, 2, @@ -245,11 +248,7 @@ test("Testing unsuccessful IPA.command().", function() { success_handler_counter === 0 && error_handler_counter === 0, "After 1st retry, none of the handlers are called."); - // search the retry button from the beginning again because the dialog - // has been recreated - ui_dialog = $('#error_dialog').parent('.ui-dialog'); - retry = $('button', ui_dialog).first(); - retry.trigger('click'); + click_button('retry'); equals(ajax_counter, 3, "Checking ajax invocation counter"); @@ -257,11 +256,7 @@ test("Testing unsuccessful IPA.command().", function() { ok(success_handler_counter === 0 && error_handler_counter === 0, "After 2nd retry, none of the handlers are called."); - // search the cancel button from the beginning because the dialog has - // been recreated - ui_dialog = $('#error_dialog').parent('.ui-dialog'); - var cancel = $('button', ui_dialog).first().next(); - cancel.trigger('click'); + click_button('cancel'); equals(ajax_counter, 3, "Checking ajax invocation counter"); diff --git a/install/ui/test/navigation_tests.html b/install/ui/test/navigation_tests.html index d38182900..31b6b838b 100644 --- a/install/ui/test/navigation_tests.html +++ b/install/ui/test/navigation_tests.html @@ -5,8 +5,6 @@ - - diff --git a/install/ui/test/ordered_map_tests.html b/install/ui/test/ordered_map_tests.html index 3b019e6e0..60f949d2c 100755 --- a/install/ui/test/ordered_map_tests.html +++ b/install/ui/test/ordered_map_tests.html @@ -3,11 +3,8 @@ Ordered Map Test Suite - - - diff --git a/install/ui/test/utils_tests.html b/install/ui/test/utils_tests.html index 56616815e..b740885a4 100644 --- a/install/ui/test/utils_tests.html +++ b/install/ui/test/utils_tests.html @@ -5,8 +5,6 @@ - - diff --git a/install/ui/test/widget_tests.html b/install/ui/test/widget_tests.html index 50d156f51..957463c4a 100755 --- a/install/ui/test/widget_tests.html +++ b/install/ui/test/widget_tests.html @@ -5,8 +5,6 @@ - - -- cgit