Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the meta tag used for token or state #121

Merged
merged 5 commits into from
Feb 12, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix tests to work with new state
  • Loading branch information
hopsoft committed Feb 12, 2024
commit dbcaf3cd10aa7a606bd073fb37edc0d869f002c3
13 changes: 13 additions & 0 deletions .containers.example.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
organization:
name: turbo_boost

app:
name: turbo_boost-commands
directory: /path/to/turbo_boost-commands

docker:
directory: /path/to/turbo_boost-commands
compose_files:
- /path/to/turbo_boost-commands/docker-compose.yml
default_service: web
19 changes: 9 additions & 10 deletions test/system/basic_commands/turbo_boost_setup_test.rb
Original file line number Diff line number Diff line change
@@ -15,23 +15,22 @@ class TurboBoosSetupTest < ApplicationSystemTestCase
assert js("Array.isArray(TurboBoost.Commands.eventDelegates.find(e => e.name === 'submit').selectors)")
assert_equal "function", js("typeof TurboBoost.Commands.registerEventDelegate")
assert_equal "object", js("typeof TurboBoost.Commands.events")
assert_equal "object", js("typeof TurboBoost.state")
assert_equal "object", js("typeof TurboBoost.State")
assert_equal "object", js("typeof TurboBoost.Commands.logger")
assert_equal "debug", js("TurboBoost.Commands.logger.level")
end

test "turbo boost client state" do
page.goto basic_command_url

meta_element = page.wait_for_selector("meta#turbo-boost", state: "attached")
assert_equal "{}", meta_element["data-state"]
assert_equal 0, js("Object.keys(TurboBoost.state).length")
assert_equal 0, js("Object.values(TurboBoost.state).length")
assert js("TurboBoost.State.signed.length > 0")
assert_equal 0, js("Object.keys(TurboBoost.State.current).length")
assert_equal 0, js("Object.values(TurboBoost.State.current).length")

js("TurboBoost.state.test = true")
js("TurboBoost.state.example = 'value'")
assert js("TurboBoost.state.test")
assert_equal "value", js("TurboBoost.state.example")
assert_equal "value", js("TurboBoost.stateChanges.example")
js("TurboBoost.State.current.test = true")
js("TurboBoost.State.current.example = 'value'")
assert js("TurboBoost.State.current.test")
assert_equal "value", js("TurboBoost.State.current.example")
assert_equal "value", js("TurboBoost.State.changed.example")
end
end