inline_forms 7.10.2 → 7.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/Rakefile +18 -1
- data/docs/prompt/test-the-example-app.md +3 -3
- data/inline_forms.gemspec +6 -21
- data/lib/inline_forms/gem_files.rb +39 -0
- data/lib/inline_forms/version.rb +1 -1
- metadata +10 -76
- data/bin/inline_forms +0 -141
- data/bin/inline_forms_app_template.rb +0 -22
- data/bin/inline_forms_installer_core.rb +0 -886
- data/lib/generators/templates/capistrano/Capfile +0 -39
- data/lib/generators/templates/capistrano/deploy.rb +0 -59
- data/lib/generators/templates/capistrano/production.rb +0 -7
- data/lib/generators/templates/unicorn/production.rb +0 -39
- data/lib/installer_templates/dartsass/devise_main.scss +0 -2
- data/lib/installer_templates/dartsass/inline_forms_dartsass_builds.rb +0 -14
- data/lib/installer_templates/dartsass/inline_forms_main.scss +0 -2
- data/lib/installer_templates/example_app_tests/test/example_app/example_integration_test_case.rb +0 -36
- data/lib/installer_templates/example_app_tests/test/integration/example_app_apartment_field_turbo_test.rb +0 -73
- data/lib/installer_templates/example_app_tests/test/integration/example_app_apartment_name_list_test.rb +0 -73
- data/lib/installer_templates/example_app_tests/test/integration/example_app_apartment_name_required_test.rb +0 -21
- data/lib/installer_templates/example_app_tests/test/integration/example_app_apartment_opening_date_test.rb +0 -49
- data/lib/installer_templates/example_app_tests/test/integration/example_app_apartment_photos_pagination_test.rb +0 -440
- data/lib/installer_templates/example_app_tests/test/integration/example_app_apartment_row_turbo_test.rb +0 -103
- data/lib/installer_templates/example_app_tests/test/integration/example_app_apartment_top_level_new_test.rb +0 -70
- data/lib/installer_templates/example_app_tests/test/integration/example_app_apartment_top_level_pagination_test.rb +0 -40
- data/lib/installer_templates/example_app_tests/test/integration/example_app_apartment_versions_turbo_test.rb +0 -120
- data/lib/installer_templates/example_app_tests/test/integration/example_app_guest_access_test.rb +0 -21
- data/lib/installer_templates/example_app_tests/test/integration/example_app_photo_revert_test.rb +0 -94
- data/lib/installer_templates/example_app_tests/test/integration/example_app_photos_test.rb +0 -22
- data/lib/installer_templates/example_app_tests/test/integration/example_app_routing_test.rb +0 -15
- data/lib/installer_templates/example_app_tests/test/integration/example_app_turbo_layout_test.rb +0 -25
- data/lib/installer_templates/example_app_tests/test/integration/example_app_validation_hints_test.rb +0 -40
- data/lib/installer_templates/example_app_tests/test/models/example_app_apartment_name_validation_test.rb +0 -16
- data/lib/installer_templates/example_app_tests/test/models/example_app_apartment_photo_test.rb +0 -26
- data/lib/installer_templates/example_app_tests/test/models/example_app_paper_trail_changeset_test.rb +0 -78
- data/lib/installer_templates/example_app_tests/test/models/example_app_plain_text_rich_text_edge_cases_test.rb +0 -46
- data/lib/installer_templates/example_app_views/apartments/name_list.html.erb +0 -26
- data/lib/installer_templates/example_app_views/inline_forms/_header.html.erb +0 -45
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
# Load DSL and set up stages
|
|
2
|
-
require "capistrano/setup"
|
|
3
|
-
|
|
4
|
-
# Include default deployment tasks
|
|
5
|
-
require "capistrano/deploy"
|
|
6
|
-
|
|
7
|
-
# Load the SCM plugin appropriate to your project:
|
|
8
|
-
#
|
|
9
|
-
# require "capistrano/scm/hg"
|
|
10
|
-
# install_plugin Capistrano::SCM::Hg
|
|
11
|
-
# or
|
|
12
|
-
# require "capistrano/scm/svn"
|
|
13
|
-
# install_plugin Capistrano::SCM::Svn
|
|
14
|
-
# or
|
|
15
|
-
require "capistrano/scm/git"
|
|
16
|
-
install_plugin Capistrano::SCM::Git
|
|
17
|
-
|
|
18
|
-
# Include tasks from other gems included in your Gemfile
|
|
19
|
-
#
|
|
20
|
-
# For documentation on these, see for example:
|
|
21
|
-
#
|
|
22
|
-
# https://github.com/capistrano/rvm
|
|
23
|
-
# https://github.com/capistrano/rbenv
|
|
24
|
-
# https://github.com/capistrano/chruby
|
|
25
|
-
# https://github.com/capistrano/bundler
|
|
26
|
-
# https://github.com/capistrano/rails
|
|
27
|
-
# https://github.com/capistrano/passenger
|
|
28
|
-
#
|
|
29
|
-
require 'rvm1/capistrano3'
|
|
30
|
-
# require "capistrano/rbenv"
|
|
31
|
-
# require "capistrano/chruby"
|
|
32
|
-
require "capistrano/bundler"
|
|
33
|
-
require "capistrano/rails/assets"
|
|
34
|
-
require "capistrano/rails/migrations"
|
|
35
|
-
# require "capistrano/passenger"
|
|
36
|
-
require "capistrano3/unicorn"
|
|
37
|
-
|
|
38
|
-
# Load custom tasks from `lib/capistrano/tasks` if you have any defined
|
|
39
|
-
Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
set :application, ENV['DEPLOY_APPLICATION']
|
|
2
|
-
set :repo_url, ENV['DEPLOY_REPO_URL']
|
|
3
|
-
set :bundle_binstubs, nil
|
|
4
|
-
|
|
5
|
-
# Default deploy_to directory is /var/www/my_app_name
|
|
6
|
-
set :deploy_to, ENV['DEPLOY_DIRECTORY']
|
|
7
|
-
|
|
8
|
-
# Default value for :linked_files is []
|
|
9
|
-
set :linked_files, fetch(:linked_files, [])
|
|
10
|
-
.push("config/application.yml")
|
|
11
|
-
# Default value for linked_dirs is []
|
|
12
|
-
set :linked_dirs, fetch(:linked_dirs, [])
|
|
13
|
-
.push("log", "tmp/pids", "tmp/cache", "tmp/sockets", "public/system", "vendor/bundle")
|
|
14
|
-
|
|
15
|
-
# Default value for keep_releases is 5
|
|
16
|
-
set :keep_releases, 5
|
|
17
|
-
|
|
18
|
-
before 'rvm1:install:rvm', 'app:update_rvm_key'
|
|
19
|
-
after 'rvm1:install:ruby', 'rvm1:install_bundler'
|
|
20
|
-
|
|
21
|
-
before 'deploy', 'rvm1:install:rvm' # install/update RVM
|
|
22
|
-
before 'deploy', 'rvm1:install:ruby' # install/update Ruby
|
|
23
|
-
|
|
24
|
-
before 'deploy:check', 'figaro:upload'
|
|
25
|
-
after 'deploy:publishing', 'deploy:restart'
|
|
26
|
-
|
|
27
|
-
# Restart unicorn
|
|
28
|
-
namespace :deploy do
|
|
29
|
-
task :restart do
|
|
30
|
-
invoke "unicorn:restart"
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
# Uploads secrets.yml, database.yml and application.yml files
|
|
35
|
-
namespace :figaro do
|
|
36
|
-
task :upload do
|
|
37
|
-
on roles(:all) do
|
|
38
|
-
execute "mkdir -p #{shared_path}/config"
|
|
39
|
-
upload! 'config/application.yml', "#{shared_path}/config/application.yml"
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
namespace :app do
|
|
45
|
-
task :update_rvm_key do
|
|
46
|
-
roles(:all) do
|
|
47
|
-
execute :gpg, "--keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3"
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
namespace :rvm1 do # https://github.com/rvm/rvm1-capistrano3/issues/45
|
|
53
|
-
desc "Install Bundler"
|
|
54
|
-
task :install_bundler do
|
|
55
|
-
on release_roles :all do
|
|
56
|
-
execute "cd #{release_path} && #{fetch(:rvm1_auto_script_path)}/rvm-auto.sh . gem install bundler"
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
end
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
# Load ENV vars via Figaro
|
|
2
|
-
require 'figaro'
|
|
3
|
-
Figaro.application = Figaro::Application.new(environment: 'production', path: File.expand_path('../../../config/application.yml', __FILE__))
|
|
4
|
-
Figaro.load
|
|
5
|
-
|
|
6
|
-
app_path = "#{ENV['DEPLOY_DIRECTORY']}/current"
|
|
7
|
-
working_directory app_path
|
|
8
|
-
|
|
9
|
-
pid "#{app_path}/tmp/pids/unicorn.pid"
|
|
10
|
-
|
|
11
|
-
stderr_path "#{app_path}/log/unicorn.err.log"
|
|
12
|
-
stdout_path "#{app_path}/log/unicorn.out.log"
|
|
13
|
-
|
|
14
|
-
worker_processes 3
|
|
15
|
-
timeout 30
|
|
16
|
-
preload_app true
|
|
17
|
-
|
|
18
|
-
listen "#{app_path}/tmp/sockets/unicorn.sock", backlog: 64
|
|
19
|
-
|
|
20
|
-
before_exec do |_|
|
|
21
|
-
ENV["BUNDLE_GEMFILE"] = File.join(app_path, "Gemfile")
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
before_fork do |server, worker|
|
|
25
|
-
defined?(ActiveRecord::Base) and ActiveRecord::Base.connection.disconnect!
|
|
26
|
-
|
|
27
|
-
old_pid = "#{app_path}/tmp/pids/unicorn.pid.oldbin"
|
|
28
|
-
|
|
29
|
-
if File.exist?(old_pid) && server.pid != old_pid
|
|
30
|
-
begin
|
|
31
|
-
Process.kill("QUIT", File.read(old_pid).to_i)
|
|
32
|
-
rescue Errno::ENOENT, Errno::ESRCH
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
after_fork do |server, worker|
|
|
38
|
-
defined?(ActiveRecord::Base) and ActiveRecord::Base.establish_connection
|
|
39
|
-
end
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# Dart Sass entrypoints for this app (see dartsass-rails). Output lives under
|
|
4
|
-
# app/assets/builds/; Sprockets must not link any .scss (only compiled .css).
|
|
5
|
-
#
|
|
6
|
-
# Visual reference (chrome widths, bars, jQuery UI sunny, Foundation Icons):
|
|
7
|
-
# foundation-rails ~> 6.6.2 + sass-rails (sassc) — last stack verified in-repo.
|
|
8
|
-
# Upgraded stack (this file):
|
|
9
|
-
# foundation-rails ~> 6.9 (RubyGems 6.9.0.x) + dartsass-rails (Dart Sass).
|
|
10
|
-
Rails.application.config.dartsass.builds = {
|
|
11
|
-
"application.scss" => "application.css",
|
|
12
|
-
"inline_forms_install/inline_forms_main.scss" => "inline_forms/inline_forms.css",
|
|
13
|
-
"inline_forms_install/devise_main.scss" => "inline_forms/devise.css"
|
|
14
|
-
}
|
data/lib/installer_templates/example_app_tests/test/example_app/example_integration_test_case.rb
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# Base class for integration tests shipped only with `inline_forms create … --example`.
|
|
4
|
-
# See test/integration/example_app_*_test.rb
|
|
5
|
-
require "test_helper"
|
|
6
|
-
require "devise/test/integration_helpers"
|
|
7
|
-
|
|
8
|
-
class ExampleAppIntegrationTestCase < ActionDispatch::IntegrationTest
|
|
9
|
-
include Devise::Test::IntegrationHelpers
|
|
10
|
-
|
|
11
|
-
setup do
|
|
12
|
-
host!("www.example.com")
|
|
13
|
-
sign_in(example_app_admin_user)
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
private
|
|
17
|
-
|
|
18
|
-
def example_app_admin_user
|
|
19
|
-
@example_app_admin_user ||= begin
|
|
20
|
-
locale = Locale.find_or_create_by!(name: "en") { |l| l.title = "English" }
|
|
21
|
-
role = Role.find_or_create_by!(name: "superadmin") { |r| r.description = "Super Admin" }
|
|
22
|
-
user = User.find_or_initialize_by(email: "admin@example.com")
|
|
23
|
-
if user.new_record?
|
|
24
|
-
user.assign_attributes(
|
|
25
|
-
name: "Admin",
|
|
26
|
-
password: "admin999",
|
|
27
|
-
password_confirmation: "admin999",
|
|
28
|
-
locale: locale
|
|
29
|
-
)
|
|
30
|
-
user.save!
|
|
31
|
-
end
|
|
32
|
-
user.roles << role unless user.roles.where(id: role.id).exists?
|
|
33
|
-
user
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
end
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative "../example_app/example_integration_test_case"
|
|
4
|
-
|
|
5
|
-
# Stock _show partial: scalar fields are wrapped in <turbo-frame> and use HTML
|
|
6
|
-
# edit/update/cancel (no UJS on field links/forms). Same contract as name_list.
|
|
7
|
-
class ExampleAppApartmentFieldTurboTest < ExampleAppIntegrationTestCase
|
|
8
|
-
setup do
|
|
9
|
-
@apartment = Apartment.find_or_create_by!(name: "Turbo Field Apt") do |a|
|
|
10
|
-
a.title = "Turbo Field Title"
|
|
11
|
-
end
|
|
12
|
-
@frame_id = "apartment_#{@apartment.id}_name"
|
|
13
|
-
@turbo_headers = { "Turbo-Frame" => @frame_id }
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
test "show panel opens as HTML inside row turbo-frame" do
|
|
17
|
-
row_frame = "apartment_#{@apartment.id}"
|
|
18
|
-
get apartment_path(@apartment, update: row_frame),
|
|
19
|
-
headers: { "Turbo-Frame" => row_frame, "Accept" => "text/html" }
|
|
20
|
-
|
|
21
|
-
assert_response :success
|
|
22
|
-
assert_includes @response.body, %(<turbo-frame id="#{row_frame}">)
|
|
23
|
-
assert_includes @response.body, "turbo-frame",
|
|
24
|
-
"row show should embed _show with per-field turbo-frame wrappers"
|
|
25
|
-
assert_includes @response.body, @frame_id
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
test "stock scalar field edit update and cancel via turbo-frame" do
|
|
29
|
-
get edit_apartment_path(
|
|
30
|
-
@apartment,
|
|
31
|
-
attribute: "name",
|
|
32
|
-
form_element: "text_field",
|
|
33
|
-
update: @frame_id
|
|
34
|
-
), headers: @turbo_headers
|
|
35
|
-
assert_response :success
|
|
36
|
-
assert_includes @response.body, %(<turbo-frame id="#{@frame_id}">)
|
|
37
|
-
refute_includes @response.body, 'data-remote="true"'
|
|
38
|
-
|
|
39
|
-
put apartment_path(
|
|
40
|
-
@apartment,
|
|
41
|
-
attribute: "name",
|
|
42
|
-
form_element: "text_field",
|
|
43
|
-
update: @frame_id
|
|
44
|
-
), params: { name: "Stock Turbo Name" }, headers: @turbo_headers
|
|
45
|
-
assert_response :success
|
|
46
|
-
assert_includes @response.body, "Stock Turbo Name"
|
|
47
|
-
assert_equal "Stock Turbo Name", @apartment.reload.name
|
|
48
|
-
|
|
49
|
-
get apartment_path(
|
|
50
|
-
@apartment,
|
|
51
|
-
attribute: "name",
|
|
52
|
-
form_element: "text_field",
|
|
53
|
-
update: @frame_id
|
|
54
|
-
), headers: @turbo_headers
|
|
55
|
-
assert_response :success
|
|
56
|
-
assert_includes @response.body, "Stock Turbo Name"
|
|
57
|
-
refute_includes @response.body, 'name="name"',
|
|
58
|
-
"cancel returns read-only field, not edit form"
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
test "field show cancel responds to html even without Turbo-Frame header" do
|
|
62
|
-
get apartment_path(
|
|
63
|
-
@apartment,
|
|
64
|
-
attribute: "name",
|
|
65
|
-
form_element: "text_field",
|
|
66
|
-
update: @frame_id
|
|
67
|
-
), headers: { "Accept" => "text/html, application/xhtml+xml" }
|
|
68
|
-
|
|
69
|
-
assert_response :success
|
|
70
|
-
assert_includes @response.body, %(<turbo-frame id="#{@frame_id}">)
|
|
71
|
-
assert_includes @response.body, @apartment.name
|
|
72
|
-
end
|
|
73
|
-
end
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative "../example_app/example_integration_test_case"
|
|
4
|
-
|
|
5
|
-
# Custom page demo: same turbo-field contract as stock _show, without opening the panel.
|
|
6
|
-
class ExampleAppApartmentNameListTest < ExampleAppIntegrationTestCase
|
|
7
|
-
setup do
|
|
8
|
-
@apartments = 10.times.map do |i|
|
|
9
|
-
Apartment.find_or_create_by!(name: "NameList Apt #{i}") do |a|
|
|
10
|
-
a.title = "Title #{i}"
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
test "name list page is reachable and renders turbo-frame inline-edit targets for first 10 apartments" do
|
|
16
|
-
get apartment_name_list_path
|
|
17
|
-
assert_response :success
|
|
18
|
-
|
|
19
|
-
Apartment.order(:id).limit(10).each do |apartment|
|
|
20
|
-
assert_includes @response.body, %(<turbo-frame id="apartment_#{apartment.id}_name">),
|
|
21
|
-
"expected turbo-frame wrapper for apartment #{apartment.id}"
|
|
22
|
-
assert_includes @response.body, apartment.name,
|
|
23
|
-
"expected apartment name on page"
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
test "more menu links to apartment name list" do
|
|
28
|
-
get apartments_path
|
|
29
|
-
assert_response :success
|
|
30
|
-
assert_includes @response.body, apartment_name_list_path,
|
|
31
|
-
"expected More menu link to name list"
|
|
32
|
-
assert_includes @response.body, "Apartment names (first 10)"
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
test "name list field links use turbo-frame navigation not UJS remote" do
|
|
36
|
-
apartment = @apartments.first
|
|
37
|
-
get apartment_name_list_path
|
|
38
|
-
assert_response :success
|
|
39
|
-
|
|
40
|
-
frame_html = @response.body[%r{<turbo-frame id="apartment_#{apartment.id}_name">.*?</turbo-frame>}m]
|
|
41
|
-
assert frame_html, "expected turbo-frame for apartment #{apartment.id}"
|
|
42
|
-
assert_match(
|
|
43
|
-
%r/href="[^"]*\/apartments\/#{apartment.id}\/edit[^"]*update=apartment_#{apartment.id}_name[^"]*"/,
|
|
44
|
-
frame_html,
|
|
45
|
-
"expected edit link with update= matching turbo-frame id"
|
|
46
|
-
)
|
|
47
|
-
refute_includes frame_html, 'data-remote="true"',
|
|
48
|
-
"field edits use Turbo frames, not UJS"
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
test "name list reuses stock turbo field edit update cycle" do
|
|
52
|
-
apartment = @apartments.first
|
|
53
|
-
frame_id = "apartment_#{apartment.id}_name"
|
|
54
|
-
turbo_headers = { "Turbo-Frame" => frame_id }
|
|
55
|
-
|
|
56
|
-
get edit_apartment_path(
|
|
57
|
-
apartment,
|
|
58
|
-
attribute: "name",
|
|
59
|
-
form_element: "text_field",
|
|
60
|
-
update: frame_id
|
|
61
|
-
), headers: turbo_headers
|
|
62
|
-
assert_response :success
|
|
63
|
-
|
|
64
|
-
put apartment_path(
|
|
65
|
-
apartment,
|
|
66
|
-
attribute: "name",
|
|
67
|
-
form_element: "text_field",
|
|
68
|
-
update: frame_id
|
|
69
|
-
), params: { name: "Name List Turbo" }, headers: turbo_headers
|
|
70
|
-
assert_response :success
|
|
71
|
-
assert_equal "Name List Turbo", apartment.reload.name
|
|
72
|
-
end
|
|
73
|
-
end
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative "../example_app/example_integration_test_case"
|
|
4
|
-
|
|
5
|
-
class ExampleAppApartmentNameRequiredTest < ExampleAppIntegrationTestCase
|
|
6
|
-
setup do
|
|
7
|
-
@frame = "apartments_list"
|
|
8
|
-
@frame_headers = { "Turbo-Frame" => @frame, "Accept" => "text/html" }
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
test "top-level create without name does not persist" do
|
|
12
|
-
assert_no_difference("Apartment.count") do
|
|
13
|
-
post apartments_path(update: @frame),
|
|
14
|
-
params: { title: "Missing name" },
|
|
15
|
-
headers: @frame_headers
|
|
16
|
-
end
|
|
17
|
-
assert_response :success
|
|
18
|
-
assert_includes @response.body, 'name="name"'
|
|
19
|
-
assert_includes @response.body, 'class="edit_form"'
|
|
20
|
-
end
|
|
21
|
-
end
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative "../example_app/example_integration_test_case"
|
|
4
|
-
|
|
5
|
-
# Example app includes opening_date:date on Apartment (jQuery UI datepicker).
|
|
6
|
-
class ExampleAppApartmentOpeningDateTest < ExampleAppIntegrationTestCase
|
|
7
|
-
setup do
|
|
8
|
-
@apartment = Apartment.find_or_create_by!(name: "Datepicker Apt") do |a|
|
|
9
|
-
a.title = "Has an opening date"
|
|
10
|
-
a.opening_date = Date.new(2019, 3, 15)
|
|
11
|
-
end
|
|
12
|
-
@frame_id = "apartment_#{@apartment.id}_opening_date"
|
|
13
|
-
@turbo_headers = { "Turbo-Frame" => @frame_id, "Accept" => "text/html" }
|
|
14
|
-
@list_frame = "apartments_list"
|
|
15
|
-
@list_headers = { "Turbo-Frame" => @list_frame, "Accept" => "text/html" }
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
test "show panel displays opening_date" do
|
|
19
|
-
row_frame = "apartment_#{@apartment.id}"
|
|
20
|
-
get apartment_path(@apartment, update: row_frame),
|
|
21
|
-
headers: { "Turbo-Frame" => row_frame, "Accept" => "text/html" }
|
|
22
|
-
|
|
23
|
-
assert_response :success
|
|
24
|
-
assert_includes @response.body, "15-03-2019"
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
test "inline edit opening_date uses datepicker class hook" do
|
|
28
|
-
get edit_apartment_path(
|
|
29
|
-
@apartment,
|
|
30
|
-
attribute: "opening_date",
|
|
31
|
-
form_element: "date_select",
|
|
32
|
-
update: @frame_id
|
|
33
|
-
), headers: @turbo_headers
|
|
34
|
-
|
|
35
|
-
assert_response :success
|
|
36
|
-
assert_includes @response.body, %(class="datepicker")
|
|
37
|
-
assert_includes @response.body, %(name="opening_date")
|
|
38
|
-
refute_includes @response.body, "<script",
|
|
39
|
-
"datepicker init is centralized in inline_forms.js"
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
test "new apartment form includes datepicker for opening_date" do
|
|
43
|
-
get new_apartment_path(update: @list_frame), headers: @list_headers
|
|
44
|
-
|
|
45
|
-
assert_response :success
|
|
46
|
-
assert_includes @response.body, %(name="opening_date")
|
|
47
|
-
assert_includes @response.body, %(class="datepicker")
|
|
48
|
-
end
|
|
49
|
-
end
|