Skip to content

Commit

Permalink
Fix and add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bencroker committed Feb 22, 2025
1 parent 440ac29 commit 657c1c8
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 6 deletions.
1 change: 1 addition & 0 deletions site/routes_tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ func setupTests(ctx context.Context, router chi.Router) (err error) {
{ID: "select_single"},
{ID: "signals_change"},
{ID: "signals_change_path"},
{ID: "signals_change_path_once"},
},
},
}
Expand Down
2 changes: 1 addition & 1 deletion site/smoketests/key_casing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import (
"testing"
)

func TestKeyCasing(t *testing.T) {
func TestUnitKeyCasing(t *testing.T) {
setupPageTestOnLoad(t, "tests/key_casing")
}
2 changes: 1 addition & 1 deletion site/smoketests/local_signals_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import (
"testing"
)

func TestLocalSignals(t *testing.T) {
func TestUnitLocalSignals(t *testing.T) {
setupPageTestOnLoad(t, "tests/local_signals")
}
2 changes: 1 addition & 1 deletion site/smoketests/radio_input_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import (
"testing"
)

func TestRadioInput(t *testing.T) {
func TestUnitRadioInput(t *testing.T) {
setupPageTestOnClick(t, "tests/radio_input")
}
2 changes: 1 addition & 1 deletion site/smoketests/ref_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import (
"testing"
)

func TestRef(t *testing.T) {
func TestUnitRef(t *testing.T) {
setupPageTestOnLoad(t, "tests/ref")
}
9 changes: 9 additions & 0 deletions site/smoketests/signals_change_path_once_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package smoketests

import (
"testing"
)

func TestUnitSignalsChangePathOnce(t *testing.T) {
setupPageTestOnClick(t, "tests/signals_change_path_once")
}
2 changes: 1 addition & 1 deletion site/smoketests/signals_change_path_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import (
"testing"
)

func TestExampleSignalsChangePath(t *testing.T) {
func TestUnitSignalsChangePath(t *testing.T) {
setupPageTestOnClick(t, "tests/signals_change_path")
}
2 changes: 1 addition & 1 deletion site/smoketests/signals_change_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import (
"testing"
)

func TestExampleSignalsChange(t *testing.T) {
func TestUnitSignalsChange(t *testing.T) {
setupPageTestOnClick(t, "tests/signals_change")
}
12 changes: 12 additions & 0 deletions site/static/md/tests/signals_change_path_once.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Signals Change Path Once

Tests that a signal change with a path is detected and the expression is called once.

<div data-signals="{foo: {bar: 0}, result: 0}" data-on-signals-change-foo="$result++">
<button id="clickable" data-on-click="$foo.bar = 1" class="btn">Change</button>
<hr />
Result:
<code id="result" data-text="$result"></code>
<hr />
Expected result on click: <code>1</code>
</div>

0 comments on commit 657c1c8

Please sign in to comment.