wasp/test/Parser/valid.wasp

81 lines
1.5 KiB
Plaintext
Raw Normal View History

2019-04-19 16:22:14 +03:00
// Test .wasp file.
import something from "some/file"
// App definition.
2019-04-19 16:22:14 +03:00
app test_app {
// Title of the app.
title: "Hello World!"
}
// Page definition.
page Landing {
2019-05-31 20:35:50 +03:00
route: "/",
content: {=jsx
<div>
My landing page! I have { this.props.taskList.length } tasks.
<div>
<TaskCreateForm
onCreate={task => this.props.addTask(task)}
submitButtonLabel={'Create new task'}
/>
</div>
My tasks
<TaskList />
</div>
jsx=},
style: {=css
div {
color: red
}
css=}
2019-05-31 20:35:50 +03:00
}
page TestPage {
route: "/test",
content: {=jsx
<div>This is a test page!</div>
jsx=},
style: "test.css"
}
2019-05-09 23:05:59 +03:00
// Entity definition.
entity Task {
description :: string,
isDone :: boolean
}
// NOTE(matija): this is only being parsed for now, no code is generated yet.
// Entity form definition.
entity-form<Task> CreateTaskForm {
fields: {
description: {
show: true,
defaultValue: "doable task",
placeholder: "What will you do?"
},
isDone: {
show: false,
defaultValue: false // Although not shown, this field will be set to "false".
}
},
submit: {
onEnter: false,
button: {
show: true
}
}
}
entity-list<Task> TaskList {
fields: {
description: {
render: {=js
task => task.description
js=}
}
}
}