From 3ca0f6aee5b04758f8473359cc14979d27d31530 Mon Sep 17 00:00:00 2001 From: Petr Vobornik Date: Fri, 9 Mar 2012 15:52:05 +0100 Subject: Fixed evaluating checkbox dirty status Problem: When value in checkbox is modified twice in a row (so it is at its original value) an 'undo' button is still visible even when it shouldn't be. Cause: IPA server sends boolean values as 'TRUE' or 'FALSE' (strings). Checkbox_widget converts them to JavaScript? boolean (true, false). Save method in checkbox_widget is returning array with a boolean. So test_dirty method always evaluates to dirty because 'FALSE' != false. This patch is fixing the problem. https://fedorahosted.org/freeipa/ticket/2494 --- install/ui/test/widget_tests.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'install/ui/test/widget_tests.js') diff --git a/install/ui/test/widget_tests.js b/install/ui/test/widget_tests.js index 951f943a..489572c2 100644 --- a/install/ui/test/widget_tests.js +++ b/install/ui/test/widget_tests.js @@ -223,7 +223,9 @@ test("Testing checkbox widget.", function() { spec = {name:'title'}; base_widget_test('test_value'); - var mock_record = { 'title': 'TRUE' }; + //Changing mock record from 'TRUE' to true. Value normalization is field's + //job. Checkbox should work with booleans values. + var mock_record = { 'title': [true] }; widget.update(mock_record.title); same(widget.save(),[true], "Checkbox is set"); -- cgit