sharing_tags 0.0.9 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +94 -0
- data/.travis.yml +1 -0
- data/Gemfile +2 -1
- data/Guardfile +21 -11
- data/README.md +8 -1
- data/Rakefile +16 -0
- data/Todo.md +4 -1
- data/app/assets/images/sharing_tags/icons/line.svg +9 -9
- data/app/assets/javascripts/sharing_tags.js +10 -0
- data/app/assets/javascripts/sharing_tags/init.js.coffee.erb +5 -4
- data/app/assets/javascripts/sharing_tags/links.js.coffee +9 -7
- data/app/assets/javascripts/sharing_tags/share.js.coffee +82 -62
- data/app/assets/javascripts/sharing_tags/share/callback.js.coffee +14 -0
- data/app/assets/javascripts/sharing_tags/share/facebook.js.coffee +82 -0
- data/app/assets/stylesheets/sharing_tags/wave_animation.css.sass +33 -0
- data/app/views/sharing_tags/meta/_open_graphs.html.slim +1 -1
- data/app/views/sharing_tags/meta/_twitter_card.html.slim +12 -9
- data/circle.yml +9 -0
- data/lib/generators/sharing_tags/install/install_generator.rb +12 -14
- data/lib/generators/sharing_tags/install/templates/initializer.rb +3 -0
- data/lib/sharing_tags.rb +0 -5
- data/lib/sharing_tags/action_controller/filters.rb +13 -10
- data/lib/sharing_tags/action_controller/helpers.rb +11 -9
- data/lib/sharing_tags/action_view/asset_helper.rb +39 -35
- data/lib/sharing_tags/action_view/button_helper.rb +62 -53
- data/lib/sharing_tags/action_view/meta_helper.rb +11 -8
- data/lib/sharing_tags/config.rb +3 -4
- data/lib/sharing_tags/configuration.rb +17 -18
- data/lib/sharing_tags/context.rb +11 -14
- data/lib/sharing_tags/engine.rb +11 -0
- data/lib/sharing_tags/network.rb +64 -30
- data/lib/sharing_tags/network/facebook.rb +11 -8
- data/lib/sharing_tags/railtie.rb +6 -9
- data/lib/sharing_tags/version.rb +1 -1
- data/sharing_tags.gemspec +1 -0
- data/spec/controllers/main_controller_spec.rb +2 -2
- data/spec/dummy/app/helpers/application_helper.rb +1 -0
- data/spec/generators/install_generator_spec.rb +8 -6
- data/spec/helpers/asset_helper_spec.rb +3 -2
- data/spec/helpers/button_helper_spec.rb +70 -76
- data/spec/helpers/meta_tags_helper_spec.rb +1 -2
- data/spec/javascripts/fixtures/facebook.json +3 -1
- data/spec/javascripts/sharing_tags/share/{facebook_share_spec.coffee → facebook_spec.coffee} +73 -12
- data/spec/javascripts/sharing_tags/share/vkontakte_spec.coffee +29 -0
- data/spec/javascripts/sharing_tags/share_spec.coffee +193 -0
- data/spec/javascripts/sharing_tags/sharing_tags_spec.coffee +9 -14
- data/spec/models/configuration_spec.rb +12 -14
- data/spec/models/network_spec.rb +1 -4
- data/spec/models/running_in_context_spec.rb +19 -6
- data/spec/spec_helper.rb +1 -2
- data/spec/support/generator_support.rb +1 -3
- data/spec/teaspoon_env.rb +39 -39
- data/spec/views/meta_tags/facebook_meta_tags_erb_spec.rb +16 -17
- data/spec/views/meta_tags/meta_tags_erb_spec.rb +5 -7
- metadata +29 -13
- data/app/assets/javascripts/sharing_tags.js.coffee +0 -9
- data/app/assets/javascripts/sharing_tags/share/base.js.coffee +0 -38
- data/app/assets/javascripts/sharing_tags/share/facebook.coffee +0 -57
- data/app/assets/javascripts/sharing_tags/share/vkontakte.js.coffee +0 -13
- data/bin/rspec +0 -16
- data/spec/javascripts/sharing_tags/share/vkontakte_share_spec.coffee +0 -31
@@ -1,4 +1,4 @@
|
|
1
|
-
RSpec.describe MainController, :
|
1
|
+
RSpec.describe MainController, type: :controller do
|
2
2
|
render_views
|
3
3
|
|
4
4
|
before do
|
@@ -8,7 +8,7 @@ RSpec.describe MainController, :type => :controller do
|
|
8
8
|
|
9
9
|
# Activate default social network. Others available are:
|
10
10
|
# :vkontakte,
|
11
|
-
#networks :twitter, :facebook, :google
|
11
|
+
# networks :twitter, :facebook, :google
|
12
12
|
|
13
13
|
share_url_params(utm_source: "some_source", utm_campaign: "some_campaign")
|
14
14
|
|
@@ -86,13 +86,15 @@ describe SharingTags::Generators::InstallGenerator, type: :generator do
|
|
86
86
|
subject { file file_path }
|
87
87
|
|
88
88
|
describe "application.html.slim" do
|
89
|
-
let(:layout)
|
89
|
+
let(:layout) do
|
90
|
+
%(
|
90
91
|
html
|
91
92
|
header
|
92
93
|
title Some title
|
93
94
|
body
|
94
95
|
p Text block
|
95
|
-
|
96
|
+
)
|
97
|
+
end
|
96
98
|
|
97
99
|
before do
|
98
100
|
create_file file_path, layout
|
@@ -115,16 +117,16 @@ describe SharingTags::Generators::InstallGenerator, type: :generator do
|
|
115
117
|
|
116
118
|
subject { file file_path }
|
117
119
|
|
118
|
-
let(:layout)
|
119
|
-
<html>
|
120
|
+
let(:layout) do
|
121
|
+
%(<html>
|
120
122
|
<head>
|
121
123
|
<title>Some title</title>
|
122
124
|
</head>
|
123
125
|
<body>
|
124
126
|
<p>Text block</p>
|
125
127
|
</body>
|
126
|
-
</html>
|
127
|
-
|
128
|
+
</html>)
|
129
|
+
end
|
128
130
|
let(:file_path) { "app/views/layouts/application.html.erb" }
|
129
131
|
|
130
132
|
it "expect added render_sharing_tags " do
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require "non-stupid-digest-assets"
|
2
2
|
|
3
|
-
RSpec.describe SharingTags::ActionView::AssetHelper, :
|
3
|
+
RSpec.describe SharingTags::ActionView::AssetHelper, type: :helper do
|
4
4
|
|
5
5
|
describe "#without_digest_asset_url" do
|
6
6
|
before do
|
@@ -23,7 +23,8 @@ RSpec.describe SharingTags::ActionView::AssetHelper, :type => :helper do
|
|
23
23
|
|
24
24
|
it "add to non digest gem" do
|
25
25
|
NonStupidDigestAssets.whitelist = []
|
26
|
-
expect{ is_expected }.to change(::NonStupidDigestAssets, :whitelist)
|
26
|
+
expect { is_expected }.to change(::NonStupidDigestAssets, :whitelist)
|
27
27
|
end
|
28
28
|
end
|
29
|
+
|
29
30
|
end
|
@@ -1,15 +1,14 @@
|
|
1
|
-
|
2
|
-
RSpec.describe SharingTags::ActionView::ButtonHelper, :type => :helper do
|
1
|
+
RSpec.describe SharingTags::ActionView::ButtonHelper, type: :helper do
|
3
2
|
|
4
3
|
describe "#link_to_facebook_share" do
|
5
4
|
before do
|
6
5
|
SharingTags.configure do
|
7
6
|
facebook do
|
8
|
-
title
|
9
|
-
description
|
10
|
-
share_url
|
11
|
-
page_url
|
12
|
-
image
|
7
|
+
title "fb title"
|
8
|
+
description "fb desc"
|
9
|
+
share_url "http://c.d"
|
10
|
+
page_url "http://a.b"
|
11
|
+
image "http://img.png"
|
13
12
|
end
|
14
13
|
end
|
15
14
|
end
|
@@ -17,17 +16,17 @@ RSpec.describe SharingTags::ActionView::ButtonHelper, :type => :helper do
|
|
17
16
|
subject { helper.link_to_facebook_share }
|
18
17
|
|
19
18
|
it "generate default text share link" do
|
20
|
-
is_expected.to have_tag "a",
|
21
|
-
is_expected.to have_tag "a",
|
19
|
+
is_expected.to have_tag "a", with: {href: "http://a.b", role: "sharing_tags_share"}
|
20
|
+
is_expected.to have_tag "a", with: {"data-share-url" => "http://c.d"}
|
22
21
|
is_expected.to have_tag "img", with: {src: "/assets/sharing_tags/icons/facebook.svg"}
|
23
22
|
|
24
23
|
is_expected.to have_tag("a", without: {
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
24
|
+
"data-share-url" => "http://c.d",
|
25
|
+
"data-title" => "fb title",
|
26
|
+
"data-description" => "fb desc",
|
27
|
+
"data-image" => "http://img.png",
|
28
|
+
"data-network" => "facebook"
|
29
|
+
})
|
31
30
|
end
|
32
31
|
|
33
32
|
it "generate default text sharing link for block" do
|
@@ -40,38 +39,37 @@ RSpec.describe SharingTags::ActionView::ButtonHelper, :type => :helper do
|
|
40
39
|
before do
|
41
40
|
SharingTags.configure do
|
42
41
|
vkontakte do
|
43
|
-
title
|
44
|
-
description
|
45
|
-
share_url
|
46
|
-
page_url
|
47
|
-
image
|
42
|
+
title "vk title"
|
43
|
+
description "vk desc"
|
44
|
+
share_url "http://vk.share?utm_source=vk"
|
45
|
+
page_url "http://vk.share"
|
46
|
+
image "http://img.png"
|
48
47
|
end
|
49
48
|
end
|
50
49
|
end
|
51
50
|
|
52
51
|
subject { helper.link_to_vkontakte_share }
|
53
52
|
|
54
|
-
|
55
53
|
it "generate default text share link" do
|
56
|
-
is_expected.to
|
54
|
+
is_expected.to have_tag "a", with: {href: "http://vk.share", role: "sharing_tags_share"}
|
57
55
|
is_expected.to have_tag("a", with: {
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
56
|
+
"data-share-url" => "http://vk.share?utm_source=vk",
|
57
|
+
"data-title" => "vk title",
|
58
|
+
"data-description" => "vk desc",
|
59
|
+
"data-image" => "http://img.png",
|
60
|
+
"data-network" => "vkontakte"
|
61
|
+
})
|
64
62
|
end
|
65
63
|
|
66
64
|
it "generate default text sharing link for block" do
|
67
65
|
expect(helper.link_to_vkontakte_share { "Text block" }).to have_tag "a", text: "Text block", with: {href: "http://vk.share", role: "sharing_tags_share"}
|
68
66
|
expect(helper.link_to_vkontakte_share { "Text block" }).to have_tag("a", with: {
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
67
|
+
"data-share-url" => "http://vk.share?utm_source=vk",
|
68
|
+
"data-title" => "vk title",
|
69
|
+
"data-description" => "vk desc",
|
70
|
+
"data-image" => "http://img.png",
|
71
|
+
"data-network" => "vkontakte"
|
72
|
+
})
|
75
73
|
|
76
74
|
end
|
77
75
|
end
|
@@ -80,11 +78,11 @@ RSpec.describe SharingTags::ActionView::ButtonHelper, :type => :helper do
|
|
80
78
|
before do
|
81
79
|
SharingTags.configure do
|
82
80
|
odnoklassniki do
|
83
|
-
title
|
84
|
-
description
|
85
|
-
share_url
|
86
|
-
page_url
|
87
|
-
image
|
81
|
+
title "od title"
|
82
|
+
description "od desc"
|
83
|
+
share_url "http://od.share?utm_source=od"
|
84
|
+
page_url "http://od.share"
|
85
|
+
image "http://img.png"
|
88
86
|
end
|
89
87
|
end
|
90
88
|
end
|
@@ -94,15 +92,15 @@ RSpec.describe SharingTags::ActionView::ButtonHelper, :type => :helper do
|
|
94
92
|
it "generate default text share link" do
|
95
93
|
is_expected.to have_tag "a", with: {href: "http://od.share", role: "sharing_tags_share"}
|
96
94
|
is_expected.to have_tag("a", with: {
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
95
|
+
"data-share-url" => "http://od.share?utm_source=od",
|
96
|
+
"data-title" => "od title",
|
97
|
+
"data-description" => "od desc",
|
98
|
+
"data-network" => "odnoklassniki"
|
99
|
+
})
|
102
100
|
is_expected.to have_tag "img", with: {src: "/assets/sharing_tags/icons/odnoklassniki.svg"}
|
103
101
|
is_expected.to have_tag("a", without: {
|
104
|
-
|
105
|
-
|
102
|
+
"data-image" => "http://img.png"
|
103
|
+
})
|
106
104
|
end
|
107
105
|
|
108
106
|
it "generate default text sharing link for block" do
|
@@ -123,8 +121,6 @@ RSpec.describe SharingTags::ActionView::ButtonHelper, :type => :helper do
|
|
123
121
|
# 'data-target' => "main"
|
124
122
|
# })
|
125
123
|
# end
|
126
|
-
|
127
|
-
|
128
124
|
end
|
129
125
|
|
130
126
|
describe "#link_to_twitter_share" do
|
@@ -133,10 +129,10 @@ RSpec.describe SharingTags::ActionView::ButtonHelper, :type => :helper do
|
|
133
129
|
twitter do
|
134
130
|
link_params utm_source: "tw"
|
135
131
|
|
136
|
-
title
|
137
|
-
description
|
138
|
-
page_url
|
139
|
-
image
|
132
|
+
title "tw title"
|
133
|
+
description "tw desc"
|
134
|
+
page_url "http://tw.share"
|
135
|
+
image "http://img.png"
|
140
136
|
end
|
141
137
|
end
|
142
138
|
end
|
@@ -146,14 +142,12 @@ RSpec.describe SharingTags::ActionView::ButtonHelper, :type => :helper do
|
|
146
142
|
it "generate default text share link" do
|
147
143
|
is_expected.to have_tag "a", with: {href: "http://tw.share", role: "sharing_tags_share"}
|
148
144
|
is_expected.to have_tag("a", with: {
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
is_expected.to have_tag("a", without: {
|
155
|
-
"data-image" => "http://img.png"
|
156
|
-
})
|
145
|
+
"data-share-url" => "http://tw.share?utm_source=tw",
|
146
|
+
"data-title" => "tw title",
|
147
|
+
"data-description" => "tw desc",
|
148
|
+
"data-network" => "twitter"
|
149
|
+
})
|
150
|
+
is_expected.to have_tag("a", without: {"data-image" => "http://img.png"})
|
157
151
|
expect(helper.link_to_twitter_share).to have_tag "img", with: {src: "/assets/sharing_tags/icons/twitter.svg"}
|
158
152
|
end
|
159
153
|
|
@@ -168,10 +162,10 @@ RSpec.describe SharingTags::ActionView::ButtonHelper, :type => :helper do
|
|
168
162
|
google do
|
169
163
|
link_params utm_source: "gg"
|
170
164
|
|
171
|
-
title
|
172
|
-
description
|
173
|
-
page_url
|
174
|
-
image
|
165
|
+
title "gg title"
|
166
|
+
description "gg desc"
|
167
|
+
page_url "http://gg.share"
|
168
|
+
image "img.png"
|
175
169
|
end
|
176
170
|
end
|
177
171
|
end
|
@@ -181,14 +175,14 @@ RSpec.describe SharingTags::ActionView::ButtonHelper, :type => :helper do
|
|
181
175
|
it "generate default text share link" do
|
182
176
|
is_expected.to have_tag "a", with: {href: "http://gg.share", role: "sharing_tags_share"}
|
183
177
|
is_expected.to have_tag("a", with: {
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
178
|
+
"data-share-url" => "http://gg.share?utm_source=gg",
|
179
|
+
"data-network" => "google"
|
180
|
+
},
|
181
|
+
without: {
|
182
|
+
"data-image" => "img.png",
|
183
|
+
"data-title" => "gg title",
|
184
|
+
"data-description" => "gg desc"
|
185
|
+
})
|
192
186
|
is_expected.to have_tag "img", with: {src: "/assets/sharing_tags/icons/google.svg"}
|
193
187
|
end
|
194
188
|
|
@@ -200,10 +194,10 @@ RSpec.describe SharingTags::ActionView::ButtonHelper, :type => :helper do
|
|
200
194
|
describe "#sharing_tags_buttons" do
|
201
195
|
before do
|
202
196
|
SharingTags.configure do
|
203
|
-
title
|
204
|
-
description
|
205
|
-
page_url
|
206
|
-
image
|
197
|
+
title "Title"
|
198
|
+
description "Desc"
|
199
|
+
page_url "http://link.share"
|
200
|
+
image "http://img.png"
|
207
201
|
end
|
208
202
|
end
|
209
203
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
RSpec.describe SharingTags::ActionView::MetaHelper, :
|
2
|
+
RSpec.describe SharingTags::ActionView::MetaHelper, type: :helper do
|
3
3
|
|
4
4
|
describe "#sharing_tags" do
|
5
5
|
pending
|
@@ -32,5 +32,4 @@ RSpec.describe SharingTags::ActionView::MetaHelper, :type => :helper do
|
|
32
32
|
expect(helper.render_sharing_tags).to have_tag "meta", with: {name: "twitter:description", content: "Sharing description"}
|
33
33
|
end
|
34
34
|
end
|
35
|
-
|
36
35
|
end
|
data/spec/javascripts/sharing_tags/share/{facebook_share_spec.coffee → facebook_spec.coffee}
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
#=require sharing_tags/share
|
2
|
-
#=require sharing_tags/share/base
|
3
2
|
#=require sharing_tags/share/facebook
|
3
|
+
#=require sharing_tags/share/callback
|
4
4
|
|
5
5
|
fixture.preload("facebook.json")
|
6
6
|
|
@@ -71,7 +71,7 @@ describe "SharingTags.FacebookShare", ->
|
|
71
71
|
describe "share provider", ->
|
72
72
|
|
73
73
|
it "expect fb_ui as default provider", ->
|
74
|
-
@share = new subject(@fb_fixture.
|
74
|
+
@share = new subject(@fb_fixture.fb_ui)
|
75
75
|
expect(@share.provider).toBe "fb_ui"
|
76
76
|
|
77
77
|
it "expect change provider to sharer on initialize", ->
|
@@ -79,19 +79,62 @@ describe "SharingTags.FacebookShare", ->
|
|
79
79
|
expect(@share.provider).toBe "sharer"
|
80
80
|
|
81
81
|
describe "events", ->
|
82
|
-
|
83
|
-
|
82
|
+
describe "after sharing event", ->
|
83
|
+
beforeEach ->
|
84
|
+
@fb = @fb_fixture.full
|
85
|
+
@share = new subject(@fb)
|
86
|
+
spyOn(@share, "_open_popup_check").andCallThrough()
|
87
|
+
spyOn(@share.callback, "after_sharing").andCallThrough()
|
88
|
+
spyOn(@share.callback, "before_sharing").andCallThrough()
|
89
|
+
spyOn(@share.callback, "trigger")
|
90
|
+
jasmine.Clock.useMock()
|
91
|
+
window.FB = jasmine.createSpyObj('FB', ['ui', 'init'])
|
92
|
+
|
93
|
+
afterEach ->
|
94
|
+
delete window.FB
|
95
|
+
|
96
|
+
it "expect called before_sharing on start sharing", ->
|
97
|
+
@share.share('fb_ui')
|
98
|
+
expect(@share.callback.before_sharing).toHaveBeenCalled()
|
99
|
+
expect(@share.callback.trigger).toHaveBeenCalled()
|
100
|
+
expect(@share.callback.trigger).toHaveBeenCalledWith("start_share", url: @fb.url, provider: "fb_ui")
|
101
|
+
|
102
|
+
it "expect calling callback for fb_ui", ->
|
103
|
+
FB.ui.andCallFake (params, callback)-> callback()
|
104
|
+
|
105
|
+
@share.share("fb_ui")
|
106
|
+
expect(@share.callback.after_sharing).toHaveBeenCalled()
|
107
|
+
expect(@share.callback.trigger).toHaveBeenCalledWith("start_share", url: @fb.url, provider: "fb_ui")
|
108
|
+
|
109
|
+
it "expect calling callback for sharer", ->
|
110
|
+
@share.share('sharer')
|
111
|
+
jasmine.Clock.tick(700)
|
112
|
+
expect(@share._open_popup_check).toHaveBeenCalled()
|
113
|
+
expect(@share.callback.trigger).toHaveBeenCalledWith("open_popup", url: jasmine.any(String), popup_window: jasmine.any(Object))
|
114
|
+
expect(@share.callback.after_sharing).not.toHaveBeenCalled()
|
115
|
+
|
116
|
+
jasmine.Clock.tick(500 * 5)
|
117
|
+
expect(@share.callback.after_sharing).toHaveBeenCalled()
|
118
|
+
|
119
|
+
it "expect calling callback for dialog 2.5sec", ->
|
120
|
+
@share.share('dialog')
|
121
|
+
expect(@share.callback.after_sharing).not.toHaveBeenCalled()
|
122
|
+
expect(@share.callback.trigger).toHaveBeenCalledWith("start_share", url: @fb.url, provider: "dialog")
|
123
|
+
|
124
|
+
jasmine.Clock.tick(500 * 5)
|
125
|
+
expect(@share.callback.after_sharing).toHaveBeenCalled()
|
126
|
+
expect(@share.callback.trigger).toHaveBeenCalledWith("open_popup", url: jasmine.any(String), popup_window: jasmine.any(Object))
|
84
127
|
|
85
128
|
describe "#_sharer", ->
|
86
129
|
beforeEach ->
|
87
130
|
@fb = @fb_fixture.sharer
|
88
131
|
@share = new subject(@fb)
|
89
|
-
spyOn(@share, "
|
132
|
+
spyOn(@share, "open_popup")
|
90
133
|
|
91
134
|
it "expect call open popup with params", ->
|
92
135
|
@share._sharer()
|
93
|
-
expect(@share.
|
94
|
-
expect(@share.
|
136
|
+
expect(@share.open_popup).toHaveBeenCalled()
|
137
|
+
expect(@share.open_popup).toHaveBeenCalledWith("http://www.facebook.com/sharer.php", u: @fb.url)
|
95
138
|
|
96
139
|
it "expect error if init without url", ->
|
97
140
|
delete @share.url
|
@@ -101,12 +144,12 @@ describe "SharingTags.FacebookShare", ->
|
|
101
144
|
beforeEach ->
|
102
145
|
@fb = @fb_fixture.dialog
|
103
146
|
@share = new subject(@fb)
|
104
|
-
spyOn(@share, "
|
147
|
+
spyOn(@share, "open_popup")
|
105
148
|
|
106
149
|
it "expect call open popup with params", ->
|
107
150
|
@share._dialog()
|
108
|
-
expect(@share.
|
109
|
-
expect(@share.
|
151
|
+
expect(@share.open_popup).toHaveBeenCalled()
|
152
|
+
expect(@share.open_popup).toHaveBeenCalledWith(
|
110
153
|
"http://www.facebook.com/dialog/share",
|
111
154
|
jasmine.objectContaining(href: @fb.url, redirect_uri: @fb.return_url, app_id: @fb.app_id, display: 'page')
|
112
155
|
)
|
@@ -159,15 +202,26 @@ describe "SharingTags.FacebookShare", ->
|
|
159
202
|
|
160
203
|
describe "#detect_provider", ->
|
161
204
|
|
162
|
-
it "expect
|
205
|
+
it "expect call detect provider for auto provider", ->
|
206
|
+
spyOn(subject.prototype, "detect_provider").andCallThrough()
|
163
207
|
@share = new subject(@fb_fixture.full)
|
208
|
+
expect(subject.prototype.detect_provider).toHaveBeenCalled()
|
209
|
+
|
210
|
+
it "expect not detect provider for defined provider", ->
|
211
|
+
spyOn(subject.prototype, "detect_provider")
|
212
|
+
|
213
|
+
@share = new subject(@fb_fixture.sharer)
|
214
|
+
expect(@share.detect_provider).not.toHaveBeenCalled()
|
215
|
+
|
216
|
+
it "expect to receive sharer provider for iOS Chrome browser", ->
|
217
|
+
@share = new subject(@fb_fixture.sharer)
|
164
218
|
ios_chrome_agent = "Mozilla/5.0 (iPhone; U; CPU iPhone OS 5_1_1 like Mac OS X; en) AppleWebKit/534.46.0 (KHTML, like Gecko) CriOS/19.0.1084.60 Mobile/9B206 Safari/7534.48.3"
|
165
219
|
spyOn(@share, "_user_agent").andReturn ios_chrome_agent
|
166
220
|
|
167
221
|
expect(@share.detect_provider()).toBe "sharer"
|
168
222
|
|
169
223
|
it "expect to receive fb_ui provider for sharing with app_id params", ->
|
170
|
-
@share = new subject(@fb_fixture.
|
224
|
+
@share = new subject(@fb_fixture.fb_ui)
|
171
225
|
expect(@share.app_id).toBeDefined()
|
172
226
|
expect(@share.detect_provider()).toBe "fb_ui"
|
173
227
|
|
@@ -178,5 +232,12 @@ describe "SharingTags.FacebookShare", ->
|
|
178
232
|
expect(@share.detect_provider()).toBe "dialog"
|
179
233
|
|
180
234
|
it "expect to receive fb_ui provider for sharing with app_id params", ->
|
235
|
+
delete @fb_fixture.partial.provider
|
236
|
+
@share = new subject(@fb_fixture.partial)
|
237
|
+
expect(@share.detect_provider()).toBe "sharer"
|
238
|
+
|
239
|
+
it "expect to receive fb_ui provider for sharing with app_id params", ->
|
240
|
+
delete @fb_fixture.partial.provider
|
181
241
|
@share = new subject(@fb_fixture.partial)
|
182
242
|
expect(@share.detect_provider()).toBe "sharer"
|
243
|
+
|