ListTests.js revision 89092dc10fe08b037266c0b4efb94b221f6fffb3
0N/A/**
3158N/A * The contents of this file are subject to the terms of the Common Development and
0N/A * Distribution License (the License). You may not use this file except in compliance with the
0N/A * License.
0N/A *
0N/A * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
0N/A * specific language governing permission and limitations under the License.
0N/A *
0N/A * When distributing Covered Software, include this CDDL Header Notice in each file and include
0N/A * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
0N/A * Header, with the fields enclosed by brackets [] replaced by your own identifying
0N/A * information: "Portions copyright [year] [name of copyright owner]".
0N/A *
0N/A * Copyright 2015 ForgeRock AS.
0N/A */
0N/A
0N/A/*global require, define, QUnit, $ */
0N/A
1472N/Adefine([
1472N/A "org/forgerock/openam/ui/policy/applications/ApplicationsListView",
1472N/A "org/forgerock/openam/ui/policy/policies/PoliciesListView",
0N/A "org/forgerock/openam/ui/policy/resourcetypes/ResourceTypesListView",
0N/A "org/forgerock/commons/ui/common/main/Configuration"
0N/A], function (ApplicationsListView, PolicyListView, ResourceTypesListView, Configuration) {
1879N/A
1879N/A return {
1879N/A executeAll: function () {
1879N/A QUnit.module('List Views');
1879N/A
1879N/A QUnit.asyncTest('List Applications', function () {
1879N/A ApplicationsListView.element = $('<div>')[0];
1879N/A $('#qunit-fixture').append(ApplicationsListView.element);
1879N/A
1879N/A ApplicationsListView.render([], function () {
1879N/A QUnit.ok(Configuration.globalData.policyEditor, 'Configuration file loaded');
1879N/A
1879N/A QUnit.equal($('#gridToolbar', ApplicationsListView.$el).find('.btn:first-of-type').text().trim(),
1879N/A $.t('policy.applications.list.add'), 'Add New button is present');
1879N/A QUnit.equal($('#deleteRecords', ApplicationsListView.$el).length, 1, 'Delete Selected button is present');
1879N/A QUnit.equal($('#importPolicies', ApplicationsListView.$el).length, 1, 'Import Policies button is present');
1879N/A QUnit.equal($('#exportPolicies', ApplicationsListView.$el).length, 1, 'Export Policies button is present');
1879N/A
0N/A QUnit.ok($('#deleteRecords', ApplicationsListView.$el).hasClass('disabled'), 'Delete Selected button is disabled');
0N/A
0N/A QUnit.ok($('#backgridContainer', ApplicationsListView.$el).html() !== '', 'Grid is present');
524N/A QUnit.ok($('#paginationContainer', ApplicationsListView.$el).html() !== '', 'Pagination is present');
524N/A QUnit.ok(ApplicationsListView.data.items.models.length > 0, 'Collection is not empty');
0N/A
0N/A QUnit.start();
4012N/A });
0N/A });
0N/A
4012N/A QUnit.asyncTest('List Policies', function () {
0N/A PolicyListView.element = $('<div>')[0];
0N/A $('#qunit-fixture').append(PolicyListView.element);
0N/A
0N/A PolicyListView.render(['iPlanetAMWebAgentService'], function () {
0N/A QUnit.ok(Configuration.globalData.policyEditor, 'Configuration file loaded');
0N/A
0N/A QUnit.equal($('.page-header', PolicyListView.$el).find('.btn').length, 1, "Back button is available");
0N/A
4012N/A QUnit.equal($('#gridToolbar', PolicyListView.$el).find('.btn:first-of-type').text().trim(),
4012N/A $.t('policy.policies.list.add'), 'Add New button is present');
4012N/A QUnit.equal($('#deleteRecords', PolicyListView.$el).length, 1, 'Delete Selected button is present');
4012N/A
4012N/A QUnit.ok($('#deleteRecords', PolicyListView.$el).hasClass('disabled'), 'Delete Selected button is disabled');
4012N/A
4012N/A QUnit.ok($('#backgridContainer', PolicyListView.$el).html() !== '', 'Grid is present');
4012N/A QUnit.ok($('#paginationContainer', PolicyListView.$el).html() !== '', 'Pagination is present');
4012N/A QUnit.ok(PolicyListView.data.items.models.length > 0, 'Collection is not empty');
4012N/A
0N/A QUnit.start();
0N/A });
0N/A });
0N/A
0N/A QUnit.asyncTest('List Resource Types', function () {
0N/A ResourceTypesListView.element = $('<div>')[0];
0N/A $('#qunit-fixture').append(ResourceTypesListView.element);
0N/A
0N/A ResourceTypesListView.render([], function () {
0N/A QUnit.ok(Configuration.globalData.policyEditor, 'Configuration file loaded');
0N/A
0N/A QUnit.equal($('#gridToolbar', ResourceTypesListView.$el).find('.btn:first-of-type').text().trim(),
0N/A $.t('policy.resourceTypes.list.add'), 'Add New button is present');
0N/A QUnit.equal($('#deleteRecords', ResourceTypesListView.$el).length, 1, 'Delete Selected button is present');
4012N/A
0N/A QUnit.ok($('#deleteRecords', ResourceTypesListView.$el).hasClass('disabled'), 'Delete Selected button is disabled');
0N/A
0N/A QUnit.ok($('#backgridContainer', ResourceTypesListView.$el).html() !== '', 'Grid is present');
0N/A QUnit.ok($('#paginationContainer', ResourceTypesListView.$el).html() !== '', 'Pagination is present');
4012N/A QUnit.ok(ResourceTypesListView.data.items.models.length > 0, 'Collection is not empty');
4012N/A
0N/A QUnit.start();
0N/A });
0N/A });
0N/A }
0N/A }
0N/A});