Files
metabuilder/packages/lua_test/components/ui.json
johndoe6345789 8c8f8cce8a feat: Add JSON Script Example and Lua Test Framework
- Created a new package for JSON Script Example with comprehensive examples demonstrating the full JSON script specification.
- Added permissions for viewing, executing, and modifying examples in the JSON Script Example package.
- Implemented functions for various expressions, statements, operators, and control flow in the JSON Script Example.
- Developed a Storybook configuration for showcasing JSON Script Examples with interactive components.
- Established a styles token file for consistent styling across the JSON Script Example package.
- Introduced a new Lua Test Framework package with components for running and displaying test results.
- Defined permissions for executing and viewing Lua test results, along with configuration and debugging capabilities.
- Implemented a comprehensive set of functions for the Lua testing framework, including assertions and mocks.
- Created Storybook stories for the Lua Test Framework to demonstrate the test runner and results display.
- Added a styles token file for the Lua Test Framework to ensure a cohesive design.
2026-01-02 16:42:39 +00:00

224 lines
7.0 KiB
JSON

{
"$schema": "https://metabuilder.dev/schemas/json-script-components.schema.json",
"schemaVersion": "2.0.0",
"package": "lua_test",
"description": "Lua testing framework UI components for test execution and results display",
"components": [
{
"id": "test_runner",
"name": "TestRunner",
"description": "Interactive test runner component for executing Lua tests",
"props": [
{
"name": "packageId",
"type": "string",
"required": true,
"description": "Package ID to test"
},
{
"name": "autoRun",
"type": "boolean",
"required": false,
"default": false,
"description": "Automatically run tests on mount"
},
{
"name": "filter",
"type": "string",
"required": false,
"description": "Filter tests by name pattern"
},
{
"name": "verbose",
"type": "boolean",
"required": false,
"default": true,
"description": "Show verbose output"
}
],
"render": {
"type": "element",
"template": {
"type": "Card",
"variant": "outlined",
"className": "test-runner",
"children": [
{
"type": "CardHeader",
"title": "Test Runner",
"subheader": "Package: {{packageId}}",
"action": {
"type": "IconButton",
"onClick": "{{onRun}}",
"children": [
{
"type": "Icon",
"name": "PlayArrow",
"color": "primary"
}
]
}
},
{
"type": "CardContent",
"children": [
{
"type": "Stack",
"spacing": 2,
"children": [
{
"type": "TextField",
"label": "Filter",
"placeholder": "Filter tests by name...",
"value": "{{filter}}",
"onChange": "{{onFilterChange}}",
"size": "small",
"fullWidth": true
},
{
"type": "FormControlLabel",
"control": {
"type": "Switch",
"checked": "{{verbose}}",
"onChange": "{{onVerboseChange}}"
},
"label": "Verbose output"
},
{
"type": "conditional",
"condition": "{{isRunning}}",
"then": {
"type": "LinearProgress",
"color": "primary"
}
}
]
}
]
}
]
}
}
},
{
"id": "test_results",
"name": "TestResults",
"description": "Displays test results in a formatted view with pass/fail indicators",
"props": [
{
"name": "results",
"type": "object",
"required": true,
"description": "Test results object from runner"
},
{
"name": "showDuration",
"type": "boolean",
"required": false,
"default": true,
"description": "Show test duration"
},
{
"name": "expandErrors",
"type": "boolean",
"required": false,
"default": true,
"description": "Expand error details by default"
}
],
"render": {
"type": "element",
"template": {
"type": "Card",
"variant": "outlined",
"className": "test-results",
"children": [
{
"type": "CardHeader",
"title": "Test Results",
"subheader": "{{results.summary}}"
},
{
"type": "CardContent",
"children": [
{
"type": "Stack",
"spacing": 1,
"children": [
{
"type": "Box",
"className": "results-summary",
"children": [
{
"type": "Flex",
"gap": 2,
"children": [
{
"type": "Chip",
"label": "{{results.passed}} passed",
"color": "success",
"size": "small"
},
{
"type": "Chip",
"label": "{{results.failed}} failed",
"color": "error",
"size": "small"
},
{
"type": "conditional",
"condition": "{{showDuration}}",
"then": {
"type": "Chip",
"label": "{{results.duration}}ms",
"variant": "outlined",
"size": "small"
}
}
]
}
]
},
{
"type": "Divider"
},
{
"type": "List",
"dense": true,
"children": {
"type": "for_each",
"items": "{{results.tests}}",
"as": "test",
"render": {
"type": "ListItem",
"children": [
{
"type": "ListItemIcon",
"children": [
{
"type": "Icon",
"name": "{{test.status === 'passed' ? 'CheckCircle' : 'Cancel'}}",
"color": "{{test.status === 'passed' ? 'success' : 'error'}}"
}
]
},
{
"type": "ListItemText",
"primary": "{{test.name}}",
"secondary": "{{test.duration}}ms"
}
]
}
}
}
]
}
]
}
]
}
}
}
]
}