Bug 38201: Update unit tests for split pane mode
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
3269381e8a
commit
040550bed8
|
|
@ -481,8 +481,8 @@ export function useBaseResource(resourceConfig) {
|
|||
if (splitScreenGrouping) {
|
||||
groupInfo.splitPane = splitScreenGrouping.pane;
|
||||
} else {
|
||||
// Default to left
|
||||
groupInfo.splitPane = "left";
|
||||
// Default to first pane
|
||||
groupInfo.splitPane = 1;
|
||||
}
|
||||
}
|
||||
if (component === "Show" && resource) {
|
||||
|
|
|
|||
|
|
@ -342,6 +342,31 @@ describe("useBaseResource - resource display methods", () => {
|
|||
expect(thirdGroup.fields[0].name).to.equal("showField");
|
||||
});
|
||||
});
|
||||
it("getFieldGroupings - show with field groups and splitScreen mode enabled", () => {
|
||||
globalConfig.props.resourceConfig.resourceAttrs =
|
||||
cy.getResourceAttrsWithGroups();
|
||||
globalConfig.props.resourceConfig.showGroupsDisplayMode = "splitScreen";
|
||||
globalConfig.props.resourceConfig.splitScreenGroupings = [
|
||||
{ name: "Group 1", pane: 1 },
|
||||
{ name: "Group 2", pane: 2 },
|
||||
{ name: "Group 3", pane: 2 },
|
||||
];
|
||||
cy.mount(UseBaseResource, globalConfig).then(({ component }) => {
|
||||
const baseResource = component.result;
|
||||
const getFieldGroupings = baseResource.getFieldGroupings;
|
||||
const fieldGroupings = getFieldGroupings("Show", {
|
||||
name: "A name value",
|
||||
showField: "test",
|
||||
displayName: "test",
|
||||
});
|
||||
const firstGroup = fieldGroupings[0];
|
||||
expect(firstGroup.splitPane).to.equal(2);
|
||||
const secondGroup = fieldGroupings[1];
|
||||
expect(secondGroup.splitPane).to.equal(2);
|
||||
const thirdGroup = fieldGroupings[2];
|
||||
expect(thirdGroup.splitPane).to.equal(1);
|
||||
});
|
||||
});
|
||||
it("getResource", () => {
|
||||
cy.mount(UseBaseResource, globalConfig).then(({ component }) => {
|
||||
const baseResource = component.result;
|
||||
|
|
|
|||
|
|
@ -265,12 +265,14 @@ describe("Show view features", () => {
|
|||
{ vendor: this.vendor, basket: this.basket },
|
||||
]);
|
||||
});
|
||||
it("Should allow accordion view", function () {
|
||||
it("Should allow split screen view", function () {
|
||||
cy.get("@vendor").then(vendor => {
|
||||
cy.visit(`/cgi-bin/koha/acquisition/vendors/${vendor.id}`);
|
||||
cy.get("div.accordion").should("have.length", 2);
|
||||
cy.get("div.accordion:first legend").contains("Details");
|
||||
cy.get("div.accordion").eq(1).contains("Ordering information");
|
||||
cy.get("div.row").should("exist");
|
||||
cy.get("div.col-sm-6:first fieldset.rows:first legend").contains(
|
||||
"Details"
|
||||
);
|
||||
cy.get("div.col-sm-6").eq(1).should("exist");
|
||||
});
|
||||
});
|
||||
it("Should append to show when the method is included in the resource", function () {
|
||||
|
|
@ -280,8 +282,7 @@ describe("Show view features", () => {
|
|||
values: [vendor.id, "Test contract"],
|
||||
}).then(() => {
|
||||
cy.visit(`/cgi-bin/koha/acquisition/vendors/${vendor.id}`);
|
||||
cy.get("div.accordion").should("have.length", 3);
|
||||
cy.get("div.accordion").eq(2).contains("Contracts");
|
||||
cy.get("fieldset.rows").eq(2).contains("Contracts");
|
||||
cy.get("#contracts_relationship_list").contains(
|
||||
"Test contract"
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in New Issue