-
Notifications
You must be signed in to change notification settings - Fork 291
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
02b90f9
commit 147611f
Showing
6 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
load("//build_defs:defaults.bzl", "py_library") | ||
|
||
package( | ||
default_visibility = ["//build_defs:mesop_internal"], | ||
) | ||
|
||
py_library( | ||
name = "e2e", | ||
srcs = glob(["*.py"]), | ||
deps = [ | ||
"//mesop", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import checkbox_app as checkbox_app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import mesop as me | ||
|
||
|
||
@me.stateclass | ||
class State: | ||
checked: bool = False | ||
|
||
|
||
@me.on(me.CheckboxEvent) | ||
def on_update(event: me.CheckboxEvent): | ||
state = me.state(State) | ||
state.checked = event.checked | ||
|
||
|
||
@me.page(path="/components/checkbox/e2e/checkbox_app") | ||
def app(): | ||
me.checkbox(label="checkbox", on_update=on_update) | ||
state = me.state(State) | ||
if state.checked: | ||
me.text(text="is checked") | ||
else: | ||
me.text(text="is not checked") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import {test, expect} from '@playwright/test'; | ||
|
||
test('test', async ({page}) => { | ||
await page.goto('/components/checkbox/e2e/checkbox_app'); | ||
expect(await page.getByText('is not checked').textContent()).toContain( | ||
'is not checked', | ||
); | ||
|
||
await page.getByRole('checkbox').check(); | ||
expect(await page.getByText('is checked').textContent()).toContain( | ||
'is checked', | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
from mesop.examples import index as index | ||
import mesop.components.text.e2e as text_e2e | ||
import mesop.components.box.e2e as box_e2e | ||
import mesop.components.checkbox.e2e as checkbox_e2e | ||
import mesop.components.text_input.e2e as text_input_e2e | ||
import mesop.components.markdown.e2e as markdown_e2e | ||
# REF(//scripts/gen_component.py):insert_component_e2e_import_export |