Better automated test support

1. add class to active facet instead of using direct style modification for hiding/showing
2. add name attribute to tables and dialog buttons and error dialog

https://fedorahosted.org/freeipa/ticket/3744
This commit is contained in:
Petr Vobornik 2013-05-24 17:02:05 +02:00
parent 7a105604e2
commit a83e879e18
6 changed files with 19 additions and 11 deletions

View File

@ -471,6 +471,11 @@ body {
left: 10px; left: 10px;
right: 10px; right: 10px;
bottom: 0; bottom: 0;
display: none;
}
.active-facet {
display: block;
} }
.facet-header { .facet-header {

View File

@ -484,6 +484,7 @@ IPA.attributes_widget = function(spec) {
that.$node = that.table = $('<table/>', { that.$node = that.table = $('<table/>', {
id: id, id: id,
name: that.name,
'class': 'search-table aci-attribute-table scrollable' 'class': 'search-table aci-attribute-table scrollable'
}). }).
append('<thead/>'). append('<thead/>').
@ -526,7 +527,7 @@ IPA.attributes_widget = function(spec) {
var td = $('<td/>').appendTo(tr); var td = $('<td/>').appendTo(tr);
var name = that.get_input_name(); var name = that.get_input_name();
var id = that.option_next_id + name; var id = that._option_next_id + name;
td.append($('<input/>',{ td.append($('<input/>',{
id: id, id: id,
type: 'checkbox', type: 'checkbox',

View File

@ -251,8 +251,9 @@ IPA.dialog = function(spec) {
var parent = that.container.parent(); var parent = that.container.parent();
var buttons = $('.ui-dialog-buttonpane .ui-dialog-buttonset button', parent); var buttons = $('.ui-dialog-buttonpane .ui-dialog-buttonset button', parent);
buttons.each(function(index) { buttons.each(function(index, ui_button) {
var button = that.buttons.values[index]; var button = that.buttons.values[index];
$(ui_button).prop('name', button.name);
button.element = $(this); button.element = $(this);
}); });
}; };

View File

@ -352,7 +352,7 @@ exp.facet = IPA.facet = function(spec, no_init) {
that.domNode.detach(); that.domNode.detach();
} else { } else {
that.domNode = $('<div/>', { that.domNode = $('<div/>', {
'class': 'facet', 'class': 'facet active-facet',
name: that.name, name: that.name,
'data-name': that.name, 'data-name': that.name,
'data-entity': entity_name 'data-entity': entity_name
@ -386,8 +386,7 @@ exp.facet = IPA.facet = function(spec, no_init) {
}).appendTo(domNode); }).appendTo(domNode);
that.create_content(that.content); that.create_content(that.content);
domNode.removeClass('active-facet');
}; };
that.create_header = function(container) { that.create_header = function(container) {
@ -429,7 +428,7 @@ exp.facet = IPA.facet = function(spec, no_init) {
that.clear(); that.clear();
} }
that.domNode.css('display', 'block'); that.domNode.addClass('active-facet');
that.show_content(); that.show_content();
that.header.select_tab(); that.header.select_tab();
@ -437,7 +436,7 @@ exp.facet = IPA.facet = function(spec, no_init) {
that.refresh(); that.refresh();
} }
} else { } else {
that.domNode.css('display', 'block'); that.domNode.addClass('active-facet');
that.show_content(); that.show_content();
that.header.select_tab(); that.header.select_tab();
} }
@ -459,7 +458,7 @@ exp.facet = IPA.facet = function(spec, no_init) {
}; };
that.hide = function() { that.hide = function() {
that.domNode.css('display', 'none'); that.domNode.removeClass('active-facet');
}; };
that.load = function(data) { that.load = function(data) {

View File

@ -1232,6 +1232,7 @@ IPA.error_dialog = function(spec) {
spec = spec || {}; spec = spec || {};
spec.id = spec.id || 'error_dialog'; spec.id = spec.id || 'error_dialog';
spec.name = 'error_dialog';
spec.title = spec.error_thrown.name; spec.title = spec.error_thrown.name;
var that = IPA.dialog(spec); var that = IPA.dialog(spec);

View File

@ -1561,7 +1561,8 @@ IPA.table_widget = function (spec) {
container.addClass('table-widget'); container.addClass('table-widget');
that.table = $('<table/>', { that.table = $('<table/>', {
'class': 'search-table' 'class': 'search-table',
name: that.name
}).appendTo(container); }).appendTo(container);
if (that['class']) that.table.addClass(that['class']); if (that['class']) that.table.addClass(that['class']);