Skip to content
This repository was archived by the owner on Oct 19, 2018. It is now read-only.

Commit 229ee99

Browse files
committed
added test for #269
1 parent 64b457c commit 229ee99

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

Diff for: spec/react/builtin_tags_spec.rb

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
require 'spec_helper'
2+
3+
describe 'Builtin Tags', js: true do
4+
it "built in tags render method can be redefined" do
5+
mount 'Foo' do
6+
class React::Component::Tags::DIV < Hyperloop::Component
7+
render do
8+
params.opts['data-render-time'] = Time.now
9+
present "div", params.opts, &children
10+
end
11+
end
12+
class Foo < Hyperloop::Component
13+
render(DIV, id: :tp) do
14+
"hello"
15+
end
16+
end
17+
end
18+
expect(Time.parse(find('#tp')['data-render-time'])).to be <= Time.now
19+
end
20+
21+
it "built in tags other callbacks can be added" do
22+
mount 'Foo' do
23+
class React::Component::Tags::DIV < Hyperloop::Component
24+
def add_time
25+
params.opts['data-render-time'] = Time.now
26+
end
27+
before_mount :add_time
28+
before_update :add_time
29+
end
30+
class Foo < Hyperloop::Component
31+
render(DIV, id: :tp) do
32+
"hello"
33+
end
34+
end
35+
end
36+
expect(Time.parse(find('#tp')['data-render-time'])).to be <= Time.now
37+
end
38+
end

0 commit comments

Comments
 (0)