Test a component
Try a component in the editor and in a published design, and find errors.
On this page
A component has two sides, so test both: the editor and the published design.
In the editor
- Put the files in the
publicfolder of UI Builder, for examplepublic/components/greeting/. - Import
editor.htmlwith Import custom. See Your first component. - Drag the component onto the canvas, open its settings and change every field.
- After you change a file, select Re-load components in the toolbar. The canvas is built again with the new code and the current design.
Test the component inside a Form if it holds a value, and with a component that follows it, such as To JSON with Read value from set to @ and its id.
In a published design
- Select Publish, then Download HTML.
- Put the downloaded page on the same server as the component, for example in
public/, and open it in the browser. - Use the component as a visitor would. Check the value, the validation and the outputs.
The published page loads render.html from the address that the design names, so a page opened from your disk cannot read a component on another server unless that server allows it (CORS).
Find errors
Open the console of your browser. UI Builder writes its messages there, starting with UIBuilder::
| Message | Cause |
|---|---|
The component "..." not found | The design uses a component that did not load, for example because its file has an error. |
Output "..." not found in the "..." component | instance.output() names an output that the component does not declare. In a published design, the declaration in render.html counts. |
Invalid component content (in the editor) | The address does not return a file with exports.id and exports.make. |
An error in the code of a component stops the component from loading, and the instances inside it are not shown. Use instance.error(err) to log an error with the name of the component and of the instance.
The app object of the page is available in the console as app: app.instances lists every instance, and app.find(id) returns one. See App reference.