panda-core 0.7.0 → 0.7.1
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 80a35426761da785e847321996703aad6eeecb6262b2a781a3d1379bb0d438fd
|
|
4
|
+
data.tar.gz: 6eac8f3b86fb4054c6c54083a22bea5d3c6471f4aca43f06e1ab78726c6aa870
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ee2a264cbd6d014680f7773fd56749331de84f30b12c34a6eb87132a3f7c99e8f2fd97c32c6126bea35ecedb3301d9763d4826bbfe44f5f34fa5d2e92cb1ee86
|
|
7
|
+
data.tar.gz: 9df32b3390d72b00a4588bf1d0a88666fabdf9a519ed48712736316d66a6581467c1fb48fbacbd59244f7d319533110b9cec37807edc37984ce395f7b31cd5ba
|
|
@@ -19,10 +19,14 @@ export default class extends Controller {
|
|
|
19
19
|
static targets = ["button", "menu", "icon"]
|
|
20
20
|
|
|
21
21
|
connect() {
|
|
22
|
+
// Ensure menu starts in correct state
|
|
22
23
|
// Check if this menu should be expanded by default (if a child is active)
|
|
23
24
|
const hasActiveChild = this.menuTarget.querySelector(".bg-mid")
|
|
24
25
|
if (hasActiveChild) {
|
|
25
26
|
this.expand()
|
|
27
|
+
} else {
|
|
28
|
+
// Explicitly ensure the menu is collapsed if no active child
|
|
29
|
+
this.collapse()
|
|
26
30
|
}
|
|
27
31
|
}
|
|
28
32
|
|
|
@@ -42,6 +46,7 @@ export default class extends Controller {
|
|
|
42
46
|
|
|
43
47
|
expand() {
|
|
44
48
|
this.menuTarget.classList.remove("hidden")
|
|
49
|
+
this.menuTarget.style.display = ""
|
|
45
50
|
this.buttonTarget.setAttribute("aria-expanded", "true")
|
|
46
51
|
|
|
47
52
|
if (this.hasIconTarget) {
|
|
@@ -51,6 +56,7 @@ export default class extends Controller {
|
|
|
51
56
|
|
|
52
57
|
collapse() {
|
|
53
58
|
this.menuTarget.classList.add("hidden")
|
|
59
|
+
this.menuTarget.style.display = "none"
|
|
54
60
|
this.buttonTarget.setAttribute("aria-expanded", "false")
|
|
55
61
|
|
|
56
62
|
if (this.hasIconTarget) {
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Shared RSpec configuration for all Panda gems
|
|
4
|
+
# This file provides common test infrastructure that can be extended by individual gems
|
|
5
|
+
#
|
|
6
|
+
# IMPORTANT: This file should be required AFTER the dummy app is loaded
|
|
7
|
+
# Individual gem rails_helper files should:
|
|
8
|
+
# 1. Set up SimpleCov
|
|
9
|
+
# 2. Require panda/core and the dummy app
|
|
10
|
+
# 3. Require this file
|
|
11
|
+
# 4. Load gem-specific support files
|
|
12
|
+
|
|
13
|
+
# Require common test gems (assumes Rails and RSpec/Rails are already loaded by gem's rails_helper)
|
|
14
|
+
require "database_cleaner/active_record"
|
|
15
|
+
require "shoulda/matchers"
|
|
16
|
+
require "capybara"
|
|
17
|
+
require "capybara/rspec"
|
|
18
|
+
require "puma"
|
|
19
|
+
|
|
20
|
+
# Configure fixtures
|
|
21
|
+
ActiveRecord::FixtureSet.context_class.send :include, ActiveSupport::Testing::TimeHelpers
|
|
22
|
+
|
|
23
|
+
# Shoulda Matchers configuration
|
|
24
|
+
Shoulda::Matchers.configure do |config|
|
|
25
|
+
config.integrate do |with|
|
|
26
|
+
with.test_framework :rspec
|
|
27
|
+
with.library :rails
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Load all support files from panda-core
|
|
32
|
+
panda_core_support_path = Gem.loaded_specs["panda-core"]&.full_gem_path
|
|
33
|
+
if panda_core_support_path
|
|
34
|
+
Dir[File.join(panda_core_support_path, "spec/support/**/*.rb")].sort.each { |f| require f }
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
RSpec.configure do |config|
|
|
38
|
+
# Include panda-core route helpers by default
|
|
39
|
+
config.include Panda::Core::Engine.routes.url_helpers if defined?(Panda::Core::Engine)
|
|
40
|
+
config.include Rails.application.routes.url_helpers
|
|
41
|
+
|
|
42
|
+
# Standard RSpec configuration
|
|
43
|
+
config.use_transactional_fixtures = true
|
|
44
|
+
config.infer_spec_type_from_file_location!
|
|
45
|
+
config.filter_rails_from_backtrace!
|
|
46
|
+
config.example_status_persistence_file_path = "spec/examples.txt"
|
|
47
|
+
config.disable_monkey_patching!
|
|
48
|
+
|
|
49
|
+
# Print total example count before running
|
|
50
|
+
config.before(:suite) do
|
|
51
|
+
puts "Total examples to run: #{RSpec.world.example_count}\n"
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Use specific formatter for GitHub Actions
|
|
55
|
+
if ENV["GITHUB_ACTIONS"] == "true"
|
|
56
|
+
require "rspec/github"
|
|
57
|
+
config.add_formatter RSpec::Github::Formatter
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Controller testing support (if rails-controller-testing is available)
|
|
61
|
+
if defined?(Rails::Controller::Testing)
|
|
62
|
+
config.include Rails::Controller::Testing::TestProcess, type: :controller
|
|
63
|
+
config.include Rails::Controller::Testing::TemplateAssertions, type: :controller
|
|
64
|
+
config.include Rails::Controller::Testing::Integration, type: :controller
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# Reset column information before suite
|
|
68
|
+
config.before(:suite) do
|
|
69
|
+
if defined?(Panda::Core::User)
|
|
70
|
+
Panda::Core::User.connection.schema_cache.clear!
|
|
71
|
+
Panda::Core::User.reset_column_information
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# Disable prepared statements for PostgreSQL tests to avoid caching issues
|
|
76
|
+
config.before(:suite) do
|
|
77
|
+
if ActiveRecord::Base.connection.adapter_name == "PostgreSQL"
|
|
78
|
+
ActiveRecord::Base.connection.unprepared_statement do
|
|
79
|
+
# This block intentionally left empty
|
|
80
|
+
end
|
|
81
|
+
# Disable prepared statements globally for test environment
|
|
82
|
+
ActiveRecord::Base.establish_connection(
|
|
83
|
+
ActiveRecord::Base.connection_db_config.configuration_hash.merge(prepared_statements: false)
|
|
84
|
+
)
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# Disable logging during tests
|
|
89
|
+
config.before(:suite) do
|
|
90
|
+
Rails.logger.level = Logger::ERROR
|
|
91
|
+
ActiveRecord::Base.logger = nil if defined?(ActiveRecord)
|
|
92
|
+
ActionController::Base.logger = nil if defined?(ActionController)
|
|
93
|
+
ActionMailer::Base.logger = nil if defined?(ActionMailer)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# Suppress Rails command output during generator tests
|
|
97
|
+
config.before(:each, type: :generator) do
|
|
98
|
+
allow(Rails::Command).to receive(:invoke).and_return(true)
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# Force all examples to run
|
|
102
|
+
config.filter_run_including({})
|
|
103
|
+
config.run_all_when_everything_filtered = true
|
|
104
|
+
|
|
105
|
+
# Allow using focus keywords "f... before a specific test"
|
|
106
|
+
config.filter_run_when_matching :focus
|
|
107
|
+
|
|
108
|
+
# Retry flaky tests automatically
|
|
109
|
+
# This is especially useful for system tests that may have timing issues
|
|
110
|
+
config.around(:each, :flaky) do |example|
|
|
111
|
+
retry_count = example.metadata[:retry] || 3
|
|
112
|
+
retry_count.times do |i|
|
|
113
|
+
example.run
|
|
114
|
+
break unless example.exception
|
|
115
|
+
|
|
116
|
+
if i < retry_count - 1
|
|
117
|
+
puts "\n[RETRY] Test failed, retrying... (attempt #{i + 2}/#{retry_count})"
|
|
118
|
+
puts "[RETRY] Exception: #{example.exception.class.name}: #{example.exception.message[0..100]}"
|
|
119
|
+
example.instance_variable_set(:@exception, nil)
|
|
120
|
+
sleep 1 # Brief pause between retries
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
# Exclude EditorJS tests by default unless specifically requested
|
|
126
|
+
config.filter_run_excluding :editorjs unless ENV["INCLUDE_EDITORJS"] == "true"
|
|
127
|
+
|
|
128
|
+
# Use verbose output if only running one spec file
|
|
129
|
+
config.default_formatter = "doc" if config.files_to_run.one?
|
|
130
|
+
|
|
131
|
+
# Print the 10 slowest examples and example groups at the
|
|
132
|
+
# end of the spec run, to help surface which specs are running
|
|
133
|
+
# particularly slow.
|
|
134
|
+
config.profile_examples = 10
|
|
135
|
+
|
|
136
|
+
# Run specs in random order to surface order dependencies. If you find an
|
|
137
|
+
# order dependency and want to debug it, you can fix the order by providing
|
|
138
|
+
# the seed, which is printed after each run: --seed 1234
|
|
139
|
+
Kernel.srand config.seed
|
|
140
|
+
config.order = :random
|
|
141
|
+
|
|
142
|
+
# Note: Fixture configuration is gem-specific and should be done in each gem's rails_helper.rb
|
|
143
|
+
# This includes config.fixture_paths and config.global_fixtures
|
|
144
|
+
|
|
145
|
+
# Bullet configuration (if available)
|
|
146
|
+
if defined?(Bullet) && Bullet.enable?
|
|
147
|
+
config.before(:each) do
|
|
148
|
+
Bullet.start_request
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
config.after(:each) do
|
|
152
|
+
Bullet.perform_out_of_channel_notifications if Bullet.notification?
|
|
153
|
+
Bullet.end_request
|
|
154
|
+
end
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
# OmniAuth test mode
|
|
158
|
+
OmniAuth.config.test_mode = true if defined?(OmniAuth)
|
|
159
|
+
|
|
160
|
+
# DatabaseCleaner configuration
|
|
161
|
+
config.before(:suite) do
|
|
162
|
+
# Allow DATABASE_URL in CI environment
|
|
163
|
+
if ENV["DATABASE_URL"]
|
|
164
|
+
DatabaseCleaner.allow_remote_database_url = true
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
DatabaseCleaner.clean_with :truncation
|
|
168
|
+
|
|
169
|
+
# Hook for gems to add custom suite setup
|
|
170
|
+
# Gems can define Panda::Testing.before_suite_hook and it will be called here
|
|
171
|
+
if defined?(Panda::Testing) && Panda::Testing.respond_to?(:before_suite_hook)
|
|
172
|
+
Panda::Testing.before_suite_hook
|
|
173
|
+
end
|
|
174
|
+
end
|
|
175
|
+
end
|
data/lib/panda/core/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: panda-core
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.7.
|
|
4
|
+
version: 0.7.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Otaina Limited
|
|
@@ -470,6 +470,7 @@ files:
|
|
|
470
470
|
- lib/panda/core/services/base_service.rb
|
|
471
471
|
- lib/panda/core/sluggable.rb
|
|
472
472
|
- lib/panda/core/subscribers/authentication_subscriber.rb
|
|
473
|
+
- lib/panda/core/testing/rails_helper.rb
|
|
473
474
|
- lib/panda/core/version.rb
|
|
474
475
|
- lib/tasks/assets.rake
|
|
475
476
|
- lib/tasks/panda/core/migrations.rake
|