Issues (2)

test/props_test.rb (2 issues)

Labels
Severity
1
require "test_helper"
2
3
module Hyalite
4
  class PropsTest < Opal::Test::Unit::TestCase
5
    include RenderingHelper
6
7
    test 'text prop' do
8
      class WithProps
9
        include Hyalite::Component
10
        def render
11
          Hyalite.create_element('div', {className: 'actual'}, @props[:text])
12
        end
13
      end
14
15
      render do
16
        Hyalite.create_element(WithProps, {text: 'abc'})
17
      end
18
19
      actual = $document['.actual'].first
20
      assert_kind_of(Hyalite::DOM::Element, actual)
21
      assert_equal('abc', actual.text)
22
    end
23
24
    test 'attribute prop' do
25
      class WithProps
26
        include Hyalite::Component
27
        def render
28
          Hyalite.create_element('div', {className: @props[:attr]})
29
        end
30
      end
31
32
      render do
33
        Hyalite.create_element(WithProps, {'attr': 'abc'})
0 ignored issues
show
The Ruby parser could not interpret the code. It reported: unexpected token tCOLON (Using Ruby 2.0 p...meter, under `AllCops`).
Loading history...
34
      end
35
36
      actual = $document['.abc'].first
37
      assert_kind_of(Hyalite::DOM::Element, actual)
38
    end
39
  end
40
end
41
0 ignored issues
show
The Ruby parser could not interpret the code. It reported: unexpected token $end (Using Ruby 2.0 par...meter, under `AllCops`).
Loading history...