README.md in actionview-component-1.3.6 vs README.md in actionview-component-1.4.0

- old
+ new

@@ -13,11 +13,11 @@ As the goal of this gem is to be upstreamed into Rails, it is designed to integrate as seamlessly as possible, with the [least surprise](https://www.artima.com/intv/ruby4.html). ## Compatibility -`actionview-component` is tested for compatibility with combinations of Ruby `2.3`/`2.4`/`2.5`/`2.6` and Rails `5.0.0`/`5.2.3`/`6.0.0`/`6.1.0.alpha`. +`actionview-component` is tested for compatibility with combinations of Ruby `2.4`/`2.5`/`2.6` and Rails `5.0.0`/`5.2.3`/`6.0.0`/`6.1.0.alpha`. ## Installation Add this line to your application's Gemfile: ```ruby @@ -176,16 +176,31 @@ include ActionView::Component::TestHelpers def test_render_component assert_equal( %(<span title="my title">Hello, World!</span>), - render_inline(TestComponent, title: "my title") { "Hello, World!" }.css("span").to_html + render_inline(TestComponent, title: "my title") { "Hello, World!" }.to_html ) end end ``` In general, we’ve found it makes the most sense to test components based on their rendered HTML. + +#### Action Pack Variants + +To test a specific variant you can wrap your test with the `with_variant` helper method as: + +```ruby +def test_render_component_for_tablet + with_variant :tablet do + assert_equal( + %(<span title="my title">Hello, tablets!</span>), + render_inline(TestComponent, title: "my title") { "Hello, tablets!" }.css("span").to_html + ) + end +end +``` ## Frequently Asked Questions ### Can I use other templating languages besides ERB?