repo
stringlengths
5
92
file_url
stringlengths
80
287
file_path
stringlengths
5
197
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:37:27
2026-01-04 17:58:21
truncated
bool
2 classes
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/product_coupon_component.rb
test/sandbox/app/components/product_coupon_component.rb
# frozen_string_literal: true class ProductCouponComponent < ViewComponent::Base with_collection_parameter :item def initialize(item:) @item = item end end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/inherited_with_own_template_component.rb
test/sandbox/app/components/inherited_with_own_template_component.rb
# frozen_string_literal: true class InheritedWithOwnTemplateComponent < MyComponent end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/forwarding_slot_wrapper_component.rb
test/sandbox/app/components/forwarding_slot_wrapper_component.rb
# frozen_string_literal: true class ForwardingSlotWrapperComponent < ViewComponent::Base end unless defined?(ForwardingSlotComponent) class ForwardingSlotComponent < ViewComponent::Base def initialize @target = TargetSlotComponent.new end def with_target_content(&block) @target.with_target_...
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/unsafe_postamble_component.rb
test/sandbox/app/components/unsafe_postamble_component.rb
# frozen_string_literal: true class UnsafePostambleComponent < ViewComponent::Base def call "<div>some content</div>".html_safe end def output_postamble "<script>alert('hello!')</script>" end end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/inline_trailing_whitespace_component.rb
test/sandbox/app/components/inline_trailing_whitespace_component.rb
# frozen_string_literal: true class InlineTrailingWhitespaceComponent < ViewComponent::Base strip_trailing_whitespace erb_template <<~ERB <h1>Template does not contain any trailing whitespace</h1> ERB end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/wrapper_component.rb
test/sandbox/app/components/wrapper_component.rb
# frozen_string_literal: true class WrapperComponent < ViewComponent::Base end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/slots_without_content_block_component.rb
test/sandbox/app/components/slots_without_content_block_component.rb
# frozen_string_literal: true class SlotsWithoutContentBlockComponent < ViewComponent::Base renders_one :title, "MyTitleComponent" class MyTitleComponent < ViewComponent::Base def initialize(title) @title = title end def call content_tag :h1, @title end end end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/collection_iteration_component.rb
test/sandbox/app/components/collection_iteration_component.rb
# frozen_string_literal: true class CollectionIterationComponent < ViewComponent::Base with_collection_parameter :item def initialize(item:, item_iteration:) @item = item @iteration = item_iteration @counter = @iteration.index + 1 end end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/unsafe_preamble_component.rb
test/sandbox/app/components/unsafe_preamble_component.rb
# frozen_string_literal: true class UnsafePreambleComponent < ViewComponent::Base def call "<div>some content</div>".html_safe end def output_preamble "<script>alert('hello!')</script>" end end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/before_and_after_render_component.rb
test/sandbox/app/components/before_and_after_render_component.rb
# frozen_string_literal: true class BeforeAndAfterRenderComponent < ViewComponent::Base def call "Hello, ".html_safe end def output_preamble "Well, ".html_safe end def output_postamble "World!".html_safe end end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/slots_with_pos_arg_component.rb
test/sandbox/app/components/slots_with_pos_arg_component.rb
# frozen_string_literal: true class SlotsWithPosArgComponent < ViewComponent::Base renders_many :items, "Item" class Item < ViewComponent::Base attr_reader :title, :classes def initialize(title, classes:) @title = title @classes = classes end def call content end end end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/uncompilable_component.rb
test/sandbox/app/components/uncompilable_component.rb
# frozen_string_literal: true class UncompilableComponent < ViewComponent::Base end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/slim_html_formatted_slot_component.rb
test/sandbox/app/components/slim_html_formatted_slot_component.rb
# frozen_string_literal: true class SlimHtmlFormattedSlotComponent < ViewComponent::Base end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/inline_component.rb
test/sandbox/app/components/inline_component.rb
# frozen_string_literal: true class InlineComponent < ViewComponent::Base def call text_field_tag :name end def call_email text_field_tag :email end end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/variant_templates_collision_component.rb
test/sandbox/app/components/variant_templates_collision_component.rb
# frozen_string_literal: true class VariantTemplatesCollisionComponent < ViewComponent::Base end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/inline_variant_child_component.rb
test/sandbox/app/components/inline_variant_child_component.rb
# frozen_string_literal: true class InlineVariantChildComponent < InlineVariantComponent end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/inline_variant_child_with_template_component.rb
test/sandbox/app/components/inline_variant_child_with_template_component.rb
# frozen_string_literal: true class InlineVariantChildWithTemplateComponent < InlineVariantComponent end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/multiple_formats_component.rb
test/sandbox/app/components/multiple_formats_component.rb
# frozen_string_literal: true class MultipleFormatsComponent < ViewComponent::Base end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/erb_component.rb
test/sandbox/app/components/erb_component.rb
# frozen_string_literal: true class ErbComponent < ViewComponent::Base def initialize(message:) @message = message end end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/missing_template_component.rb
test/sandbox/app/components/missing_template_component.rb
# frozen_string_literal: true class MissingTemplateComponent < ViewComponent::Base end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/before_render_component.rb
test/sandbox/app/components/before_render_component.rb
# frozen_string_literal: true class BeforeRenderComponent < ViewComponent::Base def call "Hello!".html_safe end def output_preamble "Well, ".html_safe end end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/custom_form_builder_component.rb
test/sandbox/app/components/custom_form_builder_component.rb
# frozen_string_literal: true class CustomFormBuilderComponent < ViewComponent::Base def initialize(builder:) @builder = builder end end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/slots_with_empty_lambda_component.rb
test/sandbox/app/components/slots_with_empty_lambda_component.rb
# frozen_string_literal: true class SlotsWithEmptyLambdaComponent < ViewComponent::Base renders_many :items, -> do @item_count += 1 Item.new("Title #{@item_count}") end def initialize @item_count = 0 end class Item < ViewComponent::Base attr_reader :title def initialize(title) @t...
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/empty_slot_component.rb
test/sandbox/app/components/empty_slot_component.rb
# frozen_string_literal: true class EmptySlotComponent < ViewComponent::Base renders_one :title end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/url_for_component.rb
test/sandbox/app/components/url_for_component.rb
# frozen_string_literal: true class UrlForComponent < ViewComponent::Base def initialize(only_path: true) @only_path = only_path end end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/trailing_whitespace_component.rb
test/sandbox/app/components/trailing_whitespace_component.rb
# frozen_string_literal: true class TrailingWhitespaceComponent < ViewComponent::Base strip_trailing_whitespace end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/partial_helper_component.rb
test/sandbox/app/components/partial_helper_component.rb
# frozen_string_literal: true class PartialHelperComponent < ViewComponent::Base end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/nested_collection_component.rb
test/sandbox/app/components/nested_collection_component.rb
# frozen_string_literal: true class NestedCollectionComponent < ViewComponent::Base with_collection_parameter :item def initialize(item:) @item = item end end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/slotted_content_parent_component.rb
test/sandbox/app/components/slotted_content_parent_component.rb
# frozen_string_literal: true class SlottedContentParentComponent < ViewComponent::Base renders_many :children, SlottedContentChildComponent end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/simple_javascript_interaction_with_js_included_component.rb
test/sandbox/app/components/simple_javascript_interaction_with_js_included_component.rb
# frozen_string_literal: true class SimpleJavascriptInteractionWithJsIncludedComponent < ViewComponent::Base end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/cache_if_component.rb
test/sandbox/app/components/cache_if_component.rb
# frozen_string_literal: true class CacheIfComponent < ViewComponent::Base attr_reader :version private :version def initialize(version:) @version = version end end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/slots_render_predicate_component.rb
test/sandbox/app/components/slots_render_predicate_component.rb
# frozen_string_literal: true class SlotsRenderPredicateComponent < ViewComponent::Base renders_one :title, "PredicateTitleComponent" def render? title.present? end def call content_tag :div do title.to_s end end class PredicateTitleComponent < ViewComponent::Base def call co...
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/request_param_component.rb
test/sandbox/app/components/request_param_component.rb
class RequestParamComponent < ViewComponent::Base def initialize(request:) @request = request end def call @request.html_safe end end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/parent_component.rb
test/sandbox/app/components/parent_component.rb
# frozen_string_literal: true class ParentComponent < ViewComponent::Base def self.inherited(child) super end end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/path_component.rb
test/sandbox/app/components/path_component.rb
# frozen_string_literal: true class PathComponent < ViewComponent::Base end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/collection_iteration_extend_component.rb
test/sandbox/app/components/collection_iteration_extend_component.rb
# frozen_string_literal: true class CollectionIterationExtendComponent < CollectionIterationComponent end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/slim_with_unsafe_html_component.rb
test/sandbox/app/components/slim_with_unsafe_html_component.rb
# frozen_string_literal: true class SlimWithUnsafeHtmlComponent < ViewComponent::Base def unsafe_html "<script>alert('xss')</script>" end end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/default_template_and_inline_default_template_component.rb
test/sandbox/app/components/default_template_and_inline_default_template_component.rb
# frozen_string_literal: true class DefaultTemplateAndInlineDefaultTemplateComponent < ViewComponent::Base def call end end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/references_method_on_helpers_component.rb
test/sandbox/app/components/references_method_on_helpers_component.rb
# frozen_string_literal: true class ReferencesMethodOnHelpersComponent < ViewComponent::Base end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/button_to_component.rb
test/sandbox/app/components/button_to_component.rb
# frozen_string_literal: true class ButtonToComponent < ViewComponent::Base end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/slot_partial_helper_component.rb
test/sandbox/app/components/slot_partial_helper_component.rb
# frozen_string_literal: true class SlotPartialHelperComponent < ViewComponent::Base renders_one :header, PartialHelperComponent def call content_tag :h1 do safe_join([ helpers.expensive_message, header.to_s ]) end end end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/slot_name_override_component.rb
test/sandbox/app/components/slot_name_override_component.rb
# frozen_string_literal: true class SlotNameOverrideComponent < ViewComponent::Base renders_one :title def initialize(title: nil) @title = title end def title @title || super end def title? @title.present? || super end end class SlotNameOverrideComponent::OtherComponent < ViewComponent::B...
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/around_render_component.rb
test/sandbox/app/components/around_render_component.rb
class AroundRenderComponent < ViewComponent::Base def call "Hi!".html_safe end def around_render Instrumenter.tick do yield end end end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/asset_component.rb
test/sandbox/app/components/asset_component.rb
# frozen_string_literal: true class AssetComponent < ViewComponent::Base end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/sidecar_directory_component.rb
test/sandbox/app/components/sidecar_directory_component.rb
# frozen_string_literal: true class SidecarDirectoryComponent < ViewComponent::Base end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/too_many_sidecar_files_component.rb
test/sandbox/app/components/too_many_sidecar_files_component.rb
# frozen_string_literal: true class TooManySidecarFilesComponent < ViewComponent::Base end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/empty_component.rb
test/sandbox/app/components/empty_component.rb
# frozen_string_literal: true class EmptyComponent < ViewComponent::Base def call end end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/level3_component.rb
test/sandbox/app/components/level3_component.rb
# frozen_string_literal: true class Level3Component < Level2Component end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/slim_renders_many_component.rb
test/sandbox/app/components/slim_renders_many_component.rb
# frozen_string_literal: true class SlimRendersManyComponent < ViewComponent::Base renders_many :slim_components, SlimComponent end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/inline_render_component.rb
test/sandbox/app/components/inline_render_component.rb
# frozen_string_literal: true class InlineRenderComponent < ViewComponent::Base def initialize(items:) @items = items end def call @items.map { |c| render(c) }.join.html_safe end end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/collection_parameter_with_active_model_component.rb
test/sandbox/app/components/collection_parameter_with_active_model_component.rb
# frozen_string_literal: true class CollectionParameterWithActiveModelComponent < ViewComponent::Base include ActiveModel::Attributes attribute :name, :string with_collection_parameter :name def initialize(name:) end def call end end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/content_security_policy_nonce_component.rb
test/sandbox/app/components/content_security_policy_nonce_component.rb
class ContentSecurityPolicyNonceComponent < ViewComponent::Base end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/preview_component.rb
test/sandbox/app/components/preview_component.rb
# frozen_string_literal: true class PreviewComponent < ViewComponent::Base def initialize(title:, cta: nil) @cta = cta @title = title end private attr_reader :cta, :title end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/container_component.rb
test/sandbox/app/components/container_component.rb
# frozen_string_literal: true class ContainerComponent < ViewComponent::Base def call render HelpersProxyComponent.new end end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/sleep_component.rb
test/sandbox/app/components/sleep_component.rb
# frozen_string_literal: true class SleepComponent < ViewComponent::Base def initialize(seconds:) @seconds = seconds end def call sleep @seconds "sleep!" end end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/collection_iteration_extend_override_component.rb
test/sandbox/app/components/collection_iteration_extend_override_component.rb
# frozen_string_literal: true class CollectionIterationExtendOverrideComponent < CollectionIterationComponent with_collection_parameter :override def initialize(override:, override_iteration:) @override = override @iteration = override_iteration @counter = @iteration.index + 1 end end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/inherited_template_component.rb
test/sandbox/app/components/inherited_template_component.rb
# frozen_string_literal: true class InheritedTemplateComponent < MyComponent end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/simple_javascript_interaction_without_js_included_component.rb
test/sandbox/app/components/simple_javascript_interaction_without_js_included_component.rb
# frozen_string_literal: true class SimpleJavascriptInteractionWithoutJsIncludedComponent < ViewComponent::Base end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/url_helper_component.rb
test/sandbox/app/components/url_helper_component.rb
# frozen_string_literal: true class UrlHelperComponent < ViewComponent::Base def initialize(url: root_path) @url = url end end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/too_many_sidecar_files_for_variant_component.rb
test/sandbox/app/components/too_many_sidecar_files_for_variant_component.rb
# frozen_string_literal: true class TooManySidecarFilesForVariantComponent < ViewComponent::Base end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/haml_renders_html_component.rb
test/sandbox/app/components/haml_renders_html_component.rb
# frozen_string_literal: true class HamlRendersHtmlComponent < ViewComponent::Base renders_one :title renders_many :posts end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/partial_with_yield_component.rb
test/sandbox/app/components/partial_with_yield_component.rb
class PartialWithYieldComponent < ViewComponent::Base end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/polymorphic_content_slot_component.rb
test/sandbox/app/components/polymorphic_content_slot_component.rb
# frozen_string_literal: true class PolymorphicContentSlotComponent < ViewComponent::Base renders_one :leading_visual, types: { icon: lambda { |title| content_tag("h1") do title end } } def before_render content end end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/after_render_component.rb
test/sandbox/app/components/after_render_component.rb
# frozen_string_literal: true class AfterRenderComponent < ViewComponent::Base def call "Hello, ".html_safe end def output_postamble "World!".html_safe end end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/current_template_component.rb
test/sandbox/app/components/current_template_component.rb
# frozen_string_literal: true class CurrentTemplateComponent < ViewComponent::Base end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/variant_template_and_inline_variant_template_component.rb
test/sandbox/app/components/variant_template_and_inline_variant_template_component.rb
# frozen_string_literal: true class VariantTemplateAndInlineVariantTemplateComponent < ViewComponent::Base def call_phone end end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/missing_default_collection_parameter_component.rb
test/sandbox/app/components/missing_default_collection_parameter_component.rb
# frozen_string_literal: true class MissingDefaultCollectionParameterComponent < ViewComponent::Base def call end end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/another_component.rb
test/sandbox/app/components/another_component.rb
# frozen_string_literal: true class AnotherComponent < ViewComponent::Base end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/controller_inline_with_block_component.rb
test/sandbox/app/components/controller_inline_with_block_component.rb
# frozen_string_literal: true class ControllerInlineWithBlockComponent < ViewComponent::Base renders_one :slot, ->(name:) { tag.div name, id: "slot" } def initialize(message:) @message = message end end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/slotable_default_component.rb
test/sandbox/app/components/slotable_default_component.rb
class SlotableDefaultComponent < ViewComponent::Base erb_template <<~ERB <h1><%= header %></h1> ERB renders_one :header def default_header "hello,world!" end end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/polymorphic_slot_component.rb
test/sandbox/app/components/polymorphic_slot_component.rb
# frozen_string_literal: true class PolymorphicSlotComponent < ViewComponent::Base renders_many :fields, types: { foo: {renders: "FooItem", as: :foo_field}, bar: { renders: lambda { |class_names: "", **_system_arguments| classes = (class_names.split(" ") + ["bar"]).join(" ") content_tag...
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/super_base_component.rb
test/sandbox/app/components/super_base_component.rb
# frozen_string_literal: true class SuperBaseComponent < ViewComponent::Base end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/my_component.rb
test/sandbox/app/components/my_component.rb
# frozen_string_literal: true class MyComponent < ViewComponent::Base end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/collection_counter_component.rb
test/sandbox/app/components/collection_counter_component.rb
# frozen_string_literal: true class CollectionCounterComponent < ViewComponent::Base with_collection_parameter :item def initialize(item:, item_counter:) @item = item @counter = item_counter @index = @counter end end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/nested_shared_state/cell_component.rb
test/sandbox/app/components/nested_shared_state/cell_component.rb
# frozen_string_literal: true module NestedSharedState class CellComponent < ViewComponent::Base def initialize(class_names: "") @class_names = "table__cell #{class_names}" end def call content_tag(:div, content, {class: @class_names}) end end end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/nested_shared_state/header_component.rb
test/sandbox/app/components/nested_shared_state/header_component.rb
# frozen_string_literal: true module NestedSharedState class HeaderComponent < ViewComponent::Base renders_many :cells, NestedSharedState::CellComponent def initialize(selectable: false, class_names: "table__header", **kwargs) @selectable = selectable @tag_arguments = kwargs @tag_arguments...
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/nested_shared_state/table_component.rb
test/sandbox/app/components/nested_shared_state/table_component.rb
# frozen_string_literal: true module NestedSharedState class TableComponent < ViewComponent::Base renders_one :header, ->(arg = nil, **system_arguments, &block) do header_system_arguments = system_arguments header_system_arguments[:selectable] = @selectable header_system_arguments[:data] ||= {...
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/issues/badge_component.rb
test/sandbox/app/components/issues/badge_component.rb
# frozen_string_literal: true module Issues class BadgeComponent < ViewComponent::Base STATES = { open: { color: :green, label: "Open" }, closed: { color: :red, label: "Closed" } }.freeze def initialize(state:) @state = state end pri...
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/nested/slots_component.rb
test/sandbox/app/components/nested/slots_component.rb
# frozen_string_literal: true module Nested class SlotsComponent < ViewComponent::Base renders_many :items, "MyHighlightComponent" class MyHighlightComponent < ViewComponent::Base renders_one :thing, "AnotherComponent" class AnotherComponent < ViewComponent::Base end end end end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/unsuffixed/other.rb
test/sandbox/app/components/unsuffixed/other.rb
# frozen_string_literal: true class Unsuffixed::Other < ViewComponent::Base end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/components/example_module/translatable_module_component.rb
test/sandbox/app/components/example_module/translatable_module_component.rb
# frozen_string_literal: true module ExampleModule class TranslatableModuleComponent < ViewComponent::Base end end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/models/partial_model.rb
test/sandbox/app/models/partial_model.rb
PartialModel = Struct.new(:to_partial_path, keyword_init: true)
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/models/coupon.rb
test/sandbox/app/models/coupon.rb
Coupon = Struct.new(:percent_off, keyword_init: true)
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/models/post.rb
test/sandbox/app/models/post.rb
# frozen_string_literal: true class Post include ActiveModel::Model attr_accessor :title, :published end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/models/instrumenter.rb
test/sandbox/app/models/instrumenter.rb
class Instrumenter cattr_accessor :count, instance_reader: false, instance_writer: false, instance_accessor: false, default: 0 def self.tick Instrumenter.count = Instrumenter.count + 1 yield end end
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/models/product.rb
test/sandbox/app/models/product.rb
Product = Struct.new(:name, keyword_init: true)
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/models/photo.rb
test/sandbox/app/models/photo.rb
Photo = Struct.new(:title, :caption, :url, keyword_init: true)
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/lib/primer/state_component.rb
test/sandbox/app/lib/primer/state_component.rb
# frozen_string_literal: true module Primer class StateComponent < ViewComponent::Base COLOR_CLASS_MAPPINGS = { default: "", green: "State--green", red: "State--red", purple: "State--purple" }.freeze attr_reader :color, :title def initialize(title:, color: :default) @c...
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/app/mailers/test_mailer.rb
test/sandbox/app/mailers/test_mailer.rb
# frozen_string_literal: true class TestMailer < ActionMailer::Base def test_email mail( from: "no-reply@example.com", to: "test@example.com", subject: "Testing ViewComponent in ActionMailer" ) end def test_asset_email mail( from: "no-reply@example.com", to: "test@examp...
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/test/integration_test.rb
test/sandbox/test/integration_test.rb
# frozen_string_literal: true require "method_source" require "test_helper" class IntegrationTest < ActionDispatch::IntegrationTest def setup ViewComponent::Preview.__vc_load_previews end def test_rendering_component_in_a_view get "/" assert_response :success assert_select("div", "Foo bar") ...
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/test/instrumentation_test.rb
test/sandbox/test/instrumentation_test.rb
# frozen_string_literal: true require "test_helper" class InstrumentationTest < ViewComponent::TestCase def test_instrumentation_for_include events = [] ActiveSupport::Notifications.subscribe("render.view_component") do |*args| events << ActiveSupport::Notifications::Event.new(*args) end rend...
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/test/action_view_compatibility_test.rb
test/sandbox/test/action_view_compatibility_test.rb
# frozen_string_literal: true require "test_helper" class ViewComponent::ActionViewCompatibilityTest < ViewComponent::TestCase def test_renders_form_for_labels_with_block_correctly render_inline(FormForComponent.new) assert_selector("form > div > label > input") refute_selector("form > div > input") ...
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/test/collection_test.rb
test/sandbox/test/collection_test.rb
# frozen_string_literal: true require "test_helper" module ViewComponent class CollectionTest < TestCase class ProductComponent < ViewComponent::Base attr_accessor :product def initialize(**attributes) self.product = attributes[:product] end def call "<div data-name='#{...
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/test/test_helper_test.rb
test/sandbox/test/test_helper_test.rb
# frozen_string_literal: true require "test_helper" class TestHelperTest < ViewComponent::TestCase def test_with_request_url_inside_slots_path with_request_url "/slots" do render_inline(CurrentPageComponent.new) end assert_selector("div", text: "Inside /slots (GET /slots)") end def test_with...
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/test/rendering_test.rb
test/sandbox/test/rendering_test.rb
# frozen_string_literal: true require "test_helper" class RenderingTest < ViewComponent::TestCase def vc_test_controller_class IntegrationExamplesController end def test_render_inline render_inline(MyComponent.new) assert_selector("div", text: "hello,world!") end def test_render_inline_alloca...
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
true
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/test/default_preview_layout_integration_test.rb
test/sandbox/test/default_preview_layout_integration_test.rb
# frozen_string_literal: true require "test_helper" class DefaultPreviewLayoutIntegrationTest < ActionDispatch::IntegrationTest def test_preview_index_renders_custom_application_layout_if_configured with_default_preview_layout("admin") do get "/rails/view_components" assert_select "title", "ViewComp...
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/test/slotable_test.rb
test/sandbox/test/slotable_test.rb
# frozen_string_literal: true require "test_helper" class SlotableTest < ViewComponent::TestCase def test_renders_slots render_inline(SlotsComponent.new(classes: "mt-4")) do |component| component.with_title do "This is my title!" end component.with_subtitle do "This is my subti...
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/test/mailer_test.rb
test/sandbox/test/mailer_test.rb
# frozen_string_literal: true require "test_helper" class MailerTest < ActionMailer::TestCase def test_rendering_component_in_an_action_mailer result = TestMailer.test_email.deliver_now.body.to_s assert_includes result, "<div>Hello world!</div>" assert_includes result, "test_email.html.erb" end def...
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/test/layouts_test.rb
test/sandbox/test/layouts_test.rb
# frozen_string_literal: true require "test_helper" class LayoutsTest < ActionDispatch::IntegrationTest test "rendering default layout" do get "/layout_default" assert_response :success assert_select 'body[data-layout="application"]' end test "rendering global_for_action" do get "/layout_global...
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false
ViewComponent/view_component
https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/test/sandbox/test/config_test.rb
test/sandbox/test/config_test.rb
# frozen_string_literal: true require "test_helper" module ViewComponent class ConfigTest < TestCase def setup @config = ViewComponent::Config.new end def test_defaults_are_correct assert_equal @config.generate, {preview_path: "", path: "app/components"} assert_equal @config.previews....
ruby
MIT
48da443d2b0df16a981b7ec0cc4c6cf0a51114fb
2026-01-04T15:50:14.216895Z
false