Permalink
Browse files

Make return values works

  • Loading branch information...
florentferry committed May 31, 2018
1 parent b782314 commit c10914b883513f7a7c6f1c2e099abd09b0a8cde5
@@ -2,6 +2,8 @@
## Upcoming release
- Block given to component now pass return values
## v2.0.0 (2018-04-22)
**Enhancements:**
@@ -73,6 +73,7 @@ Feature: Component generator
"""
import "components/all/all";
import "components/bar/bar";
import "components/foo_bar/foo_bar";
import "components/namespaced";
import "components/required/required";
import "components/some_example/some_example";
@@ -0,0 +1 @@
<div class="foo-bar"><%= yield("Foo Bar") %></div>
@@ -0,0 +1 @@
import "./foo_bar.css";
@@ -0,0 +1,5 @@
# frozen_string_literal: true
module FooBarComponent
extend ComponentHelper
end
@@ -1,5 +1,6 @@
import "components/all/all";
import "components/bar/bar";
import "components/foo_bar/foo_bar";
import "components/namespaced";
import "components/required/required";
import "components/world/world";
@@ -2,7 +2,7 @@
module KomponentHelper
def component(component_name, locals = {}, options = {}, &block)
captured_block = proc { capture(&block) } if block_given?
captured_block = proc { |args| capture(args, &block) } if block_given?
Komponent::ComponentRenderer.new(
controller,
).render(
@@ -56,4 +56,10 @@ def test_helper_renders_with_block
%(<div class="bar">Bar</div>),
component('bar') { "Bar" }.chomp
end
def test_helper_renders_yield_args
assert_equal \
%(<div class="foo-bar">Foo Bar</div>),
component('foo_bar') { |x| x }.chomp
end
end

0 comments on commit c10914b

Please sign in to comment.