shoelace-rails 0.4.1 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/main.yml +11 -61
  3. data/.gitignore +1 -6
  4. data/Appraisals +6 -0
  5. data/CHANGELOG.md +22 -5
  6. data/Gemfile +0 -3
  7. data/Rakefile +2 -17
  8. data/app/helpers/shoelace/form_helper.rb +63 -14
  9. data/gemfiles/rails_60.gemfile +0 -1
  10. data/gemfiles/rails_61.gemfile +0 -1
  11. data/gemfiles/rails_70.gemfile +0 -1
  12. data/gemfiles/rails_71.gemfile +10 -0
  13. data/gemfiles/rails_edge.gemfile +0 -1
  14. data/lib/shoelace/rails/version.rb +1 -1
  15. data/shoelace-rails.gemspec +1 -1
  16. data/test/helpers/form_helper_test.rb +40 -11
  17. data/test/helpers/translation_test.rb +160 -0
  18. metadata +7 -58
  19. data/dist/.keep +0 -0
  20. data/dist/types/.keep +0 -0
  21. data/package.json +0 -50
  22. data/rollup.config.js +0 -49
  23. data/src/index.ts +0 -2
  24. data/src/turbo/index.ts +0 -6
  25. data/src/turbo/polyfills/formdata-event.js +0 -27
  26. data/src/turbo/sl-turbo-form.ts +0 -110
  27. data/src/turbolinks/features/confirm.ts +0 -42
  28. data/src/turbolinks/features/disable.ts +0 -94
  29. data/src/turbolinks/features/remote.ts +0 -107
  30. data/src/turbolinks/index.ts +0 -6
  31. data/src/turbolinks/selectors.ts +0 -38
  32. data/src/turbolinks/start.ts +0 -38
  33. data/src/turbolinks/turbolinks.ts +0 -78
  34. data/src/turbolinks/utils/ajax.ts +0 -146
  35. data/src/turbolinks/utils/csp.ts +0 -20
  36. data/src/turbolinks/utils/csrf.ts +0 -33
  37. data/src/turbolinks/utils/dom.ts +0 -40
  38. data/src/turbolinks/utils/event.ts +0 -57
  39. data/src/turbolinks/utils/form.ts +0 -58
  40. data/test/dummy_app/Gemfile +0 -19
  41. data/test/dummy_app/Rakefile +0 -6
  42. data/test/dummy_app/app/controllers/hotwire_forms_controller.rb +0 -46
  43. data/test/dummy_app/app/controllers/turbolinks_forms_controller.rb +0 -37
  44. data/test/dummy_app/app/models/user.rb +0 -16
  45. data/test/dummy_app/app/packs/entrypoints/hotwire.js +0 -1
  46. data/test/dummy_app/app/packs/entrypoints/turbolinks.js +0 -5
  47. data/test/dummy_app/app/views/hotwire_forms/form.html.erb +0 -45
  48. data/test/dummy_app/app/views/hotwire_forms/show.html.erb +0 -5
  49. data/test/dummy_app/app/views/layouts/application.html.erb +0 -39
  50. data/test/dummy_app/app/views/turbolinks_forms/form.html.erb +0 -44
  51. data/test/dummy_app/app/views/turbolinks_forms/show.html.erb +0 -5
  52. data/test/dummy_app/bin/rails +0 -5
  53. data/test/dummy_app/bin/webpack +0 -18
  54. data/test/dummy_app/bin/yarn +0 -18
  55. data/test/dummy_app/config/application.rb +0 -16
  56. data/test/dummy_app/config/boot.rb +0 -4
  57. data/test/dummy_app/config/environment.rb +0 -2
  58. data/test/dummy_app/config/environments/development.rb +0 -10
  59. data/test/dummy_app/config/environments/test.rb +0 -18
  60. data/test/dummy_app/config/routes.rb +0 -4
  61. data/test/dummy_app/config/webpack/development.js +0 -5
  62. data/test/dummy_app/config/webpack/production.js +0 -1
  63. data/test/dummy_app/config/webpack/test.js +0 -5
  64. data/test/dummy_app/config/webpacker.yml +0 -33
  65. data/test/dummy_app/config.ru +0 -6
  66. data/test/dummy_app/package.json +0 -24
  67. data/test/dummy_app/test/system/hotwire_form_test.rb +0 -63
  68. data/test/dummy_app/test/system/turbolinks_form_test.rb +0 -38
  69. data/test/dummy_app/test/test_helper.rb +0 -68
  70. data/tsconfig.json +0 -19
  71. data/yarn.lock +0 -249
@@ -1,58 +0,0 @@
1
- // This code was heavily inspired by the rails-ujs project.
2
- // Copyright (c) 2007-2021 Rails Core team.
3
- import { matches } from "./dom"
4
-
5
- const toArray = (e) => Array.prototype.slice.call(e)
6
-
7
- export const serializeElement = (element, additionalParam) => {
8
- let inputs = [element]
9
- if (matches(element, "form")) {
10
- inputs = toArray(element.elements)
11
- }
12
- const params = []
13
-
14
- inputs.forEach(function (input) {
15
- if (!input.name || input.disabled) {
16
- return
17
- }
18
-
19
- if (matches(input, "fieldset[disabled] *")) {
20
- return
21
- }
22
-
23
- if (matches(input, "select")) {
24
- return toArray(input.options).forEach(function (option) {
25
- if (option.selected) {
26
- return params.push({ name: input.name, value: option.value })
27
- }
28
- })
29
- } else if (input.checked || ["radio", "checkbox", "submit"].indexOf(input.type) === -1) {
30
- return params.push({ name: input.name, value: input.value })
31
- }
32
- })
33
-
34
- if (additionalParam) {
35
- params.push(additionalParam)
36
- }
37
-
38
- return params
39
- .map(function (param) {
40
- if (param.name != null) {
41
- return `${encodeURIComponent(param.name)}=${encodeURIComponent(param.value)}`
42
- } else {
43
- return param
44
- }
45
- })
46
- .join("&")
47
- }
48
-
49
- // Helper function that returns form elements that match the specified CSS selector
50
- // If form is actually a "form" element this will return associated elements outside the from that have
51
- // the html form attribute set
52
- export const formElements = (form, selector) => {
53
- if (matches(form, "form")) {
54
- return toArray(form.elements).filter((el) => matches(el, selector))
55
- } else {
56
- return toArray(form.querySelectorAll(selector))
57
- }
58
- }
@@ -1,19 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'rails', '~> 7.0.0'
4
- gem 'webrick'
5
- gem 'bootsnap', '>= 1.4.4', require: false
6
- gem 'rexml'
7
- gem 'shoelace-rails', path: '../../../shoelace-rails'
8
- gem 'webpacker', '6.0.0.rc.5'
9
-
10
- group :development, :test do
11
- gem 'pry-byebug'
12
- end
13
-
14
- group :test do
15
- gem 'capybara', '>= 3.26'
16
- gem 'capybara-shadowdom'
17
- gem 'selenium-webdriver', '>= 4.0.0.rc3'
18
- gem 'webdrivers'
19
- end
@@ -1,6 +0,0 @@
1
- # Add your own tasks in files placed in lib/tasks ending in .rake,
2
- # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
-
4
- require_relative "config/application"
5
-
6
- Rails.application.load_tasks
@@ -1,46 +0,0 @@
1
- class HotwireFormsController < ActionController::Base
2
- layout "application"
3
-
4
- def show
5
- @user = User.new(session[:user])
6
- end
7
-
8
- # GET /users/new
9
- def new
10
- @user = User.new(params[:user]&.permit!)
11
-
12
- render 'form'
13
- end
14
-
15
- # GET /users/1/edit
16
- def edit
17
- @user = User.new(name: "Yuki Nishijima")
18
-
19
- render 'form'
20
- end
21
-
22
- # POST /users
23
- def create
24
- @user = User.new(user_params)
25
-
26
- if @user.valid?
27
- session[:user] = user_params.to_h
28
- redirect_to hotwire_form_path(1)
29
- else
30
- render 'form', status: 422
31
- end
32
- end
33
-
34
- # PATCH/PUT /users/1
35
- def update
36
- @user = User.new(user_params)
37
-
38
- render(@user.valid? ? 'show' : 'form')
39
- end
40
-
41
- private
42
-
43
- def user_params
44
- params.require(:user).permit!
45
- end
46
- end
@@ -1,37 +0,0 @@
1
- class TurbolinksFormsController < ActionController::Base
2
- layout "application"
3
-
4
- # GET /users/new
5
- def new
6
- @user = User.new
7
-
8
- render 'form'
9
- end
10
-
11
- # GET /users/1/edit
12
- def edit
13
- @user = User.new(name: "Yuki Nishijima")
14
-
15
- render 'form'
16
- end
17
-
18
- # POST /users
19
- def create
20
- @user = User.new(user_params)
21
-
22
- render(@user.valid? ? 'show' : 'form')
23
- end
24
-
25
- # PATCH/PUT /users/1
26
- def update
27
- @user = User.new(user_params)
28
-
29
- render(@user.valid? ? 'show' : 'form')
30
- end
31
-
32
- private
33
-
34
- def user_params
35
- params.require(:user).permit!
36
- end
37
- end
@@ -1,16 +0,0 @@
1
- class User
2
- include ActiveModel::Model
3
- include ActiveModel::Attributes
4
-
5
- attribute :name
6
- attribute :description
7
- attribute :color
8
- attribute :score
9
- attribute :current_city
10
- attribute :previous_city
11
- attribute :past_cities
12
- attribute :remember_me
13
- attribute :subscribe_to_emails
14
-
15
- validates :name, presence: true
16
- end
@@ -1 +0,0 @@
1
- import "@hotwired/turbo-rails"
@@ -1,5 +0,0 @@
1
- import Turbolinks from "turbolinks"
2
- import Rails from '@rails/ujs'
3
-
4
- Turbolinks.start()
5
- Rails.start()
@@ -1,45 +0,0 @@
1
- <% locations = { tokyo: "Tokyo", new_york: "New York", london: "London" } %>
2
- <%= sl_form_for(@user, url: hotwire_forms_path) do |form| %>
3
- <div>
4
- <%= form.text_field :name do %>
5
- <span slot="help-text" style="color: rgb(var(--sl-color-danger-600));">
6
- <%= @user.errors.full_messages_for(:name).first %>
7
- </span>
8
- <% end %>
9
- </div>
10
-
11
- <div>
12
- <%= form.color_field :color %>
13
- </div>
14
-
15
- <div>
16
- <%= form.range_field :score, min: 0, max: 100, step: 1 %>
17
- </div>
18
-
19
- <div>
20
- <%= form.collection_radio_buttons :current_city, locations, :first, :last %>
21
- </div>
22
-
23
- <div>
24
- <%= form.collection_select :previous_city, locations, :first, :last, {}, { placeholder: "Select one" } %>
25
- </div>
26
-
27
- <div>
28
- <%= form.collection_select :past_cities, locations, :first, :last, {}, { placeholder: "Select two or more", multiple: true, clearable: true } %>
29
- </div>
30
-
31
- <div>
32
- <%= form.check_box :remember_me %>
33
- </div>
34
-
35
- <div>
36
- <%= form.switch_field :subscribe_to_emails, value: "1" %>
37
- </div>
38
-
39
- <div>
40
- <%= form.text_area :description %>
41
- </div>
42
-
43
- <%= form.submit %>
44
- <%= form.submit "Submit without Turbo", data: { turbo: false } %>
45
- <% end %>
@@ -1,5 +0,0 @@
1
- <% @user.attributes.each do |attribute_name, value| %>
2
- <div>
3
- <%= attribute_name.titleize %>: <%= value %>
4
- </div>
5
- <% end %>
@@ -1,39 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>Shoelace Test</title>
5
- <meta name="viewport" content="width=device-width,initial-scale=1">
6
- <%= csrf_meta_tags %>
7
- <%= csp_meta_tag %>
8
-
9
- <style>
10
- body {
11
- font-family: var(--sl-font-sans);
12
- font-size: var(--sl-font-size-medium);
13
- font-weight: var(--sl-font-weight-normal);
14
- letter-spacing: var(--sl-letter-spacing-normal);
15
- color: var(--sl-color-gray-800);
16
- line-height: var(--sl-line-height-normal);
17
- }
18
-
19
- sl-form div, sl-turbo-form div {
20
- margin-bottom: 2em;
21
- }
22
- </style>
23
-
24
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.0.0-beta.88/dist/themes/light.css">
25
- <script type="module" src="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.0.0-beta.88/dist/shoelace.js"></script>
26
-
27
- <% if request.path.include?("hotwire") %>
28
- <%= javascript_pack_tag 'hotwire' %>
29
- <% else %>
30
- <%= javascript_pack_tag 'turbolinks' %>
31
- <% end %>
32
- </head>
33
-
34
- <body>
35
- <div style="width: 950px; margin: auto">
36
- <%= yield %>
37
- </div>
38
- </body>
39
- </html>
@@ -1,44 +0,0 @@
1
- <% locations = { tokyo: "Tokyo", new_york: "New York", london: "London" } %>
2
- <%= sl_form_for(@user, url: turbolinks_forms_path) do |form| %>
3
- <div>
4
- <%= form.text_field :name do %>
5
- <span slot="help-text" style="color: rgb(var(--sl-color-danger-600));">
6
- <%= @user.errors.full_messages_for(:name).first %>
7
- </span>
8
- <% end %>
9
- </div>
10
-
11
- <div>
12
- <%= form.color_field :color %>
13
- </div>
14
-
15
- <div>
16
- <%= form.range_field :score, min: 0, max: 100, step: 1 %>
17
- </div>
18
-
19
- <div>
20
- <%= form.collection_radio_buttons :current_city, locations, :first, :last %>
21
- </div>
22
-
23
- <div>
24
- <%= form.collection_select :previous_city, locations, :first, :last, {}, { placeholder: "Select one" } %>
25
- </div>
26
-
27
- <div>
28
- <%= form.collection_select :past_cities, locations, :first, :last, {}, { placeholder: "Select two or more", multiple: true, clearable: true } %>
29
- </div>
30
-
31
- <div>
32
- <%= form.check_box :remember_me %>
33
- </div>
34
-
35
- <div>
36
- <%= form.switch_field :subscribe_to_emails, value: "1" %>
37
- </div>
38
-
39
- <div>
40
- <%= form.text_area :description %>
41
- </div>
42
-
43
- <%= form.submit %>
44
- <% end %>
@@ -1,5 +0,0 @@
1
- <% @user.attributes.each do |attribute_name, value| %>
2
- <div>
3
- <%= attribute_name.titleize %>: <%= value %>
4
- </div>
5
- <% end %>
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- APP_PATH = File.expand_path('../config/application', __dir__)
4
- require_relative "../config/boot"
5
- require "rails/commands"
@@ -1,18 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
4
- ENV["NODE_ENV"] ||= "development"
5
-
6
- require "pathname"
7
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
8
- Pathname.new(__FILE__).realpath)
9
-
10
- require "bundler/setup"
11
-
12
- require "webpacker"
13
- require "webpacker/webpack_runner"
14
-
15
- APP_ROOT = File.expand_path("..", __dir__)
16
- Dir.chdir(APP_ROOT) do
17
- Webpacker::WebpackRunner.run(ARGV)
18
- end
@@ -1,18 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- APP_ROOT = File.expand_path("..", __dir__)
4
- Dir.chdir(APP_ROOT) do
5
- yarn = ENV["PATH"].split(File::PATH_SEPARATOR).
6
- select { |dir| File.expand_path(dir) != __dir__ }.
7
- product(["yarn", "yarnpkg", "yarn.cmd", "yarn.ps1"]).
8
- map { |dir, file| File.expand_path(file, dir) }.
9
- find { |file| File.executable?(file) }
10
-
11
- if yarn
12
- exec yarn, *ARGV
13
- else
14
- $stderr.puts "Yarn executable was not detected in the system."
15
- $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
16
- exit 1
17
- end
18
- end
@@ -1,16 +0,0 @@
1
- require_relative "boot"
2
-
3
- require "rails"
4
- require "active_model/railtie"
5
- require "action_controller/railtie"
6
- require "action_view/railtie"
7
- require "rails/test_unit/railtie"
8
-
9
- Bundler.require(*Rails.groups)
10
-
11
- module ShoelaceTest
12
- class Application < Rails::Application
13
- config.load_defaults 6.1
14
- Rails.backtrace_cleaner.remove_silencers! if ENV["BACKTRACE"]
15
- end
16
- end
@@ -1,4 +0,0 @@
1
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
2
-
3
- require "bundler/setup"
4
- require "bootsnap/setup"
@@ -1,2 +0,0 @@
1
- require_relative "application"
2
- Rails.application.initialize!
@@ -1,10 +0,0 @@
1
- Rails.application.configure do
2
- config.cache_classes = false
3
- config.eager_load = false
4
- config.consider_all_requests_local = true
5
- config.action_controller.perform_caching = false
6
- config.cache_store = :null_store
7
- config.active_support.deprecation = :log
8
- config.active_support.disallowed_deprecation = :raise
9
- config.active_support.disallowed_deprecation_warnings = []
10
- end
@@ -1,18 +0,0 @@
1
- require "active_support/core_ext/integer/time"
2
-
3
- Rails.application.configure do
4
- config.cache_classes = true
5
- config.eager_load = false
6
- config.public_file_server.enabled = true
7
- config.public_file_server.headers = {
8
- 'Cache-Control' => "public, max-age=#{1.hour.to_i}"
9
- }
10
- config.consider_all_requests_local = true
11
- config.action_controller.perform_caching = false
12
- config.cache_store = :null_store
13
- config.action_dispatch.show_exceptions = false
14
- config.action_controller.allow_forgery_protection = false
15
- config.active_support.deprecation = :stderr
16
- config.active_support.disallowed_deprecation = :raise
17
- config.active_support.disallowed_deprecation_warnings = []
18
- end
@@ -1,4 +0,0 @@
1
- Rails.application.routes.draw do
2
- resources :hotwire_forms
3
- resources :turbolinks_forms
4
- end
@@ -1,5 +0,0 @@
1
- process.env.NODE_ENV = process.env.NODE_ENV || 'development'
2
-
3
- const { webpackConfig } = require('@rails/webpacker')
4
-
5
- module.exports = webpackConfig
@@ -1 +0,0 @@
1
- test.js
@@ -1,5 +0,0 @@
1
- process.env.NODE_ENV = process.env.NODE_ENV || 'development'
2
-
3
- const { webpackConfig } = require('@rails/webpacker')
4
-
5
- module.exports = webpackConfig
@@ -1,33 +0,0 @@
1
- default: &default
2
- source_path: app/packs
3
- source_entry_path: entrypoints
4
- public_root_path: public
5
- public_output_path: packs
6
- cache_path: tmp/webpacker
7
- webpack_compile_output: true
8
- additional_paths: []
9
- cache_manifest: false
10
-
11
- development:
12
- <<: *default
13
- compile: true
14
- dev_server:
15
- https: false
16
- host: localhost
17
- port: 3035
18
- hmr: false
19
- client:
20
- overlay: true
21
- compress: true
22
- allowed_hosts: "all"
23
- pretty: true
24
- headers:
25
- 'Access-Control-Allow-Origin': '*'
26
- static:
27
- watch:
28
- ignored: '**/node_modules/**'
29
-
30
- test:
31
- <<: *default
32
- compile: false
33
- public_output_path: packs-test
@@ -1,6 +0,0 @@
1
- # This file is used by Rack-based servers to start the application.
2
-
3
- require_relative "config/environment"
4
-
5
- run Rails.application
6
- Rails.application.load_server
@@ -1,24 +0,0 @@
1
- {
2
- "name": "app",
3
- "private": true,
4
- "babel": {
5
- "presets": [
6
- "./node_modules/@rails/webpacker/package/babel/preset.js"
7
- ]
8
- },
9
- "browserslist": [
10
- "defaults"
11
- ],
12
- "dependencies": {
13
- "@hotwired/turbo-rails": "^7.0.1",
14
- "@rails/ujs": "^7.0.2",
15
- "@rails/webpacker": "^6.0.0-rc.5",
16
- "@yuki24/shoelace-rails": "file:./../../../shoelace-rails",
17
- "turbolinks": "^5.2.0",
18
- "webpack": "^5.51.1",
19
- "webpack-cli": "^4.8.0"
20
- },
21
- "devDependencies": {
22
- "@webpack-cli/serve": "^1.5.2"
23
- }
24
- }
@@ -1,63 +0,0 @@
1
- require "test_helper"
2
-
3
- class HotwireFormTest < ApplicationSystemTestCase
4
- setup do
5
- visit new_hotwire_form_path
6
- end
7
-
8
- test "It can submit a form with a POST method" do
9
- shadow_fill_in 'sl-input[label="Name"]', with: "Yuki Nishijima"
10
- shadow_fill_in 'sl-range[name="user[score]"]', with: "50"
11
-
12
- find('sl-radio', text: "New York").click # Selecting a radio button does not work...
13
-
14
- sl_select "Tokyo", from: "Select one"
15
- sl_multi_select "Tokyo", "New York", from: "Select two or more"
16
- sl_check "Remember me"
17
- sl_toggle "Subscribe to emails"
18
- shadow_fill_in 'sl-textarea[name="user[description]"]', "textarea", with: "I am a human."
19
-
20
- find("sl-button", text: "Create User").click
21
-
22
- assert_current_path hotwire_form_path(1)
23
- assert_text "Name: Yuki Nishijima"
24
- assert_text "Description: I am a human."
25
- assert_text "Score: 50"
26
- # assert_text "Current City:"
27
- assert_text "Previous City: tokyo"
28
- assert_text 'Past Cities: ["tokyo", "new_york"]'
29
- assert_text "Remember Me: 1"
30
- assert_text "Subscribe To Emails: 1"
31
- end
32
-
33
- test "It can submit a form with a POST method without asynchronous submission" do
34
- shadow_fill_in 'sl-input[label="Name"]', with: "Yuki Nishijima"
35
- shadow_fill_in 'sl-range[name="user[score]"]', with: "50"
36
-
37
- find('sl-radio', text: "New York").click # Selecting a radio button does not work...
38
-
39
- sl_select "Tokyo", from: "Select one"
40
- sl_multi_select "Tokyo", "New York", from: "Select two or more"
41
- sl_check "Remember me"
42
- sl_toggle "Subscribe to emails"
43
- shadow_fill_in 'sl-textarea[name="user[description]"]', "textarea", with: "I am a human."
44
-
45
- find("sl-button", text: "Submit without Turbo").click
46
-
47
- assert_current_path hotwire_form_path(1)
48
- assert_text "Name: Yuki Nishijima"
49
- assert_text "Description: I am a human."
50
- assert_text "Score: 50"
51
- # assert_text "Current City:"
52
- assert_text "Previous City: tokyo"
53
- assert_text 'Past Cities: ["tokyo", "new_york"]'
54
- assert_text "Remember Me: 1"
55
- assert_text "Subscribe To Emails: 1"
56
- end
57
-
58
- test "It can handle an error form submission" do
59
- find("sl-button", text: "Create User").click
60
-
61
- assert_text "Name can't be blank"
62
- end
63
- end
@@ -1,38 +0,0 @@
1
- require "test_helper"
2
-
3
- class TurbolinksFormTest < ApplicationSystemTestCase
4
- setup do
5
- visit new_turbolinks_form_path
6
- end
7
-
8
- test "It can submit a form with a POST method" do
9
- shadow_fill_in 'sl-input[label="Name"]', with: "Yuki Nishijima"
10
- shadow_fill_in 'sl-range[name="user[score]"]', with: "50"
11
-
12
- find('sl-radio', text: "New York").click # Selecting a radio button does not work...
13
-
14
- sl_select "Tokyo", from: "Select one"
15
- sl_multi_select "Tokyo", "New York", from: "Select two or more"
16
- sl_check "Remember me"
17
- sl_toggle "Subscribe to emails"
18
- shadow_fill_in 'sl-textarea[name="user[description]"]', "textarea", with: "I am a human."
19
-
20
- find("sl-button", text: "Create User").click
21
-
22
- assert_current_path turbolinks_forms_path
23
- assert_text "Name: Yuki Nishijima"
24
- assert_text "Description: I am a human."
25
- assert_text "Score: 50"
26
- # assert_text "Current City:"
27
- assert_text "Previous City: tokyo"
28
- assert_text 'Past Cities: ["tokyo", "new_york"]'
29
- assert_text "Remember Me: 1"
30
- assert_text "Subscribe To Emails: 1"
31
- end
32
-
33
- test "It can handle an error form submission" do
34
- find("sl-button", text: "Create User").click
35
-
36
- assert_text "Name can't be blank"
37
- end
38
- end