jekyll-swfobject 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +6 -0
- data/Gemfile +4 -0
- data/History.md +9 -0
- data/LICENSE.txt +22 -0
- data/README.md +160 -0
- data/Rakefile +12 -0
- data/jekyll-swfobject.gemspec +29 -0
- data/lib/jekyll-swfobject.rb +175 -0
- data/lib/jekyll-swfobject/version.rb +5 -0
- data/test/test_helper.rb +72 -0
- data/test/test_swfobject_tag_attributes.rb +604 -0
- data/test/test_swfobject_tag_config.rb +503 -0
- metadata +144 -0
data/test/test_helper.rb
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'test/unit/assertions'
|
3
|
+
require 'jekyll'
|
4
|
+
require_relative '../lib/jekyll-swfobject'
|
5
|
+
|
6
|
+
# Test assertion helper to check template result
|
7
|
+
# It is grabed from Shopify's test helper
|
8
|
+
# @see: https://github.com/Shopify/liquid/blob/master/test/test_helper.rb
|
9
|
+
module Test
|
10
|
+
module Unit
|
11
|
+
module Assertions
|
12
|
+
include Liquid
|
13
|
+
|
14
|
+
def assert_template_result(expected, template, assigns = {}, message = nil)
|
15
|
+
assert_equal expected, Template.parse(template).render(assigns)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
# Simple helper to provide mock data
|
22
|
+
module MockData
|
23
|
+
# default test data
|
24
|
+
def getDefaultData
|
25
|
+
data = {
|
26
|
+
:content_id => Jekyll::SWFObject::SWFObjectTag.DEFAULTS[:content_id],
|
27
|
+
:width => Jekyll::SWFObject::SWFObjectTag.DEFAULTS[:width],
|
28
|
+
:height => Jekyll::SWFObject::SWFObjectTag.DEFAULTS[:height],
|
29
|
+
:alternative_content => Jekyll::SWFObject::SWFObjectTag.DEFAULTS[:alternative_content],
|
30
|
+
:flashvars => 'var flashvars = {};',
|
31
|
+
:params => 'var params = {};',
|
32
|
+
:attributes => 'var attributes = {};',
|
33
|
+
:swf_url => 'url/of/any.swf',
|
34
|
+
:version => Jekyll::SWFObject::SWFObjectTag.DEFAULTS[:version],
|
35
|
+
:express_install_url => 'null',
|
36
|
+
:callback_function => 'null'
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
# Helper method to create expected output
|
41
|
+
def expected_output_by_test_data(data_to_merge=nil)
|
42
|
+
# use "raw" test data or merge data into it
|
43
|
+
data = (data_to_merge.nil?) ? @test_data : @test_data.merge!(data_to_merge)
|
44
|
+
|
45
|
+
output =
|
46
|
+
<<-EOS.gsub /^\s+/, '' # remove whitespaces from heredocs
|
47
|
+
<div id="#{data[:content_id]}-wrapper" style="width: #{data[:width]}; height: #{data[:height]}">
|
48
|
+
<div id="#{data[:content_id]}" style="width: 100%; height:100%">#{data[:alternative_content]}</div>
|
49
|
+
</div>
|
50
|
+
<script type="text/javascript">
|
51
|
+
// <![CDATA[
|
52
|
+
#{data[:flashvars]}
|
53
|
+
#{data[:params]}
|
54
|
+
#{data[:attributes]}
|
55
|
+
swfobject.embedSWF(
|
56
|
+
'#{data[:swf_url]}',
|
57
|
+
'#{data[:content_id]}',
|
58
|
+
'100%',
|
59
|
+
'100%',
|
60
|
+
'#{data[:version]}',
|
61
|
+
#{data[:express_install_url]},
|
62
|
+
flashvars,
|
63
|
+
params,
|
64
|
+
attributes,
|
65
|
+
#{data[:callback_function]}
|
66
|
+
);
|
67
|
+
// ]]>
|
68
|
+
</script>
|
69
|
+
EOS
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
@@ -0,0 +1,604 @@
|
|
1
|
+
require 'shoulda'
|
2
|
+
require_relative './test_helper'
|
3
|
+
|
4
|
+
class TestSWFObjectTagAttributes < Test::Unit::TestCase
|
5
|
+
|
6
|
+
include MockData
|
7
|
+
include Liquid
|
8
|
+
|
9
|
+
def setup
|
10
|
+
@test_data = getDefaultData().clone
|
11
|
+
end
|
12
|
+
|
13
|
+
# tests of attributes defined in template
|
14
|
+
# ---------------------------------------------
|
15
|
+
|
16
|
+
context 'template with attributes' do
|
17
|
+
should 'uses default values' do
|
18
|
+
expected = expected_output_by_test_data()
|
19
|
+
template = "{% swfobject #{@test_data[:swf_url]} %}{% endswfobject %}"
|
20
|
+
assert_template_result expected, template
|
21
|
+
end
|
22
|
+
|
23
|
+
should 'render a custom swf url' do
|
24
|
+
swf_url = 'another/path/to.swf'
|
25
|
+
expected = expected_output_by_test_data({:swf_url => swf_url})
|
26
|
+
template = "{% swfobject #{swf_url} %}{% endswfobject %}"
|
27
|
+
assert_template_result expected, template
|
28
|
+
end
|
29
|
+
|
30
|
+
should 'render a custom content_id' do
|
31
|
+
content_id = 'halli-galli-id'
|
32
|
+
expected = expected_output_by_test_data({:content_id => content_id})
|
33
|
+
template = "{% swfobject #{@test_data[:swf_url]} content_id:#{content_id} %}{% endswfobject %}"
|
34
|
+
assert_template_result expected, template
|
35
|
+
end
|
36
|
+
|
37
|
+
should 'render a custom width' do
|
38
|
+
width = '23px'
|
39
|
+
expected = expected_output_by_test_data({:width => width})
|
40
|
+
template = "{% swfobject #{@test_data[:swf_url]} width:#{width} %}{% endswfobject %}"
|
41
|
+
assert_template_result expected, template
|
42
|
+
end
|
43
|
+
|
44
|
+
should 'render a custom height' do
|
45
|
+
height = '44px'
|
46
|
+
expected = expected_output_by_test_data({:height => height})
|
47
|
+
template = "{% swfobject #{@test_data[:swf_url]} height:#{height} %}{% endswfobject %}"
|
48
|
+
assert_template_result expected, template
|
49
|
+
end
|
50
|
+
|
51
|
+
should 'render an alternative content' do
|
52
|
+
alternative_content = '<p>any other alternative content</p>'
|
53
|
+
expected = expected_output_by_test_data({:alternative_content => alternative_content})
|
54
|
+
template = "{% swfobject #{@test_data[:swf_url]} %}#{alternative_content}{% endswfobject %}"
|
55
|
+
assert_template_result expected, template
|
56
|
+
end
|
57
|
+
|
58
|
+
should 'render a custom flash version' do
|
59
|
+
version = '11.4'
|
60
|
+
expected = expected_output_by_test_data({:version => version})
|
61
|
+
template = "{% swfobject #{@test_data[:swf_url]} version:#{version}%}{% endswfobject %}"
|
62
|
+
assert_template_result expected, template
|
63
|
+
end
|
64
|
+
|
65
|
+
should 'render a custom flashvar' do
|
66
|
+
varA = 'varA'
|
67
|
+
valueA = 'valueA'
|
68
|
+
flashVars = "var flashvars = {#{varA}:'#{valueA}'};"
|
69
|
+
expected = expected_output_by_test_data({:flashvars => flashVars})
|
70
|
+
template = "{% swfobject #{@test_data[:swf_url]} flashvars:#{varA}=#{valueA}%}{% endswfobject %}"
|
71
|
+
assert_template_result expected, template
|
72
|
+
end
|
73
|
+
|
74
|
+
should 'render few custom flashvars' do
|
75
|
+
varA = 'varA'
|
76
|
+
valueA = 'valueA'
|
77
|
+
varB = 'varB'
|
78
|
+
valueB = 'valueB'
|
79
|
+
flashVars = "var flashvars = {#{varA}:'#{valueA}',#{varB}:'#{valueB}'};"
|
80
|
+
expected = expected_output_by_test_data({:flashvars => flashVars})
|
81
|
+
template = "{% swfobject #{@test_data[:swf_url]} flashvars:#{varA}=#{valueA}&#{varB}=#{valueB}%}{% endswfobject %}"
|
82
|
+
assert_template_result expected, template
|
83
|
+
end
|
84
|
+
|
85
|
+
should 'render attribute id' do
|
86
|
+
attribute = 'id'
|
87
|
+
value = 'any-id'
|
88
|
+
attributes = "var attributes = {#{attribute}:'#{value}'};"
|
89
|
+
expected = expected_output_by_test_data({:attributes => attributes})
|
90
|
+
template = "{% swfobject #{@test_data[:swf_url]} #{attribute}:#{value} %}{% endswfobject %}"
|
91
|
+
assert_template_result expected, template
|
92
|
+
end
|
93
|
+
|
94
|
+
should 'render attribute align' do
|
95
|
+
attribute = 'align'
|
96
|
+
value = 'l'
|
97
|
+
attributes = "var attributes = {#{attribute}:'#{value}'};"
|
98
|
+
expected = expected_output_by_test_data({:attributes => attributes})
|
99
|
+
template = "{% swfobject #{@test_data[:swf_url]} #{attribute}:#{value} %}{% endswfobject %}"
|
100
|
+
assert_template_result expected, template
|
101
|
+
end
|
102
|
+
|
103
|
+
should 'render attribute name' do
|
104
|
+
attribute = 'name'
|
105
|
+
value = 'any-name'
|
106
|
+
attributes = "var attributes = {#{attribute}:'#{value}'};"
|
107
|
+
expected = expected_output_by_test_data({:attributes => attributes})
|
108
|
+
template = "{% swfobject #{@test_data[:swf_url]} #{attribute}:#{value} %}{% endswfobject %}"
|
109
|
+
assert_template_result expected, template
|
110
|
+
end
|
111
|
+
|
112
|
+
should 'render attribute styleclass' do
|
113
|
+
attribute = 'styleclass'
|
114
|
+
value = 'any-class'
|
115
|
+
attributes = "var attributes = {#{attribute}:'#{value}'};"
|
116
|
+
expected = expected_output_by_test_data({:attributes => attributes})
|
117
|
+
template = "{% swfobject #{@test_data[:swf_url]} #{attribute}:#{value} %}{% endswfobject %}"
|
118
|
+
assert_template_result expected, template
|
119
|
+
end
|
120
|
+
|
121
|
+
should 'render few custom attributes' do
|
122
|
+
attribute_id = 'id'
|
123
|
+
value_id = 'any-id'
|
124
|
+
attribute_align = 'align'
|
125
|
+
value_align = 'center'
|
126
|
+
attributes = "var attributes = {#{attribute_id}:'#{value_id}',#{attribute_align}:'#{value_align}'};"
|
127
|
+
expected = expected_output_by_test_data({:attributes => attributes})
|
128
|
+
template = "{% swfobject #{@test_data[:swf_url]} #{attribute_id}:#{value_id} #{attribute_align}:#{value_align} %}{% endswfobject %}"
|
129
|
+
assert_template_result expected, template
|
130
|
+
end
|
131
|
+
|
132
|
+
should 'render param play' do
|
133
|
+
param = 'play'
|
134
|
+
value = 'true'
|
135
|
+
rendered_params = "var params = {#{param}:'#{value}'};"
|
136
|
+
expected = expected_output_by_test_data({:params => rendered_params})
|
137
|
+
template = "{% swfobject #{@test_data[:swf_url]} #{param}:#{value} %}{% endswfobject %}"
|
138
|
+
assert_template_result expected, template
|
139
|
+
end
|
140
|
+
|
141
|
+
should 'render param loop' do
|
142
|
+
param = 'loop'
|
143
|
+
value = 'false'
|
144
|
+
rendered_params = "var params = {#{param}:'#{value}'};"
|
145
|
+
expected = expected_output_by_test_data({:params => rendered_params})
|
146
|
+
template = "{% swfobject #{@test_data[:swf_url]} #{param}:#{value} %}{% endswfobject %}"
|
147
|
+
assert_template_result expected, template
|
148
|
+
end
|
149
|
+
|
150
|
+
should 'render param menu' do
|
151
|
+
param = 'menu'
|
152
|
+
value = 'false'
|
153
|
+
rendered_params = "var params = {#{param}:'#{value}'};"
|
154
|
+
expected = expected_output_by_test_data({:params => rendered_params})
|
155
|
+
template = "{% swfobject #{@test_data[:swf_url]} #{param}:#{value} %}{% endswfobject %}"
|
156
|
+
assert_template_result expected, template
|
157
|
+
end
|
158
|
+
|
159
|
+
should 'render param quality' do
|
160
|
+
param = 'quality'
|
161
|
+
value = 'best'
|
162
|
+
rendered_params = "var params = {#{param}:'#{value}'};"
|
163
|
+
expected = expected_output_by_test_data({:params => rendered_params})
|
164
|
+
template = "{% swfobject #{@test_data[:swf_url]} #{param}:#{value} %}{% endswfobject %}"
|
165
|
+
assert_template_result expected, template
|
166
|
+
end
|
167
|
+
|
168
|
+
should 'render param scale' do
|
169
|
+
param = 'scale'
|
170
|
+
value = 'exactfit'
|
171
|
+
rendered_params = "var params = {#{param}:'#{value}'};"
|
172
|
+
expected = expected_output_by_test_data({:params => rendered_params})
|
173
|
+
template = "{% swfobject #{@test_data[:swf_url]} #{param}:#{value} %}{% endswfobject %}"
|
174
|
+
assert_template_result expected, template
|
175
|
+
end
|
176
|
+
|
177
|
+
should 'render param salign' do
|
178
|
+
param = 'salign'
|
179
|
+
value = 'tr'
|
180
|
+
rendered_params = "var params = {#{param}:'#{value}'};"
|
181
|
+
expected = expected_output_by_test_data({:params => rendered_params})
|
182
|
+
template = "{% swfobject #{@test_data[:swf_url]} #{param}:#{value} %}{% endswfobject %}"
|
183
|
+
assert_template_result expected, template
|
184
|
+
end
|
185
|
+
|
186
|
+
should 'render param wmode' do
|
187
|
+
param = 'wmode'
|
188
|
+
value = 'window'
|
189
|
+
rendered_params = "var params = {#{param}:'#{value}'};"
|
190
|
+
expected = expected_output_by_test_data({:params => rendered_params})
|
191
|
+
template = "{% swfobject #{@test_data[:swf_url]} #{param}:#{value} %}{% endswfobject %}"
|
192
|
+
assert_template_result expected, template
|
193
|
+
end
|
194
|
+
|
195
|
+
should 'render param bgcolor' do
|
196
|
+
param = 'bgcolor'
|
197
|
+
value = '#FFF'
|
198
|
+
rendered_params = "var params = {#{param}:'#{value}'};"
|
199
|
+
expected = expected_output_by_test_data({:params => rendered_params})
|
200
|
+
template = "{% swfobject #{@test_data[:swf_url]} #{param}:#{value} %}{% endswfobject %}"
|
201
|
+
assert_template_result expected, template
|
202
|
+
end
|
203
|
+
|
204
|
+
should 'render param base' do
|
205
|
+
param = 'base'
|
206
|
+
value = 'http://any-base-url.com'
|
207
|
+
rendered_params = "var params = {#{param}:'#{value}'};"
|
208
|
+
expected = expected_output_by_test_data({:params => rendered_params})
|
209
|
+
template = "{% swfobject #{@test_data[:swf_url]} #{param}:#{value} %}{% endswfobject %}"
|
210
|
+
assert_template_result expected, template
|
211
|
+
end
|
212
|
+
|
213
|
+
should 'render param swliveconnect' do
|
214
|
+
param = 'swliveconnect'
|
215
|
+
value = 'true'
|
216
|
+
rendered_params = "var params = {#{param}:'#{value}'};"
|
217
|
+
expected = expected_output_by_test_data({:params => rendered_params})
|
218
|
+
template = "{% swfobject #{@test_data[:swf_url]} #{param}:#{value} %}{% endswfobject %}"
|
219
|
+
assert_template_result expected, template
|
220
|
+
end
|
221
|
+
|
222
|
+
should 'render param devicefont' do
|
223
|
+
param = 'devicefont'
|
224
|
+
value = 'false'
|
225
|
+
rendered_params = "var params = {#{param}:'#{value}'};"
|
226
|
+
expected = expected_output_by_test_data({:params => rendered_params})
|
227
|
+
template = "{% swfobject #{@test_data[:swf_url]} #{param}:#{value} %}{% endswfobject %}"
|
228
|
+
assert_template_result expected, template
|
229
|
+
end
|
230
|
+
|
231
|
+
should 'render param allowscriptaccess' do
|
232
|
+
param = 'allowscriptaccess'
|
233
|
+
value = 'sameDomain'
|
234
|
+
rendered_params = "var params = {#{param}:'#{value}'};"
|
235
|
+
expected = expected_output_by_test_data({:params => rendered_params})
|
236
|
+
template = "{% swfobject #{@test_data[:swf_url]} #{param}:#{value} %}{% endswfobject %}"
|
237
|
+
assert_template_result expected, template
|
238
|
+
end
|
239
|
+
|
240
|
+
should 'render param seamlesstabbing' do
|
241
|
+
param = 'seamlesstabbing'
|
242
|
+
value = 'false'
|
243
|
+
rendered_params = "var params = {#{param}:'#{value}'};"
|
244
|
+
expected = expected_output_by_test_data({:params => rendered_params})
|
245
|
+
template = "{% swfobject #{@test_data[:swf_url]} #{param}:#{value} %}{% endswfobject %}"
|
246
|
+
assert_template_result expected, template
|
247
|
+
end
|
248
|
+
|
249
|
+
should 'render param allowfullscreen' do
|
250
|
+
param = 'allowfullscreen'
|
251
|
+
value = 'true'
|
252
|
+
rendered_params = "var params = {#{param}:'#{value}'};"
|
253
|
+
expected = expected_output_by_test_data({:params => rendered_params})
|
254
|
+
template = "{% swfobject #{@test_data[:swf_url]} #{param}:#{value} %}{% endswfobject %}"
|
255
|
+
assert_template_result expected, template
|
256
|
+
end
|
257
|
+
|
258
|
+
should 'render param allownetworking' do
|
259
|
+
param = 'allownetworking'
|
260
|
+
value = 'none'
|
261
|
+
rendered_params = "var params = {#{param}:'#{value}'};"
|
262
|
+
expected = expected_output_by_test_data({:params => rendered_params})
|
263
|
+
template = "{% swfobject #{@test_data[:swf_url]} #{param}:#{value} %}{% endswfobject %}"
|
264
|
+
assert_template_result expected, template
|
265
|
+
end
|
266
|
+
|
267
|
+
should 'render few custom params' do
|
268
|
+
attributeA = 'allowfullscreen'
|
269
|
+
valueA = 'true'
|
270
|
+
attributeB = 'allownetworking'
|
271
|
+
valueB = 'false'
|
272
|
+
rendered_params = "var params = {#{attributeA}:'#{valueA}',#{attributeB}:'#{valueB}'};"
|
273
|
+
expected = expected_output_by_test_data({:params => rendered_params})
|
274
|
+
template = "{% swfobject #{@test_data[:swf_url]} #{attributeA}:#{valueA} #{attributeB}:#{valueB} %}{% endswfobject %}"
|
275
|
+
assert_template_result expected, template
|
276
|
+
end
|
277
|
+
|
278
|
+
end
|
279
|
+
|
280
|
+
# tests of attributes defined _config.yml
|
281
|
+
# ---------------------------------------------
|
282
|
+
|
283
|
+
context 'template with attributes defined in Jekylls configuration (_config.yml)' do
|
284
|
+
should 'uses default values' do
|
285
|
+
expected = expected_output_by_test_data()
|
286
|
+
template = "{% swfobject #{@test_data[:swf_url]} %}{% endswfobject %}"
|
287
|
+
assert_template_result expected, template
|
288
|
+
end
|
289
|
+
|
290
|
+
should 'render a custom swf url' do
|
291
|
+
swf_url = 'another/path/to.swf'
|
292
|
+
@custom_config = {
|
293
|
+
:swf_url => swf_url
|
294
|
+
}
|
295
|
+
Jekyll.stubs(:configuration).returns({'swfobject' => @custom_config})
|
296
|
+
expected = expected_output_by_test_data(@custom_config)
|
297
|
+
template = "{% swfobject #{swf_url} %}{% endswfobject %}"
|
298
|
+
assert_template_result expected, template
|
299
|
+
end
|
300
|
+
|
301
|
+
should 'render a custom content_id' do
|
302
|
+
content_id = 'halli-galli-id'
|
303
|
+
@custom_config = {
|
304
|
+
:content_id => content_id
|
305
|
+
}
|
306
|
+
Jekyll.stubs(:configuration).returns({'swfobject' => @custom_config})
|
307
|
+
expected = expected_output_by_test_data(@custom_config)
|
308
|
+
template = "{% swfobject #{@test_data[:swf_url]} content_id:#{content_id} %}{% endswfobject %}"
|
309
|
+
assert_template_result expected, template
|
310
|
+
end
|
311
|
+
|
312
|
+
should 'render a custom width' do
|
313
|
+
width = '23px'
|
314
|
+
@custom_config = {
|
315
|
+
:width => width
|
316
|
+
}
|
317
|
+
Jekyll.stubs(:configuration).returns({'swfobject' => @custom_config})
|
318
|
+
expected = expected_output_by_test_data(@custom_config)
|
319
|
+
template = "{% swfobject #{@test_data[:swf_url]} width:#{width} %}{% endswfobject %}"
|
320
|
+
assert_template_result expected, template
|
321
|
+
end
|
322
|
+
|
323
|
+
should 'render a custom height' do
|
324
|
+
height = '44px'
|
325
|
+
@custom_config = {
|
326
|
+
:height => height
|
327
|
+
}
|
328
|
+
Jekyll.stubs(:configuration).returns({'swfobject' => @custom_config})
|
329
|
+
expected = expected_output_by_test_data(@custom_config)
|
330
|
+
template = "{% swfobject #{@test_data[:swf_url]} height:#{height} %}{% endswfobject %}"
|
331
|
+
assert_template_result expected, template
|
332
|
+
end
|
333
|
+
|
334
|
+
should 'render an alternative content' do
|
335
|
+
alternative_content = '<p>An alternative content defined in _config.yml</p>'
|
336
|
+
@custom_config = {
|
337
|
+
:alternative_content => alternative_content
|
338
|
+
}
|
339
|
+
Jekyll.stubs(:configuration).returns({'swfobject' => @custom_config})
|
340
|
+
expected = expected_output_by_test_data(@custom_config)
|
341
|
+
template = "{% swfobject #{@test_data[:swf_url]} %}#{alternative_content}{% endswfobject %}"
|
342
|
+
assert_template_result expected, template
|
343
|
+
end
|
344
|
+
|
345
|
+
should 'render a custom flash version' do
|
346
|
+
version = '11.1'
|
347
|
+
@custom_config = {
|
348
|
+
:version => version
|
349
|
+
}
|
350
|
+
Jekyll.stubs(:configuration).returns({'swfobject' => @custom_config})
|
351
|
+
expected = expected_output_by_test_data(@custom_config)
|
352
|
+
template = "{% swfobject #{@test_data[:swf_url]} version:#{version}%}{% endswfobject %}"
|
353
|
+
assert_template_result expected, template
|
354
|
+
end
|
355
|
+
|
356
|
+
should 'render a custom flashvar' do
|
357
|
+
varA = 'varA'
|
358
|
+
valueA = 'valueA'
|
359
|
+
flashvars = "var flashvars = {#{varA}:'#{valueA}'};"
|
360
|
+
@custom_config = {
|
361
|
+
:flashvars => flashvars
|
362
|
+
}
|
363
|
+
Jekyll.stubs(:configuration).returns({'swfobject' => @custom_config})
|
364
|
+
expected = expected_output_by_test_data(@custom_config)
|
365
|
+
template = "{% swfobject #{@test_data[:swf_url]} flashvars:#{varA}=#{valueA}%}{% endswfobject %}"
|
366
|
+
assert_template_result expected, template
|
367
|
+
end
|
368
|
+
|
369
|
+
should 'render few custom flashvars' do
|
370
|
+
varA = 'varA'
|
371
|
+
valueA = 'valueA'
|
372
|
+
varB = 'varB'
|
373
|
+
valueB = 'valueB'
|
374
|
+
flashvars = "var flashvars = {#{varA}:'#{valueA}',#{varB}:'#{valueB}'};"
|
375
|
+
@custom_config = {
|
376
|
+
:flashvars => flashvars
|
377
|
+
}
|
378
|
+
Jekyll.stubs(:configuration).returns({'swfobject' => @custom_config})
|
379
|
+
expected = expected_output_by_test_data(@custom_config)
|
380
|
+
template = "{% swfobject #{@test_data[:swf_url]} flashvars:#{varA}=#{valueA}&#{varB}=#{valueB}%}{% endswfobject %}"
|
381
|
+
assert_template_result expected, template
|
382
|
+
end
|
383
|
+
|
384
|
+
should 'render attribute id' do
|
385
|
+
attribute = 'id'
|
386
|
+
value = 'any-id'
|
387
|
+
attributes = "var attributes = {#{attribute}:'#{value}'};"
|
388
|
+
@custom_config = {
|
389
|
+
:attributes => attributes
|
390
|
+
}
|
391
|
+
Jekyll.stubs(:configuration).returns({'swfobject' => @custom_config})
|
392
|
+
expected = expected_output_by_test_data(@custom_config)
|
393
|
+
template = "{% swfobject #{@test_data[:swf_url]} #{attribute}:#{value} %}{% endswfobject %}"
|
394
|
+
assert_template_result expected, template
|
395
|
+
end
|
396
|
+
|
397
|
+
should 'render attribute align' do
|
398
|
+
attribute = 'align'
|
399
|
+
value = 'l'
|
400
|
+
attributes = "var attributes = {#{attribute}:'#{value}'};"
|
401
|
+
@custom_config = {
|
402
|
+
:attributes => attributes
|
403
|
+
}
|
404
|
+
Jekyll.stubs(:configuration).returns({'swfobject' => @custom_config})
|
405
|
+
expected = expected_output_by_test_data(@custom_config)
|
406
|
+
template = "{% swfobject #{@test_data[:swf_url]} #{attribute}:#{value} %}{% endswfobject %}"
|
407
|
+
assert_template_result expected, template
|
408
|
+
end
|
409
|
+
|
410
|
+
should 'render attribute name' do
|
411
|
+
attribute = 'name'
|
412
|
+
value = 'any-name'
|
413
|
+
attributes = "var attributes = {#{attribute}:'#{value}'};"
|
414
|
+
@custom_config = {
|
415
|
+
:attributes => attributes
|
416
|
+
}
|
417
|
+
Jekyll.stubs(:configuration).returns({'swfobject' => @custom_config})
|
418
|
+
expected = expected_output_by_test_data(@custom_config)
|
419
|
+
template = "{% swfobject #{@test_data[:swf_url]} #{attribute}:#{value} %}{% endswfobject %}"
|
420
|
+
assert_template_result expected, template
|
421
|
+
end
|
422
|
+
|
423
|
+
should 'render attribute styleclass' do
|
424
|
+
attribute = 'styleclass'
|
425
|
+
value = 'any-class'
|
426
|
+
attributes = "var attributes = {#{attribute}:'#{value}'};"
|
427
|
+
@custom_config = {
|
428
|
+
:attributes => attributes
|
429
|
+
}
|
430
|
+
Jekyll.stubs(:configuration).returns({'swfobject' => @custom_config})
|
431
|
+
expected = expected_output_by_test_data(@custom_config)
|
432
|
+
template = "{% swfobject #{@test_data[:swf_url]} #{attribute}:#{value} %}{% endswfobject %}"
|
433
|
+
assert_template_result expected, template
|
434
|
+
end
|
435
|
+
|
436
|
+
should 'render few custom attributes' do
|
437
|
+
attribute_id = 'id'
|
438
|
+
value_id = 'any-id'
|
439
|
+
attribute_align = 'align'
|
440
|
+
value_align = 'center'
|
441
|
+
attributes = "var attributes = {#{attribute_id}:'#{value_id}',#{attribute_align}:'#{value_align}'};"
|
442
|
+
@custom_config = {
|
443
|
+
:attributes => attributes
|
444
|
+
}
|
445
|
+
Jekyll.stubs(:configuration).returns({'swfobject' => @custom_config})
|
446
|
+
expected = expected_output_by_test_data(@custom_config)
|
447
|
+
template = "{% swfobject #{@test_data[:swf_url]} #{attribute_id}:#{value_id} #{attribute_align}:#{value_align} %}{% endswfobject %}"
|
448
|
+
assert_template_result expected, template
|
449
|
+
end
|
450
|
+
|
451
|
+
should 'render param play' do
|
452
|
+
param = 'play'
|
453
|
+
value = 'true'
|
454
|
+
rendered_params = "var params = {#{param}:'#{value}'};"
|
455
|
+
@custom_config = {
|
456
|
+
:params => rendered_params
|
457
|
+
}
|
458
|
+
Jekyll.stubs(:configuration).returns({'swfobject' => @custom_config})
|
459
|
+
expected = expected_output_by_test_data(@custom_config)
|
460
|
+
template = "{% swfobject #{@test_data[:swf_url]} #{param}:#{value} %}{% endswfobject %}"
|
461
|
+
assert_template_result expected, template
|
462
|
+
end
|
463
|
+
|
464
|
+
should 'render param loop' do
|
465
|
+
param = 'loop'
|
466
|
+
value = 'false'
|
467
|
+
rendered_params = "var params = {#{param}:'#{value}'};"
|
468
|
+
@custom_config = {
|
469
|
+
:params => rendered_params
|
470
|
+
}
|
471
|
+
Jekyll.stubs(:configuration).returns({'swfobject' => @custom_config})
|
472
|
+
expected = expected_output_by_test_data(@custom_config)
|
473
|
+
template = "{% swfobject #{@test_data[:swf_url]} #{param}:#{value} %}{% endswfobject %}"
|
474
|
+
assert_template_result expected, template
|
475
|
+
end
|
476
|
+
|
477
|
+
should 'render param menu' do
|
478
|
+
param = 'menu'
|
479
|
+
value = 'false'
|
480
|
+
rendered_params = "var params = {#{param}:'#{value}'};"
|
481
|
+
@custom_config = {
|
482
|
+
:params => rendered_params
|
483
|
+
}
|
484
|
+
Jekyll.stubs(:configuration).returns({'swfobject' => @custom_config})
|
485
|
+
expected = expected_output_by_test_data(@custom_config)
|
486
|
+
template = "{% swfobject #{@test_data[:swf_url]} #{param}:#{value} %}{% endswfobject %}"
|
487
|
+
assert_template_result expected, template
|
488
|
+
end
|
489
|
+
|
490
|
+
should 'render param quality' do
|
491
|
+
param = 'quality'
|
492
|
+
value = 'best'
|
493
|
+
rendered_params = "var params = {#{param}:'#{value}'};"
|
494
|
+
@custom_config = {
|
495
|
+
:params => rendered_params
|
496
|
+
}
|
497
|
+
Jekyll.stubs(:configuration).returns({'swfobject' => @custom_config})
|
498
|
+
expected = expected_output_by_test_data(@custom_config)
|
499
|
+
template = "{% swfobject #{@test_data[:swf_url]} #{param}:#{value} %}{% endswfobject %}"
|
500
|
+
assert_template_result expected, template
|
501
|
+
end
|
502
|
+
|
503
|
+
should 'render param scale' do
|
504
|
+
param = 'scale'
|
505
|
+
value = 'exactfit'
|
506
|
+
rendered_params = "var params = {#{param}:'#{value}'};"
|
507
|
+
@custom_config = {
|
508
|
+
:params => rendered_params
|
509
|
+
}
|
510
|
+
Jekyll.stubs(:configuration).returns({'swfobject' => @custom_config})
|
511
|
+
expected = expected_output_by_test_data(@custom_config)
|
512
|
+
template = "{% swfobject #{@test_data[:swf_url]} #{param}:#{value} %}{% endswfobject %}"
|
513
|
+
assert_template_result expected, template
|
514
|
+
end
|
515
|
+
|
516
|
+
should 'render param salign' do
|
517
|
+
param = 'salign'
|
518
|
+
value = 'tr'
|
519
|
+
rendered_params = "var params = {#{param}:'#{value}'};"
|
520
|
+
@custom_config = {
|
521
|
+
:params => rendered_params
|
522
|
+
}
|
523
|
+
Jekyll.stubs(:configuration).returns({'swfobject' => @custom_config})
|
524
|
+
expected = expected_output_by_test_data(@custom_config)
|
525
|
+
template = "{% swfobject #{@test_data[:swf_url]} #{param}:#{value} %}{% endswfobject %}"
|
526
|
+
assert_template_result expected, template
|
527
|
+
end
|
528
|
+
|
529
|
+
should 'render param wmode' do
|
530
|
+
param = 'wmode'
|
531
|
+
value = 'window'
|
532
|
+
rendered_params = "var params = {#{param}:'#{value}'};"
|
533
|
+
@custom_config = {
|
534
|
+
:params => rendered_params
|
535
|
+
}
|
536
|
+
Jekyll.stubs(:configuration).returns({'swfobject' => @custom_config})
|
537
|
+
expected = expected_output_by_test_data(@custom_config)
|
538
|
+
template = "{% swfobject #{@test_data[:swf_url]} #{param}:#{value} %}{% endswfobject %}"
|
539
|
+
assert_template_result expected, template
|
540
|
+
end
|
541
|
+
|
542
|
+
should 'render param bgcolor' do
|
543
|
+
param = 'bgcolor'
|
544
|
+
value = '#FFF'
|
545
|
+
rendered_params = "var params = {#{param}:'#{value}'};"
|
546
|
+
@custom_config = {
|
547
|
+
:params => rendered_params
|
548
|
+
}
|
549
|
+
Jekyll.stubs(:configuration).returns({'swfobject' => @custom_config})
|
550
|
+
expected = expected_output_by_test_data(@custom_config)
|
551
|
+
template = "{% swfobject #{@test_data[:swf_url]} #{param}:#{value} %}{% endswfobject %}"
|
552
|
+
assert_template_result expected, template
|
553
|
+
end
|
554
|
+
|
555
|
+
should 'render param base' do
|
556
|
+
param = 'base'
|
557
|
+
value = 'http://any-base-url.com'
|
558
|
+
rendered_params = "var params = {#{param}:'#{value}'};"
|
559
|
+
@custom_config = {
|
560
|
+
:params => rendered_params
|
561
|
+
}
|
562
|
+
Jekyll.stubs(:configuration).returns({'swfobject' => @custom_config})
|
563
|
+
expected = expected_output_by_test_data(@custom_config)
|
564
|
+
template = "{% swfobject #{@test_data[:swf_url]} #{param}:#{value} %}{% endswfobject %}"
|
565
|
+
assert_template_result expected, template
|
566
|
+
end
|
567
|
+
|
568
|
+
should 'render param swliveconnect' do
|
569
|
+
param = 'swliveconnect'
|
570
|
+
value = 'true'
|
571
|
+
rendered_params = "var params = {#{param}:'#{value}'};"
|
572
|
+
@custom_config = {
|
573
|
+
:params => rendered_params
|
574
|
+
}
|
575
|
+
Jekyll.stubs(:configuration).returns({'swfobject' => @custom_config})
|
576
|
+
expected = expected_output_by_test_data(@custom_config)
|
577
|
+
template = "{% swfobject #{@test_data[:swf_url]} #{param}:#{value} %}{% endswfobject %}"
|
578
|
+
assert_template_result expected, template
|
579
|
+
end
|
580
|
+
|
581
|
+
should 'render param devicefont' do
|
582
|
+
param = 'devicefont'
|
583
|
+
value = 'false'
|
584
|
+
rendered_params = "var params = {#{param}:'#{value}'};"
|
585
|
+
@custom_config = {
|
586
|
+
:params => rendered_params
|
587
|
+
}
|
588
|
+
Jekyll.stubs(:configuration).returns({'swfobject' => @custom_config})
|
589
|
+
expected = expected_output_by_test_data(@custom_config)
|
590
|
+
template = "{% swfobject #{@test_data[:swf_url]} #{param}:#{value} %}{% endswfobject %}"
|
591
|
+
assert_template_result expected, template
|
592
|
+
end
|
593
|
+
|
594
|
+
should 'NOT render a value, which are not supported' do
|
595
|
+
attribute = 'halligalli'
|
596
|
+
value = 'true'
|
597
|
+
template = "{% swfobject #{@test_data[:swf_url]} #{attribute}:#{value} %}{% endswfobject %}"
|
598
|
+
rendered = Template.parse(template).render({})
|
599
|
+
assert(!rendered.include?(attribute))
|
600
|
+
end
|
601
|
+
|
602
|
+
end
|
603
|
+
|
604
|
+
end
|