2019-07-28 09:03:11 +02:00
|
|
|
import {
|
2020-02-03 10:24:25 +01:00
|
|
|
searchAllComponents,
|
|
|
|
getExactComponent,
|
|
|
|
getAncestorProps,
|
2020-11-25 18:56:09 +01:00
|
|
|
} from "../src/components/userInterface/assetParsing/searchComponents"
|
2020-02-03 10:24:25 +01:00
|
|
|
import { componentsAndScreens } from "./testData"
|
|
|
|
|
2019-07-28 09:03:11 +02:00
|
|
|
|
|
|
|
describe("getExactComponent", () => {
|
2020-02-03 10:24:25 +01:00
|
|
|
it("should get component by name", () => {
|
2020-06-15 17:01:24 +02:00
|
|
|
const { components } = componentsAndScreens()
|
2020-02-03 10:24:25 +01:00
|
|
|
const result = getExactComponent(
|
2020-06-15 17:01:24 +02:00
|
|
|
components,
|
|
|
|
"TextBox"
|
2020-02-03 10:24:25 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
expect(result).toBeDefined()
|
2020-06-15 17:01:24 +02:00
|
|
|
expect(result._instanceName).toBe("TextBox")
|
2020-02-03 10:24:25 +01:00
|
|
|
})
|
|
|
|
|
2020-06-15 17:01:24 +02:00
|
|
|
test("Should not find as isScreen is not specified", () => {
|
|
|
|
const { screens } = componentsAndScreens()
|
|
|
|
const result = getExactComponent(screens, "SmallTextbox")
|
2020-02-03 10:24:25 +01:00
|
|
|
|
|
|
|
expect(result).not.toBeDefined()
|
|
|
|
})
|
2019-07-28 09:03:11 +02:00
|
|
|
|
2020-06-15 17:01:24 +02:00
|
|
|
test("Should find as isScreen is specified", () => {
|
|
|
|
const { screens } = componentsAndScreens()
|
|
|
|
const result = getExactComponent(screens, "SmallTextbox", true)
|
|
|
|
|
|
|
|
expect(result).toBeDefined()
|
|
|
|
expect(result.props._instanceName).toBe("SmallTextbox")
|
2020-02-03 10:24:25 +01:00
|
|
|
|
|
|
|
})
|
2020-06-15 17:01:24 +02:00
|
|
|
})
|
2020-02-03 10:24:25 +01:00
|
|
|
|