addMappingTest.js revision d1a2899a06be1eab885056aeda85adcd67c010b0
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne * Copyright (c) 2014 ForgeRock AS. All Rights Reserved
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne * The contents of this file are subject to the terms
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne * of the Common Development and Distribution License
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne * (the License). You may not use this file except in
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne * compliance with the License.
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne * You can obtain a copy of the License at
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne * See the License for the specific language governing
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne * permission and limitations under the License.
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne * When distributing Covered Code, include this CDDL
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne * Header Notice in each file and include the License file
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne * at http://forgerock.org/license/CDDLv1.0.html
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne * If applicable, add the following below the CDDL Header,
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne * with the fields enclosed by brackets [] replaced by
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne * your own identifying information:
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne * "Portions Copyrighted [year] [name of copyright owner]"
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne/*global require, define, QUnit, $ */
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne "org/forgerock/commons/ui/common/util/Constants",
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne "org/forgerock/commons/ui/common/main/EventManager",
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne "org/forgerock/openidm/ui/admin/mapping/AddMappingView",
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne "org/forgerock/openidm/ui/admin/ResourcesView",
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne], function (constants, router, eventManager, addMappingView, resourcesView, adminInit, addMapping) {
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne QUnit.asyncTest("Add Mapping View", function () {
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne QUnit.equal(addMappingView.$el.find(".title-bar a").length, 1, "Help successfully detected");
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne QUnit.equal(addMappingView.$el.find("#resourceConnectorContainer .resource-body").length, 1, "Resources successfully loaded");
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne QUnit.equal(addMappingView.$el.find("#resourceManagedContainer .resource-body").length, 4, "Managed Objects successfully loaded");
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne addMappingView.$el.find("#resourceConnectorContainer .resource-body:first .add-resource-button").trigger("click");
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne addMappingView.$el.find("#resourceManagedContainer .resource-body:first .add-resource-button").trigger("click");
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne console.log(addMappingView.$el.find("#mappingSource .mapping-resource").html());
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne QUnit.equal(addMappingView.$el.find("#mappingSource .mapping-resource:visible").length, 1, "Add mapping source successful");
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne QUnit.equal(addMappingView.$el.find("#mappingTarget .mapping-resource:visible").length, 1, "Add target source successful");
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne QUnit.equal(addMappingView.$el.find("#mappingTarget .mapping-resource:visible").length, 1, "Add target source successful");
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne addMappingView.$el.find(".mapping-swap").trigger("click");
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne QUnit.equal(addMappingView.$el.find("#mappingTarget .mapping-resource select").length, 1, "Swap successful");
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne addMappingView.$el.find(".add-mapping").trigger("click");
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne QUnit.equal($(".ui-dialog").length, 1, "Create mapping dialog successfully shown");
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne QUnit.ok($(".ui-dialog #mappingName").length > 0, "Mapping name auto generated successfully");
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne $(".ui-dialog .ui-dialog-buttonset .ui-button:first").trigger("click");
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne QUnit.equal($(".ui-dialog").length, 0, "Create mapping dialog closed");
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne addMappingView.$el.find("#mappingSource .select-resource").trigger("click");
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne addMappingView.$el.find("#mappingTarget .select-resource").trigger("click");
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne QUnit.equal(addMappingView.$el.find("#mappingSource .mapping-resource-empty:visible").length, 1, "Removal of source successful");
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne QUnit.equal(addMappingView.$el.find("#mappingTarget .mapping-resource-empty:visible").length, 1, "Removal of target successful");