lean4-htt/tests/server_interactive/userWidget.lean
Garmelon a3cb39eac9
chore: migrate more tests to new test suite (#12809)
This PR migrates most remaining tests to the new test suite. It also
completes the migration of directories like `tests/lean/run`, meaning
that PRs trying to add tests to those old directories will now fail.
2026-03-06 16:52:01 +00:00

38 lines
856 B
Text

import Lean
open Lean
@[widget_module]
def helloWidget : Widget.Module where
javascript := "
import * as React from 'react';
export default function(props) {
const name = props.name || 'world'
return React.createElement('p', {}, name + '!')
}"
#widget helloWidget
--^ widgets
structure HelloWidgetProps where
name? : Option String := none
deriving Server.RpcEncodable
#widget helloWidget with { name? := "lean" : HelloWidgetProps }
--^ widgets
show_panel_widgets [helloWidget with { name? := "global" : HelloWidgetProps }]
section
show_panel_widgets [local helloWidget with { name? := "local" : HelloWidgetProps }]
--^ widgets
end
namespace Foo
show_panel_widgets [scoped helloWidget with { name? := "scoped" : HelloWidgetProps }]
end Foo
open scoped Foo
--^ widgets
show_panel_widgets [-helloWidget]
--^ widgets