Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 15d470a

Browse files
committed
closes #58
1 parent ccd7862 commit 15d470a

File tree

4 files changed

+19
-9
lines changed

4 files changed

+19
-9
lines changed

ruby/hyper-component/lib/hyperstack/internal/component/class_methods.rb

+4
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,10 @@ def param(*args)
130130
options[:default] ||= nil
131131
options[:allow_nil] = true unless options.key?(:allow_nil)
132132
end
133+
if name == :class
134+
name = :className
135+
options[:alias] ||= :Class
136+
end
133137
if options[:default]
134138
validator.optional(name, options)
135139
else

ruby/hyper-component/lib/hyperstack/internal/component/props_wrapper.rb

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ def define_param(name, param_type, aka = nil)
4242
param_definitions[name] = lambda do |props|
4343
@component.instance_variable_set :"@#{var_name}", fetch_from_cache(name, param_type, props)
4444
end
45+
return if param_accessor_style == :hyperstack
4546
if param_type == Proc
4647
define_method(meth_name.to_sym) do |*args, &block|
4748
props[name].call(*args, &block) if props[name]

ruby/hyper-component/spec/client_features/param_declaration_spec.rb

+14
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,20 @@ class Foo < Hyperloop::Component
129129
.to match(/Warning: Failed prop( type|Type): In component `Foo`\nProvided prop `foo1` could not be converted to String/)
130130
end
131131

132+
it "will properly handle params named class" do
133+
mount 'Foo', className: 'a-class' do
134+
class Foo < Hyperloop::Component
135+
136+
param :class
137+
138+
render do
139+
DIV { "class = #{@Class}" }
140+
end
141+
end
142+
end
143+
expect(page).to have_content('class = a-class')
144+
end
145+
132146
it 'logs error in warning if validation failed' do
133147
evaluate_ruby do
134148
class Lorem; end

ruby/rails-hyperstack/Gemfile.lock

-9
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,6 @@ PATH
6262
hyperstack-config (= 1.0.alpha1.1)
6363
opal (>= 0.11.0, < 0.12.0)
6464

65-
PATH
66-
remote: ../hyper-store
67-
specs:
68-
hyper-store (1.0.alpha1.1)
69-
hyper-state (= 1.0.alpha1.1)
70-
hyperstack-config (= 1.0.alpha1.1)
71-
opal (>= 0.11.0, < 0.12.0)
72-
7365
PATH
7466
remote: ../hyperstack-config
7567
specs:
@@ -412,7 +404,6 @@ DEPENDENCIES
412404
hyper-router!
413405
hyper-spec!
414406
hyper-state!
415-
hyper-store!
416407
hyperstack-config!
417408
jbuilder (~> 2.5)
418409
pry

0 commit comments

Comments
 (0)