forked from tsai/budibase
15 changed files with 177 additions and 186 deletions
@ -0,0 +1,22 @@ |
|||||
|
|
||||
|
context('Screen Tests', () => { |
||||
|
before(() => { |
||||
|
cy.visit('localhost:4001/_builder') |
||||
|
cy.createApp('Conor Cy App', 'Model App Description') |
||||
|
cy.navigateToFrontend() |
||||
|
}) |
||||
|
|
||||
|
it('Should successful create a screen', () => { |
||||
|
cy.createScreen("test Screen") |
||||
|
}) |
||||
|
|
||||
|
it('Should rename a screen', () => { |
||||
|
cy.get(".components-pane").within(() => { |
||||
|
cy.contains("Settings").click() |
||||
|
cy.get("input[name=_instanceName]").clear().type("About Us").blur() |
||||
|
}) |
||||
|
cy.get('.nav-items-container').within(() => { |
||||
|
cy.contains("About Us").should('exist') |
||||
|
}) |
||||
|
}) |
||||
|
}) |
||||
@ -1,53 +0,0 @@ |
|||||
import { getExactComponent } from "../src/components/userInterface/pagesParsing/searchComponents" |
|
||||
import { rename } from "../src/components/userInterface/pagesParsing/renameScreen" |
|
||||
import { componentsAndScreens } from "./testData" |
|
||||
|
|
||||
describe("rename component", () => { |
|
||||
it("should change the name of the component, duh", () => { |
|
||||
const { screens } = componentsAndScreens() |
|
||||
|
|
||||
const result = rename({}, screens, "PrimaryButton", "MainButton") |
|
||||
|
|
||||
const newComponent = getExactComponent(result.screens, "MainButton") |
|
||||
const oldComponent = getExactComponent(result.screens, "Primary") |
|
||||
expect(oldComponent).toBeUndefined() |
|
||||
expect(newComponent).toBeDefined() |
|
||||
expect(newComponent.name).toBe("MainButton") |
|
||||
}) |
|
||||
|
|
||||
/* this may be usefull if we have user defined components |
|
||||
it("should change name of nested _components", () => { |
|
||||
const {screens} = componentsAndScreens(); |
|
||||
const result = rename({}, screens, "PrimaryButton", "MainButton"); |
|
||||
|
|
||||
const buttonGroup = getExactComponent(result.screens, "ButtonGroup"); |
|
||||
expect(buttonGroup.props.header[0]._component).toBe("MainButton"); |
|
||||
|
|
||||
}); |
|
||||
*/ |
|
||||
|
|
||||
it("should change name of page appBody", () => { |
|
||||
const { screens } = componentsAndScreens() |
|
||||
const pages = { |
|
||||
main: { |
|
||||
appBody: "PrimaryButton", |
|
||||
}, |
|
||||
} |
|
||||
|
|
||||
const result = rename(pages, screens, "PrimaryButton", "MainButton") |
|
||||
expect(result.pages.main.appBody).toBe("MainButton") |
|
||||
}) |
|
||||
|
|
||||
/* this may be usefull if we have user defined components |
|
||||
it("should return a list of changed components", () => { |
|
||||
const {screens} = componentsAndScreens(); |
|
||||
const result = rename({}, screens, "PrimaryButton", "MainButton"); |
|
||||
|
|
||||
expect(result.changedScreens).toEqual(["ButtonGroup"]); |
|
||||
|
|
||||
const result2 = rename({}, screens, "common/SmallTextbox", "common/TinyTextBox"); |
|
||||
expect(result2.changedScreens).toEqual(["Field"]); |
|
||||
|
|
||||
}); |
|
||||
*/ |
|
||||
}) |
|
||||
Loading…
Reference in new issue