2010-09-24 18:50:29 -05:00
|
|
|
/* Authors:
|
|
|
|
* Endi Sukma Dewata <edewata@redhat.com>
|
|
|
|
*
|
|
|
|
* Copyright (C) 2010 Red Hat
|
|
|
|
* see file 'COPYING' for use and warranty information
|
|
|
|
*
|
2010-12-09 06:59:11 -06:00
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
2010-09-24 18:50:29 -05:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2010-12-09 06:59:11 -06:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2010-09-24 18:50:29 -05:00
|
|
|
*/
|
|
|
|
|
2011-03-18 15:43:54 -05:00
|
|
|
|
|
|
|
var entities_container;
|
|
|
|
|
2011-01-19 20:10:18 -06:00
|
|
|
module('entity',{
|
|
|
|
setup: function() {
|
2011-03-18 15:43:54 -05:00
|
|
|
|
|
|
|
IPA.ajax_options.async = false;
|
|
|
|
|
|
|
|
IPA.init(
|
|
|
|
"data",
|
|
|
|
true,
|
|
|
|
function(data, text_status, xhr) {
|
|
|
|
|
|
|
|
IPA.entity_factories.user = function(){
|
|
|
|
return IPA.
|
|
|
|
entity_builder().
|
|
|
|
entity('user').
|
|
|
|
search_facet({
|
2011-04-18 10:59:50 -05:00
|
|
|
columns:['uid']}).
|
2011-03-18 15:43:54 -05:00
|
|
|
build();
|
|
|
|
};
|
|
|
|
IPA.start_entities();
|
|
|
|
},
|
|
|
|
function(xhr, text_status, error_thrown) {
|
|
|
|
ok(false, "ipa_init() failed: "+error_thrown);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
entities_container = $('<div id="entities"/>').appendTo(document.body);
|
|
|
|
|
2011-01-19 20:10:18 -06:00
|
|
|
},
|
|
|
|
teardown: function() {
|
2011-03-18 15:43:54 -05:00
|
|
|
entities_container.remove();
|
|
|
|
|
2011-01-19 20:10:18 -06:00
|
|
|
}
|
|
|
|
});
|
2010-10-25 18:55:57 -05:00
|
|
|
|
2011-01-12 18:51:22 -06:00
|
|
|
test('Testing IPA.entity_set_search_definition().', function() {
|
2010-09-24 18:50:29 -05:00
|
|
|
|
|
|
|
var uid_callback = function() {
|
|
|
|
return true;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-03-18 15:43:54 -05:00
|
|
|
var entity = IPA.
|
|
|
|
entity_builder().
|
|
|
|
entity('user').
|
|
|
|
search_facet({
|
2011-04-18 10:59:50 -05:00
|
|
|
columns:['uid']}).
|
2011-03-18 15:43:54 -05:00
|
|
|
build();
|
|
|
|
entity.init();
|
|
|
|
|
|
|
|
var facet = entity.get_facet('search');
|
|
|
|
facet.init();
|
2011-04-07 16:14:58 -05:00
|
|
|
|
2011-04-11 13:49:36 -05:00
|
|
|
var container = $("<div/>");
|
2011-04-07 16:14:58 -05:00
|
|
|
|
2011-04-11 13:49:36 -05:00
|
|
|
entity.header = IPA.entity_header({entity:entity,container:container});
|
|
|
|
facet.entity_header = entity.header;
|
|
|
|
facet.create_content(facet.entity_header.content);
|
|
|
|
facet.setup(facet.entity_header.content);
|
2011-03-18 15:43:54 -05:00
|
|
|
|
2010-09-24 18:50:29 -05:00
|
|
|
|
2010-10-27 22:32:30 -05:00
|
|
|
var column = facet.get_columns()[0];
|
2010-09-24 18:50:29 -05:00
|
|
|
ok(
|
2010-10-27 22:32:30 -05:00
|
|
|
column,
|
|
|
|
'column is not null'
|
2010-09-24 18:50:29 -05:00
|
|
|
);
|
|
|
|
|
|
|
|
equals(
|
2010-10-27 22:32:30 -05:00
|
|
|
column.name, 'uid',
|
|
|
|
'column.name'
|
2010-09-24 18:50:29 -05:00
|
|
|
);
|
|
|
|
|
|
|
|
equals(
|
2011-03-18 15:43:54 -05:00
|
|
|
column.label, 'User login',
|
2010-10-27 22:32:30 -05:00
|
|
|
'column.label'
|
2010-09-24 18:50:29 -05:00
|
|
|
);
|
|
|
|
|
|
|
|
ok(
|
2010-10-27 22:32:30 -05:00
|
|
|
column.setup,
|
|
|
|
'column.setup not null'
|
2010-09-24 18:50:29 -05:00
|
|
|
);
|
|
|
|
|
|
|
|
});
|
|
|
|
|