honkster-jelly 0.11.0 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
data/lib/jelly/jelly_helper.rb
CHANGED
@@ -18,11 +18,7 @@ module JellyHelper
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def attach_javascript_component_javascript_tag(components)
|
21
|
-
javascript_tag
|
22
|
-
jQuery(document).ready(function() {
|
23
|
-
Jelly.attach.apply(Jelly, #{components.to_json});
|
24
|
-
});
|
25
|
-
JS
|
21
|
+
javascript_tag "Jelly.attach.apply(Jelly, #{components.to_json});"
|
26
22
|
end
|
27
23
|
|
28
24
|
def clear_jelly_attached
|
@@ -66,7 +66,7 @@ describe JellyHelper, :type => :helper do
|
|
66
66
|
]
|
67
67
|
end
|
68
68
|
|
69
|
-
it "adds a call to Jelly.attach
|
69
|
+
it "adds a call to Jelly.attach" do
|
70
70
|
helper.attach_javascript_component("MyComponent", 'arg1', 'arg2', 'arg3')
|
71
71
|
expected_args = ['arg1','arg2','arg3'].to_json
|
72
72
|
helper.instance_variable_get(:@jelly_attachments).should == [
|
@@ -76,8 +76,7 @@ describe JellyHelper, :type => :helper do
|
|
76
76
|
html = helper.spread_jelly
|
77
77
|
doc = Nokogiri::HTML(html)
|
78
78
|
document_ready_tag = doc.at("script")
|
79
|
-
document_ready_tag.inner_html.
|
80
|
-
document_ready_part = document_ready_tag.inner_html.split("\n")[3]
|
79
|
+
document_ready_part = document_ready_tag.inner_html.split("\n")[2]
|
81
80
|
arguments = jelly_attach_arguments(document_ready_part)
|
82
81
|
arguments.should include(["MyComponent", 'arg1', 'arg2', 'arg3'])
|
83
82
|
end
|