inkcite 1.15.0 → 1.16.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +1 -1
  3. data/inkcite.gemspec +0 -3
  4. data/lib/inkcite.rb +0 -1
  5. data/lib/inkcite/cli/base.rb +12 -8
  6. data/lib/inkcite/cli/preview.rb +0 -10
  7. data/lib/inkcite/cli/server.rb +9 -1
  8. data/lib/inkcite/email.rb +5 -10
  9. data/lib/inkcite/facade/animation.rb +4 -1
  10. data/lib/inkcite/image_minifier.rb +96 -0
  11. data/lib/inkcite/mailer.rb +2 -2
  12. data/lib/inkcite/minifier.rb +1 -1
  13. data/lib/inkcite/renderer.rb +10 -0
  14. data/lib/inkcite/renderer/base.rb +47 -2
  15. data/lib/inkcite/renderer/button.rb +15 -5
  16. data/lib/inkcite/renderer/container_base.rb +15 -1
  17. data/lib/inkcite/renderer/image.rb +1 -1
  18. data/lib/inkcite/renderer/image_base.rb +8 -0
  19. data/lib/inkcite/renderer/list.rb +104 -0
  20. data/lib/inkcite/renderer/mobile_image.rb +3 -0
  21. data/lib/inkcite/renderer/responsive.rb +2 -0
  22. data/lib/inkcite/renderer/slant.rb +207 -0
  23. data/lib/inkcite/renderer/snow.rb +15 -1
  24. data/lib/inkcite/renderer/special_effect.rb +7 -0
  25. data/lib/inkcite/renderer/sup.rb +18 -4
  26. data/lib/inkcite/renderer/table.rb +9 -1
  27. data/lib/inkcite/renderer/table_base.rb +20 -2
  28. data/lib/inkcite/renderer/td.rb +7 -2
  29. data/lib/inkcite/renderer/video_preview.rb +1 -1
  30. data/lib/inkcite/uploader.rb +40 -27
  31. data/lib/inkcite/version.rb +1 -1
  32. data/lib/inkcite/view.rb +133 -13
  33. data/lib/inkcite/view/context.rb +6 -1
  34. data/lib/inkcite/view/developer_scripts.rb +56 -0
  35. data/test/renderer/background_spec.rb +4 -4
  36. data/test/renderer/button_spec.rb +14 -8
  37. data/test/renderer/div_spec.rb +26 -3
  38. data/test/renderer/image_spec.rb +9 -4
  39. data/test/renderer/list_spec.rb +36 -0
  40. data/test/renderer/mobile_image_spec.rb +5 -0
  41. data/test/renderer/slant_spec.rb +47 -0
  42. data/test/renderer/span_spec.rb +12 -1
  43. data/test/renderer/table_spec.rb +1 -1
  44. data/test/renderer/td_spec.rb +24 -8
  45. data/test/renderer/trademark_spec.rb +6 -6
  46. metadata +11 -50
  47. data/lib/inkcite/image/base.rb +0 -38
  48. data/lib/inkcite/image/guetzli_minifier.rb +0 -62
  49. data/lib/inkcite/image/image_minifier.rb +0 -143
  50. data/lib/inkcite/image/image_optim_minifier.rb +0 -90
  51. data/lib/inkcite/image/mozjpeg_minifier.rb +0 -92
@@ -18,7 +18,12 @@ module Inkcite
18
18
 
19
19
  @view.version == symbol
20
20
  else
21
- super
21
+
22
+ # Check for variables/helpers when an unknown token
23
+ # is encountered. Allows for accessing values defined
24
+ # in helper.tsv directly in ERB code.
25
+ config_value = @view[m]
26
+
22
27
  end
23
28
  end
24
29
 
@@ -0,0 +1,56 @@
1
+ module Inkcite
2
+ class View
3
+ class DeveloperScripts
4
+
5
+ def self.install! view
6
+
7
+ email = view.email
8
+
9
+ # Determine the index of the version is currently being displayed
10
+ version = view.version
11
+ versions = email.versions
12
+ version_count = versions.count - 1
13
+ version_index = versions.index(version)
14
+
15
+ # Determine the next version
16
+ next_index = version_index + 1
17
+ next_index = 0 if next_index > version_count
18
+
19
+ # Determine the previous version
20
+ prev_index = version_index - 1
21
+ prev_index = version_count if prev_index < 0
22
+
23
+ # True if images are disabled
24
+ images_off = view.images_off?
25
+
26
+ script = []
27
+
28
+ script << 'document.addEventListener("keypress", (event) => {'
29
+ script << ' window.console.log(event);'
30
+ script << " var newVersion = '#{version}';"
31
+ script << " var imagesOff = #{images_off};"
32
+ script << ' if (event.keyCode === 37) {' # left arrow (previous version)
33
+ script << " newVersion = '#{versions[prev_index]}';"
34
+ script << ' } else if (event.keyCode === 39) {' # right arrow (next version)
35
+ script << " newVersion = '#{versions[next_index]}';"
36
+ script << ' } else if (event.charCode === 105) {' # i key (toggle images)
37
+ script << ' imagesOff = !imagesOff;'
38
+ script << ' } else {'
39
+ script << ' return true;' # invalid keystroke
40
+ script << ' }'
41
+ script << ' var newSearch = "?v=" + newVersion;'
42
+ script << ' if (imagesOff) {'
43
+ script << ' newSearch += "&images-off";'
44
+ script << ' }'
45
+ script << ' window.location.search = newSearch;'
46
+ script << ' event.preventDefault();'
47
+ script << ' return false;'
48
+ script << '});'
49
+
50
+ view.scripts << script.join("\n")
51
+
52
+ end
53
+
54
+ end
55
+ end
56
+ end
@@ -27,15 +27,15 @@ describe Inkcite::Renderer::Background do
27
27
  end
28
28
 
29
29
  it 'supports an optional width in pixels' do
30
- Inkcite::Renderer.render('{background src=https://i.imgur.com/YJOX1PC.png width=120}{/background}', @view).must_equal('<table border=0 cellpadding=0 cellspacing=0 style="background:url(https://i.imgur.com/YJOX1PC.png)" width=120><tr><td><!--[if mso]><v:rect fill="t" stroke="f" style="width:120px" xmlns:v="urn:schemas-microsoft-com:vml"><v:fill src="https://i.imgur.com/YJOX1PC.png" type="tile" /><v:textbox inset="0,0,0,0" style="mso-fit-shape-to-text:True"><![endif]--><div><table border=0 cellpadding=0 cellspacing=0 width=100%><tr><td></td></tr></table></div><!--[if mso]></v:textbox></v:rect><![endif]--></td></tr></table>')
30
+ Inkcite::Renderer.render('{background src=https://i.imgur.com/YJOX1PC.png width=120}{/background}', @view).must_equal('<table border=0 cellpadding=0 cellspacing=0 style="background:url(https://i.imgur.com/YJOX1PC.png);width:120px" width=120><tr><td><!--[if mso]><v:rect fill="t" stroke="f" style="width:120px" xmlns:v="urn:schemas-microsoft-com:vml"><v:fill src="https://i.imgur.com/YJOX1PC.png" type="tile" /><v:textbox inset="0,0,0,0" style="mso-fit-shape-to-text:True"><![endif]--><div><table border=0 cellpadding=0 cellspacing=0 width=100%><tr><td></td></tr></table></div><!--[if mso]></v:textbox></v:rect><![endif]--></td></tr></table>')
31
31
  end
32
32
 
33
33
  it 'supports an optional height in pixels' do
34
- Inkcite::Renderer.render('{background src=https://i.imgur.com/YJOX1PC.png bgcolor=#7bceeb height=92 width=120}{/background}', @view).must_equal('<table bgcolor=#7bceeb border=0 cellpadding=0 cellspacing=0 style="background:#7bceeb url(https://i.imgur.com/YJOX1PC.png)" width=120><tr><td><!--[if mso]><v:rect fill="t" stroke="f" style="height:92px;width:120px" xmlns:v="urn:schemas-microsoft-com:vml"><v:fill color="#7bceeb" src="https://i.imgur.com/YJOX1PC.png" type="tile" /><v:textbox inset="0,0,0,0"><![endif]--><div><table border=0 cellpadding=0 cellspacing=0 width=100%><tr><td height=92></td></tr></table></div><!--[if mso]></v:textbox></v:rect><![endif]--></td></tr></table>')
34
+ Inkcite::Renderer.render('{background src=https://i.imgur.com/YJOX1PC.png bgcolor=#7bceeb height=92 width=120}{/background}', @view).must_equal('<table bgcolor=#7bceeb border=0 cellpadding=0 cellspacing=0 style="background:#7bceeb url(https://i.imgur.com/YJOX1PC.png);width:120px" width=120><tr><td><!--[if mso]><v:rect fill="t" stroke="f" style="height:92px;width:120px" xmlns:v="urn:schemas-microsoft-com:vml"><v:fill color="#7bceeb" src="https://i.imgur.com/YJOX1PC.png" type="tile" /><v:textbox inset="0,0,0,0"><![endif]--><div><table border=0 cellpadding=0 cellspacing=0 width=100%><tr><td height=92 style="height:92px"></td></tr></table></div><!--[if mso]></v:textbox></v:rect><![endif]--></td></tr></table>')
35
35
  end
36
36
 
37
37
  it 'supports an optional background color' do
38
- Inkcite::Renderer.render('{background src=https://i.imgur.com/YJOX1PC.png bgcolor=#7bceeb width=120}{/background}', @view).must_equal('<table bgcolor=#7bceeb border=0 cellpadding=0 cellspacing=0 style="background:#7bceeb url(https://i.imgur.com/YJOX1PC.png)" width=120><tr><td><!--[if mso]><v:rect fill="t" stroke="f" style="width:120px" xmlns:v="urn:schemas-microsoft-com:vml"><v:fill color="#7bceeb" src="https://i.imgur.com/YJOX1PC.png" type="tile" /><v:textbox inset="0,0,0,0" style="mso-fit-shape-to-text:True"><![endif]--><div><table border=0 cellpadding=0 cellspacing=0 width=100%><tr><td></td></tr></table></div><!--[if mso]></v:textbox></v:rect><![endif]--></td></tr></table>')
38
+ Inkcite::Renderer.render('{background src=https://i.imgur.com/YJOX1PC.png bgcolor=#7bceeb width=120}{/background}', @view).must_equal('<table bgcolor=#7bceeb border=0 cellpadding=0 cellspacing=0 style="background:#7bceeb url(https://i.imgur.com/YJOX1PC.png);width:120px" width=120><tr><td><!--[if mso]><v:rect fill="t" stroke="f" style="width:120px" xmlns:v="urn:schemas-microsoft-com:vml"><v:fill color="#7bceeb" src="https://i.imgur.com/YJOX1PC.png" type="tile" /><v:textbox inset="0,0,0,0" style="mso-fit-shape-to-text:True"><![endif]--><div><table border=0 cellpadding=0 cellspacing=0 width=100%><tr><td></td></tr></table></div><!--[if mso]></v:textbox></v:rect><![endif]--></td></tr></table>')
39
39
  end
40
40
 
41
41
  it 'supports the font attribute' do
@@ -52,7 +52,7 @@ describe Inkcite::Renderer::Background do
52
52
  end
53
53
 
54
54
  it 'supports padding' do
55
- Inkcite::Renderer.render('{background src=background.jpg padding=15}{/background}', @view).must_equal('<table border=0 cellpadding=0 cellspacing=0 style="background:url(images/background.jpg)" width=100%><tr><td><!--[if mso]><v:rect fill="t" stroke="f" style="mso-width-percent:1000" xmlns:v="urn:schemas-microsoft-com:vml"><v:fill src="images/background.jpg" type="tile" /><v:textbox inset="0,0,0,0" style="mso-fit-shape-to-text:True"><![endif]--><div><table border=0 cellpadding=0 cellspacing=0 width=100%><tr><td class="hide" width=15>&nbsp;</td><td><div class="hide" style="font-size:15px;height:15px;line-height:15px">&nbsp;</div><div class="hide" style="font-size:15px;height:15px;line-height:15px">&nbsp;</div></td><td class="hide" width=15>&nbsp;</td></tr></table></div><!--[if mso]></v:textbox></v:rect><![endif]--></td></tr></table>')
55
+ Inkcite::Renderer.render('{background src=background.jpg padding=15}{/background}', @view).must_equal('<table border=0 cellpadding=0 cellspacing=0 style="background:url(images/background.jpg)" width=100%><tr><td><!--[if mso]><v:rect fill="t" stroke="f" style="mso-width-percent:1000" xmlns:v="urn:schemas-microsoft-com:vml"><v:fill src="images/background.jpg" type="tile" /><v:textbox inset="0,0,0,0" style="mso-fit-shape-to-text:True"><![endif]--><div><table border=0 cellpadding=0 cellspacing=0 width=100%><tr><td class="hide" style="width:15px" width=15>&nbsp;</td><td><div class="hide" style="font-size:15px;height:15px;line-height:15px">&nbsp;</div><div class="hide" style="font-size:15px;height:15px;line-height:15px">&nbsp;</div></td><td class="hide" style="width:15px" width=15>&nbsp;</td></tr></table></div><!--[if mso]></v:textbox></v:rect><![endif]--></td></tr></table>')
56
56
  end
57
57
 
58
58
  it 'supports mobile padding' do
@@ -6,42 +6,48 @@ describe Inkcite::Renderer::Button do
6
6
 
7
7
  it 'inherits default settings from the context' do
8
8
  Inkcite::Renderer.render('{button id="learn-more" href="http://inkceptional.com"}Learn More{/button}', @view).
9
- must_equal("<a href=\"http://inkceptional.com\" style=\"text-decoration:none\" target=_blank><table align=center bgcolor=#0099cc border=0 cellpadding=8 cellspacing=0 class=\"fill\" style=\"border-radius:5px\" width=175><tr>\n<td align=center style=\"padding:8px;text-shadow:0 -1px 0 #003d52\"><a href=\"http://inkceptional.com\" style=\"color:#0099cc;text-decoration:none\" target=_blank>Learn More</a></td>\n</tr></table></a>")
9
+ must_equal(%Q(<a href="http://inkceptional.com" style="text-decoration:none" target=_blank><table align=center bgcolor=#0099cc border=0 cellpadding=8 cellspacing=0 class="fill" style="border-radius:5px;mso-padding-alt:8px 8px 8px 8px;width:175px" width=175><tr>\n<td align=center style="padding:8px;text-shadow:0 -1px 0 #003d52"><a href="http://inkceptional.com" style="color:#0099cc;text-decoration:none" target=_blank>Learn More</a></td>\n</tr></table></a>))
10
10
  end
11
11
 
12
12
  it 'can have a custom background color' do
13
13
  Inkcite::Renderer.render('{button id="learn-more" href="http://inkceptional.com" bgcolor=#090}Learn More{/button}', @view).
14
- must_equal("<a href=\"http://inkceptional.com\" style=\"text-decoration:none\" target=_blank><table align=center bgcolor=#009900 border=0 cellpadding=8 cellspacing=0 class=\"fill\" style=\"border-radius:5px\" width=175><tr>\n<td align=center style=\"padding:8px;text-shadow:0 -1px 0 #003d52\"><a href=\"http://inkceptional.com\" style=\"color:#0099cc;text-decoration:none\" target=_blank>Learn More</a></td>\n</tr></table></a>")
14
+ must_equal(%Q(<a href="http://inkceptional.com" style="text-decoration:none" target=_blank><table align=center bgcolor=#009900 border=0 cellpadding=8 cellspacing=0 class="fill" style="border-radius:5px;mso-padding-alt:8px 8px 8px 8px;width:175px" width=175><tr>\n<td align=center style="padding:8px;text-shadow:0 -1px 0 #003d52"><a href="http://inkceptional.com" style="color:#0099cc;text-decoration:none" target=_blank>Learn More</a></td>\n</tr></table></a>))
15
15
  end
16
16
 
17
17
  it 'can have a custom bevel' do
18
18
  Inkcite::Renderer.render('{button id="learn-more" href="http://inkceptional.com" bevel=3 bevel-color=#ff0000}Learn More{/button}', @view).
19
- must_equal("<a href=\"http://inkceptional.com\" style=\"text-decoration:none\" target=_blank><table align=center bgcolor=#0099cc border=0 cellpadding=8 cellspacing=0 class=\"fill\" style=\"border-bottom:3px solid #ff0000;border-collapse:separate;border-radius:5px\" width=175><tr>\n<td align=center style=\"padding:8px;text-shadow:0 -1px 0 #003d52\"><a href=\"http://inkceptional.com\" style=\"color:#0099cc;text-decoration:none\" target=_blank>Learn More</a></td>\n</tr></table></a>")
19
+ must_equal(%Q(<a href="http://inkceptional.com" style="text-decoration:none" target=_blank><table align=center bgcolor=#0099cc border=0 cellpadding=8 cellspacing=0 class="fill" style="border-bottom:3px solid #ff0000;border-collapse:separate;border-radius:5px;mso-padding-alt:8px 8px 8px 8px;width:175px" width=175><tr>\n<td align=center style="padding:8px;text-shadow:0 -1px 0 #003d52"><a href="http://inkceptional.com" style="color:#0099cc;text-decoration:none" target=_blank>Learn More</a></td>\n</tr></table></a>))
20
20
  end
21
21
 
22
22
  it 'can have a custom font size' do
23
23
  Inkcite::Renderer.render('{button id="learn-more" href="http://inkceptional.com" font-size=27}Learn More{/button}', @view).
24
- must_equal("<a href=\"http://inkceptional.com\" style=\"text-decoration:none\" target=_blank><table align=center bgcolor=#0099cc border=0 cellpadding=8 cellspacing=0 class=\"fill\" style=\"border-radius:5px\" width=175><tr>\n<td align=center style=\"font-size:27px;padding:8px;text-shadow:0 -1px 0 #003d52\"><a href=\"http://inkceptional.com\" style=\"color:#0099cc;text-decoration:none\" target=_blank>Learn More</a></td>\n</tr></table></a>")
24
+ must_equal(%Q(<a href="http://inkceptional.com" style="text-decoration:none" target=_blank><table align=center bgcolor=#0099cc border=0 cellpadding=8 cellspacing=0 class="fill" style="border-radius:5px;mso-padding-alt:8px 8px 8px 8px;width:175px" width=175><tr>\n<td align=center style="font-size:27px;padding:8px;text-shadow:0 -1px 0 #003d52"><a href="http://inkceptional.com" style="color:#0099cc;text-decoration:none" target=_blank>Learn More</a></td>\n</tr></table></a>))
25
25
  end
26
26
 
27
27
  it 'has px line-height by default, if specified' do
28
28
  Inkcite::Renderer.render('{button id="learn-more" href="http://inkceptional.com" font-size=27 line-height=56}Learn More{/button}', @view).
29
- must_equal("<a href=\"http://inkceptional.com\" style=\"text-decoration:none\" target=_blank><table align=center bgcolor=#0099cc border=0 cellpadding=8 cellspacing=0 class=\"fill\" style=\"border-radius:5px\" width=175><tr>\n<td align=center style=\"font-size:27px;line-height:56px;padding:8px;text-shadow:0 -1px 0 #003d52\"><a href=\"http://inkceptional.com\" style=\"color:#0099cc;text-decoration:none\" target=_blank>Learn More</a></td>\n</tr></table></a>")
29
+ must_equal(%Q(<a href="http://inkceptional.com" style="text-decoration:none" target=_blank><table align=center bgcolor=#0099cc border=0 cellpadding=8 cellspacing=0 class="fill" style="border-radius:5px;mso-padding-alt:8px 8px 8px 8px;width:175px" width=175><tr>\n<td align=center style="font-size:27px;line-height:56px;padding:8px;text-shadow:0 -1px 0 #003d52"><a href="http://inkceptional.com" style="color:#0099cc;text-decoration:none" target=_blank>Learn More</a></td>\n</tr></table></a>))
30
30
  end
31
31
 
32
32
  it 'accepts line-height specified in em units' do
33
33
  Inkcite::Renderer.render('{button id="learn-more" href="http://inkceptional.com" font-size=27 line-height=2em}Learn More{/button}', @view).
34
- must_equal("<a href=\"http://inkceptional.com\" style=\"text-decoration:none\" target=_blank><table align=center bgcolor=#0099cc border=0 cellpadding=8 cellspacing=0 class=\"fill\" style=\"border-radius:5px\" width=175><tr>\n<td align=center style=\"font-size:27px;line-height:2em;padding:8px;text-shadow:0 -1px 0 #003d52\"><a href=\"http://inkceptional.com\" style=\"color:#0099cc;text-decoration:none\" target=_blank>Learn More</a></td>\n</tr></table></a>")
34
+ must_equal(%Q(<a href="http://inkceptional.com" style="text-decoration:none" target=_blank><table align=center bgcolor=#0099cc border=0 cellpadding=8 cellspacing=0 class="fill" style="border-radius:5px;mso-padding-alt:8px 8px 8px 8px;width:175px" width=175><tr>\n<td align=center style="font-size:27px;line-height:2em;padding:8px;text-shadow:0 -1px 0 #003d52"><a href="http://inkceptional.com" style="color:#0099cc;text-decoration:none" target=_blank>Learn More</a></td>\n</tr></table></a>))
35
35
  end
36
36
 
37
37
  it 'accepts normal line-height' do
38
38
  Inkcite::Renderer.render('{button id="learn-more" href="http://inkceptional.com" font-size=27 line-height=normal}Learn More{/button}', @view).
39
- must_equal("<a href=\"http://inkceptional.com\" style=\"text-decoration:none\" target=_blank><table align=center bgcolor=#0099cc border=0 cellpadding=8 cellspacing=0 class=\"fill\" style=\"border-radius:5px\" width=175><tr>\n<td align=center style=\"font-size:27px;line-height:normal;padding:8px;text-shadow:0 -1px 0 #003d52\"><a href=\"http://inkceptional.com\" style=\"color:#0099cc;text-decoration:none\" target=_blank>Learn More</a></td>\n</tr></table></a>")
39
+ must_equal(%Q(<a href="http://inkceptional.com" style="text-decoration:none" target=_blank><table align=center bgcolor=#0099cc border=0 cellpadding=8 cellspacing=0 class="fill" style="border-radius:5px;mso-padding-alt:8px 8px 8px 8px;width:175px" width=175><tr>\n<td align=center style="font-size:27px;line-height:normal;padding:8px;text-shadow:0 -1px 0 #003d52"><a href="http://inkceptional.com" style="color:#0099cc;text-decoration:none" target=_blank>Learn More</a></td>\n</tr></table></a>))
40
40
  end
41
41
 
42
42
  it 'supports letter spacing' do
43
43
  Inkcite::Renderer.render('{button id="learn-more" href="http://inkceptional.com" letter-spacing=2px}Learn More{/button}', @view).
44
- must_equal("<a href=\"http://inkceptional.com\" style=\"text-decoration:none\" target=_blank><table align=center bgcolor=#0099cc border=0 cellpadding=8 cellspacing=0 class=\"fill\" style=\"border-radius:5px\" width=175><tr>\n<td align=center style=\"padding:8px;text-shadow:0 -1px 0 #003d52\"><a href=\"http://inkceptional.com\" style=\"color:#0099cc;letter-spacing:2px;text-decoration:none\" target=_blank>Learn More</a></td>\n</tr></table></a>")
44
+ must_equal(%Q(<a href="http://inkceptional.com" style="text-decoration:none" target=_blank><table align=center bgcolor=#0099cc border=0 cellpadding=8 cellspacing=0 class="fill" style="border-radius:5px;mso-padding-alt:8px 8px 8px 8px;width:175px" width=175><tr>\n<td align=center style="padding:8px;text-shadow:0 -1px 0 #003d52"><a href="http://inkceptional.com" style="color:#0099cc;letter-spacing:2px;text-decoration:none" target=_blank>Learn More</a></td>\n</tr></table></a>))
45
+ end
46
+
47
+ it 'supports custom font-family' do
48
+ Inkcite::Renderer.render(%Q({button id="learn-more" href="http://inkceptional.com" font-family="'Share', sans-serif"}Learn More{/button}), @view).
49
+ must_equal(%Q(<a href="http://inkceptional.com" style="text-decoration:none" target=_blank><table align=center bgcolor=#0099cc border=0 cellpadding=8 cellspacing=0 class="fill" style="border-radius:5px;mso-padding-alt:8px 8px 8px 8px;width:175px" width=175><tr>\n<td align=center style="font-family:'Share', sans-serif;padding:8px;text-shadow:0 -1px 0 #003d52"><a href="http://inkceptional.com" style="color:#0099cc;text-decoration:none" target=_blank>Learn More</a></td>\n</tr></table></a>))
50
+
45
51
  end
46
52
 
47
53
  end
@@ -99,8 +99,16 @@ describe Inkcite::Renderer::Div do
99
99
  Inkcite::Renderer.render('{div align=right}{/div}', @view).must_equal('<div style="text-align:right"></div>')
100
100
  end
101
101
 
102
- it 'supports automatic background gradient' do
103
- Inkcite::Renderer.render('{div bgcolor=#f00 bggradient=#00f}{/div}', @view).must_equal('<div style="background-color:#ff0000;background-image:radial-gradient(circle at center, #ff0000, #0000ff)"></div>')
102
+ it 'supports automatic background circle gradient' do
103
+ Inkcite::Renderer.render('{div bgcolor=#f00 background-gradient=#00f background-gradient-shape=circle}{/div}', @view).must_equal('<div style="background-color:#ff0000;background-image:radial-gradient(circle at center, #ff0000, #0000ff)"></div>')
104
+ end
105
+
106
+ it 'supports automatic background gradient position' do
107
+ Inkcite::Renderer.render('{div bgcolor=#f00 background-gradient=#00f background-gradient-shape=circle background-gradient-position=bottom}{/div}', @view).must_equal('<div style="background-color:#ff0000;background-image:radial-gradient(circle at bottom, #ff0000, #0000ff)"></div>')
108
+ end
109
+
110
+ it 'supports automatic background linear gradient' do
111
+ Inkcite::Renderer.render('{div bgcolor=#f00 background-gradient=#00f}{/div}', @view).must_equal('<div style="background-color:#ff0000;background-image:linear-gradient(to bottom, #ff0000, #0000ff)"></div>')
104
112
  end
105
113
 
106
114
  it 'supports custom background gradient' do
@@ -112,6 +120,10 @@ describe Inkcite::Renderer::Div do
112
120
  @view.media_query.find_by_klass('m1').declarations.must_match('width:15px')
113
121
  end
114
122
 
123
+ it 'supports padding' do
124
+ Inkcite::Renderer.render('{div padding=15}{/div}', @view).must_equal('<div style="mso-padding-alt:15px 15px 15px 15px;padding:15px"></div>')
125
+ end
126
+
115
127
  it 'supports a custom override width on mobile' do
116
128
  Inkcite::Renderer.render('{div width=45 mobile-width=78}{/div}', @view).must_equal('<div class="m1" style="width:45px"></div>')
117
129
  @view.media_query.find_by_klass('m1').declarations.must_match('width:78px !important')
@@ -152,10 +164,21 @@ describe Inkcite::Renderer::Div do
152
164
  @view.media_query.find_by_klass('m1').declarations.must_match('height:215px')
153
165
  end
154
166
 
155
-
156
167
  it 'supports mobile height override' do
157
168
  Inkcite::Renderer.render('{div height=63 mobile-height=182}{/div}', @view).must_equal('<div class="m1" style="height:63px"></div>')
158
169
  @view.media_query.find_by_klass('m1').declarations.must_match('height:182px !important')
159
170
  end
160
171
 
172
+ it 'supports justified text alignment' do
173
+ Inkcite::Renderer.render('{div align=justify}', @view).must_equal('<div style="text-align:justify">')
174
+ end
175
+
176
+ it 'supports the text-justify property when justified alignment is enabled' do
177
+ Inkcite::Renderer.render('{div align=justify text-justify="inter-word"}', @view).must_equal('<div style="text-align:justify;text-justify:inter-word">')
178
+ end
179
+
180
+ it 'supports ignores text-justify property when justified alignment is not enabled' do
181
+ Inkcite::Renderer.render('{div text-justify="inter-word"}', @view).must_equal('<div>')
182
+ end
183
+
161
184
  end
@@ -91,16 +91,16 @@ describe Inkcite::Renderer::Image do
91
91
  end
92
92
 
93
93
  it 'supports multi-line alt text' do
94
- Inkcite::Renderer.render(%Q({img src=inkcite.jpg height=150 width=100 font=none alt="Multiple\nLine\nAlt\nText"}), @view).must_equal(%Q(<img alt="Multiple \nLine \nAlt \nText" border=0 height=150 id="OWATemporaryImageDivContainer1" src="images/inkcite.jpg" style="display:block;white-space:pre" width=100>))
94
+ Inkcite::Renderer.render(%Q({img src=inkcite.jpg height=150 width=100 font=none alt="Multiple\nLine\nAlt\nText"}), @view).must_equal(%Q(<img alt="Multiple \n Line \n Alt \n Text" border=0 height=150 id="OWATemporaryImageDivContainer1" src="images/inkcite.jpg" style="display:block;white-space:pre" width=100>))
95
95
  end
96
96
 
97
97
  it 'supports virtual (\n) multi-line alt text' do
98
- Inkcite::Renderer.render(%q({img src=inkcite.jpg height=150 width=100 font=none alt="Multiple\nLine\nAlt\nText"}), @view).must_equal(%Q(<img alt="Multiple \nLine \nAlt \nText" border=0 height=150 id="OWATemporaryImageDivContainer1" src="images/inkcite.jpg" style="display:block;white-space:pre" width=100>))
98
+ Inkcite::Renderer.render(%q({img src=inkcite.jpg height=150 width=100 font=none alt="Multiple\nLine\nAlt\nText"}), @view).must_equal(%Q(<img alt="Multiple \n Line \n Alt \n Text" border=0 height=150 id="OWATemporaryImageDivContainer1" src="images/inkcite.jpg" style="display:block;white-space:pre" width=100>))
99
99
  end
100
100
 
101
101
  it 'supports multi-line alt text in production, too' do
102
- Inkcite::Renderer.render(%Q({img src=inkcite.jpg height=150 width=100 font=none alt="Multiple\nLine\nAlt\nText"}), Inkcite::Email.new('test/project/').view(:production, :email)).must_equal(%Q(<img alt="Multiple \nLine \nAlt \nText" border=0 height=150 id="OWATemporaryImageDivContainer1" src="http://production.imagehost.com/emails/myemail/inkcite.jpg" style="display:block;white-space:pre" width=100>))
103
- Inkcite::Renderer.render(%q({img src=inkcite.jpg height=150 width=100 font=none alt="Multiple\nLine\nAlt\nText"}), Inkcite::Email.new('test/project/').view(:production, :email)).must_equal(%Q(<img alt="Multiple \nLine \nAlt \nText" border=0 height=150 id="OWATemporaryImageDivContainer1" src="http://production.imagehost.com/emails/myemail/inkcite.jpg" style="display:block;white-space:pre" width=100>))
102
+ Inkcite::Renderer.render(%Q({img src=inkcite.jpg height=150 width=100 font=none alt="Multiple\nLine\nAlt\nText"}), Inkcite::Email.new('test/project/').view(:production, :email)).must_equal(%Q(<img alt="Multiple \n Line \n Alt \n Text" border=0 height=150 id="OWATemporaryImageDivContainer1" src="http://production.imagehost.com/emails/myemail/inkcite.jpg" style="display:block;white-space:pre" width=100>))
103
+ Inkcite::Renderer.render(%q({img src=inkcite.jpg height=150 width=100 font=none alt="Multiple\nLine\nAlt\nText"}), Inkcite::Email.new('test/project/').view(:production, :email)).must_equal(%Q(<img alt="Multiple \n Line \n Alt \n Text" border=0 height=150 id="OWATemporaryImageDivContainer1" src="http://production.imagehost.com/emails/myemail/inkcite.jpg" style="display:block;white-space:pre" width=100>))
104
104
  end
105
105
 
106
106
  it 'removes HTML from alt text' do
@@ -134,4 +134,9 @@ describe Inkcite::Renderer::Image do
134
134
  Inkcite::Renderer.render(%q({img src=logo.jpg height=75 width=75 max-height=0}), @view).must_equal(%q(<img border=0 height=75 id="OWATemporaryImageDivContainer1" src="images/logo.jpg" style="display:block;max-height:0" width=75>))
135
135
  end
136
136
 
137
+ it 'supports scaling its size' do
138
+ Inkcite::Renderer.render(%q({img src=billboard.jpg height=200 width=475 scale=0.75}), @view).must_equal(%q(<img border=0 height=150 id="OWATemporaryImageDivContainer1" src="images/billboard.jpg" style="display:block" width=356>))
139
+
140
+ end
141
+
137
142
  end
@@ -0,0 +1,36 @@
1
+ describe Inkcite::Renderer::List do
2
+
3
+ before do
4
+ @view = Inkcite::Email.new('test/project/').view(:development, :email)
5
+ end
6
+
7
+ it 'renders a bullet list' do
8
+ Inkcite::Renderer.render('{ul}{li}Item 1{/li}{/ul}', @view).must_equal('<table border=0 cellpadding=0 cellspacing=0><tr><td valign=top>&nbsp;&nbsp;&bull;&nbsp;</td><td>Item 1</td></tr></table>')
9
+ end
10
+
11
+ it 'renders space between list items' do
12
+ Inkcite::Renderer.render('{ul}{li}Item 1{/li}{li}Item 2{/li}{/ul}', @view).must_equal('<table border=0 cellpadding=0 cellspacing=0><tr><td valign=top>&nbsp;&nbsp;&bull;&nbsp;</td><td>Item 1<div style="font-size:3px;height:3px;line-height:3px">&nbsp;</div></td></tr><tr><td valign=top>&nbsp;&nbsp;&bull;&nbsp;</td><td>Item 2</td></tr></table>')
13
+ end
14
+
15
+ it 'supports customizable space between list items' do
16
+ Inkcite::Renderer.render('{ul spacing=15}{li}Item 1{/li}{li}Item 2{/li}{li}Item 3{/li}{/ul}', @view).must_equal('<table border=0 cellpadding=0 cellspacing=0><tr><td valign=top>&nbsp;&nbsp;&bull;&nbsp;</td><td>Item 1<div style="font-size:15px;height:15px;line-height:15px">&nbsp;</div></td></tr><tr><td valign=top>&nbsp;&nbsp;&bull;&nbsp;</td><td>Item 2<div style="font-size:15px;height:15px;line-height:15px">&nbsp;</div></td></tr><tr><td valign=top>&nbsp;&nbsp;&bull;&nbsp;</td><td>Item 3</td></tr></table>')
17
+ end
18
+
19
+ it 'supports customizable fonts' do
20
+ Inkcite::Renderer.render('{ul font-size=15}{li}Item 1{/li}{li}Item 2{/li}{/ul}', @view).must_equal('<table border=0 cellpadding=0 cellspacing=0><tr><td style="font-size:15px" valign=top>&nbsp;&nbsp;&bull;&nbsp;</td><td style="font-size:15px">Item 1<div style="font-size:3px;height:3px;line-height:3px">&nbsp;</div></td></tr><tr><td style="font-size:15px" valign=top>&nbsp;&nbsp;&bull;&nbsp;</td><td style="font-size:15px">Item 2</td></tr></table>')
21
+ end
22
+
23
+ it 'supports customizable bullets' do
24
+ Inkcite::Renderer.render('{ul bullet="☆"}{li}Item 1{/li}{li}Item 2{/li}{/ul}', @view).must_equal('<table border=0 cellpadding=0 cellspacing=0><tr><td valign=top>&nbsp;&nbsp;☆&nbsp;</td><td>Item 1<div style="font-size:3px;height:3px;line-height:3px">&nbsp;</div></td></tr><tr><td valign=top>&nbsp;&nbsp;☆&nbsp;</td><td>Item 2</td></tr></table>')
25
+ end
26
+
27
+ it 'supports numbered lists' do
28
+ Inkcite::Renderer.render('{ol}{li}Item 1{/li}{li}Item 2{/li}{/ol}', @view).must_equal('<table border=0 cellpadding=0 cellspacing=0><tr><td valign=top>&nbsp;&nbsp;1.&nbsp;</td><td>Item 1<div style="font-size:3px;height:3px;line-height:3px">&nbsp;</div></td></tr><tr><td valign=top>&nbsp;&nbsp;2.&nbsp;</td><td>Item 2</td></tr></table>')
29
+ end
30
+
31
+ it 'supports bullet-free lists' do
32
+ Inkcite::Renderer.render('{ul bullet=none}{li}Item 1{/li}{li}Item 2{/li}{/ul}', @view).must_equal('<table border=0 cellpadding=0 cellspacing=0><tr><td>Item 1<div style="font-size:3px;height:3px;line-height:3px">&nbsp;</div></td></tr><tr><td>Item 2</td></tr></table>')
33
+
34
+ end
35
+
36
+ end
@@ -21,5 +21,10 @@ describe Inkcite::Renderer::MobileImage do
21
21
  @view.media_query.find_by_klass('i01').to_css.must_equal('span.i01 { background-image:url("images/inkcite-mobile.jpg");height:100px;margin-bottom:15px;margin-left:15px;width:300px }')
22
22
  end
23
23
 
24
+ it 'supports mobile border' do
25
+ Inkcite::Renderer.render('{mobile-img src=inkcite-mobile.jpg height=100 width=300 border="2px solid #f00"}', @view).must_equal('<span class="i01 img"></span>')
26
+ @view.media_query.find_by_klass('i01').to_css.must_equal('span.i01 { background-image:url("images/inkcite-mobile.jpg");border:2px solid #f00;height:100px;width:300px }')
27
+ end
28
+
24
29
 
25
30
  end
@@ -0,0 +1,47 @@
1
+ describe Inkcite::Renderer::Slant do
2
+
3
+ before do
4
+ @view = Inkcite::Email.new('test/project/').view(:development, :email)
5
+ end
6
+
7
+ it 'renders a top left slant' do
8
+ Inkcite::Renderer.render('{slant width=600 height=30 top left}', @view).must_equal('<!--[if lt mso 16]><div style="font-size:0;line-height:0"><v:shapetype id="stl" path="m0,21600l21600,0,0,0xe" xmlns:v="urn:schemas-microsoft-com:vml"/><v:shapetype id="str" path="m0,0l21600,0,21600,21600xe" xmlns:v="urn:schemas-microsoft-com:vml"/><v:shapetype id="sbl" path="m0,0l21600,21600,0,21600xe" xmlns:v="urn:schemas-microsoft-com:vml"/><v:shapetype id="sbr" path="m0,21600l21600,21600,21600,0xe" xmlns:v="urn:schemas-microsoft-com:vml"/></div><![endif]--><table border=0 cellpadding=0 cellspacing=0 class="fill" style="width:600px" width=600><tr><td><div class="slant15" style="-webkit-transform:rotate(0.0005deg);border-color:#223344 transparent transparent #223344;border-style:solid;border-width:15px 300px;mso-hide:all"></div><!--[if lt mso 16]><div style="font-size:0;line-height:0"><v:shape fillcolor=#223344 stroked=f style="height:30px;mso-position-horizontal:center;width:600px" type="stl"><o:lock selection="t"/></v:shape></div><![endif]--></td></tr></table>')
9
+ end
10
+
11
+ it 'renders a top right slant' do
12
+ Inkcite::Renderer.render('{slant width=600 height=30 top right}', @view).must_equal('<!--[if lt mso 16]><div style="font-size:0;line-height:0"><v:shapetype id="stl" path="m0,21600l21600,0,0,0xe" xmlns:v="urn:schemas-microsoft-com:vml"/><v:shapetype id="str" path="m0,0l21600,0,21600,21600xe" xmlns:v="urn:schemas-microsoft-com:vml"/><v:shapetype id="sbl" path="m0,0l21600,21600,0,21600xe" xmlns:v="urn:schemas-microsoft-com:vml"/><v:shapetype id="sbr" path="m0,21600l21600,21600,21600,0xe" xmlns:v="urn:schemas-microsoft-com:vml"/></div><![endif]--><table border=0 cellpadding=0 cellspacing=0 class="fill" style="width:600px" width=600><tr><td><div class="slant15" style="-webkit-transform:rotate(0.0005deg);border-color:#223344 #223344 transparent transparent;border-style:solid;border-width:15px 300px;mso-hide:all"></div><!--[if lt mso 16]><div style="font-size:0;line-height:0"><v:shape fillcolor=#223344 stroked=f style="height:30px;mso-position-horizontal:center;width:600px" type="str"><o:lock selection="t"/></v:shape></div><![endif]--></td></tr></table>')
13
+ end
14
+
15
+ it 'renders a bottom left slant' do
16
+ Inkcite::Renderer.render('{slant width=600 height=30 bottom left}', @view).must_equal('<!--[if lt mso 16]><div style="font-size:0;line-height:0"><v:shapetype id="stl" path="m0,21600l21600,0,0,0xe" xmlns:v="urn:schemas-microsoft-com:vml"/><v:shapetype id="str" path="m0,0l21600,0,21600,21600xe" xmlns:v="urn:schemas-microsoft-com:vml"/><v:shapetype id="sbl" path="m0,0l21600,21600,0,21600xe" xmlns:v="urn:schemas-microsoft-com:vml"/><v:shapetype id="sbr" path="m0,21600l21600,21600,21600,0xe" xmlns:v="urn:schemas-microsoft-com:vml"/></div><![endif]--><table border=0 cellpadding=0 cellspacing=0 class="fill" style="width:600px" width=600><tr><td><div class="slant15" style="-webkit-transform:rotate(0.0005deg);border-color:transparent transparent #223344 #223344;border-style:solid;border-width:15px 300px;mso-hide:all"></div><!--[if lt mso 16]><div style="font-size:0;line-height:0"><v:shape fillcolor=#223344 stroked=f style="height:30px;mso-position-horizontal:center;width:600px" type="sbl"><o:lock selection="t"/></v:shape></div><![endif]--></td></tr></table>')
17
+ end
18
+
19
+ it 'renders a bottom right slant' do
20
+ Inkcite::Renderer.render('{slant width=600 height=30 bottom right}', @view).must_equal('<!--[if lt mso 16]><div style="font-size:0;line-height:0"><v:shapetype id="stl" path="m0,21600l21600,0,0,0xe" xmlns:v="urn:schemas-microsoft-com:vml"/><v:shapetype id="str" path="m0,0l21600,0,21600,21600xe" xmlns:v="urn:schemas-microsoft-com:vml"/><v:shapetype id="sbl" path="m0,0l21600,21600,0,21600xe" xmlns:v="urn:schemas-microsoft-com:vml"/><v:shapetype id="sbr" path="m0,21600l21600,21600,21600,0xe" xmlns:v="urn:schemas-microsoft-com:vml"/></div><![endif]--><table border=0 cellpadding=0 cellspacing=0 class="fill" style="width:600px" width=600><tr><td><div class="slant15" style="-webkit-transform:rotate(0.0005deg);border-color:transparent #223344 #223344 transparent;border-style:solid;border-width:15px 300px;mso-hide:all"></div><!--[if lt mso 16]><div style="font-size:0;line-height:0"><v:shape fillcolor=#223344 stroked=f style="height:30px;mso-position-horizontal:center;width:600px" type="sbr"><o:lock selection="t"/></v:shape></div><![endif]--></td></tr></table>')
21
+ end
22
+
23
+ it 'renders only renders the VML shape declarations once' do
24
+ Inkcite::Renderer.render('{slant width=600 height=30}{slant width=600 height=30 backward}', @view).must_equal('<!--[if lt mso 16]><div style="font-size:0;line-height:0"><v:shapetype id="stl" path="m0,21600l21600,0,0,0xe" xmlns:v="urn:schemas-microsoft-com:vml"/><v:shapetype id="str" path="m0,0l21600,0,21600,21600xe" xmlns:v="urn:schemas-microsoft-com:vml"/><v:shapetype id="sbl" path="m0,0l21600,21600,0,21600xe" xmlns:v="urn:schemas-microsoft-com:vml"/><v:shapetype id="sbr" path="m0,21600l21600,21600,21600,0xe" xmlns:v="urn:schemas-microsoft-com:vml"/></div><![endif]--><table border=0 cellpadding=0 cellspacing=0 class="fill" style="width:600px" width=600><tr><td><div class="slant15" style="-webkit-transform:rotate(0.0005deg);border-color:#223344 #223344 transparent transparent;border-style:solid;border-width:15px 300px;mso-hide:all"></div><!--[if lt mso 16]><div style="font-size:0;line-height:0"><v:shape fillcolor=#223344 stroked=f style="height:30px;mso-position-horizontal:center;width:600px" type="str"><o:lock selection="t"/></v:shape></div><![endif]--></td></tr></table><table border=0 cellpadding=0 cellspacing=0 class="fill" style="width:600px" width=600><tr><td><div class="slant15" style="-webkit-transform:rotate(0.0005deg);border-color:#223344 #223344 transparent transparent;border-style:solid;border-width:15px 300px;mso-hide:all"></div><!--[if lt mso 16]><div style="font-size:0;line-height:0"><v:shape fillcolor=#223344 stroked=f style="height:30px;mso-position-horizontal:center;width:600px" type="str"><o:lock selection="t"/></v:shape></div><![endif]--></td></tr></table>')
25
+ end
26
+
27
+ it 'supports a custom foreground color' do
28
+ Inkcite::Renderer.render('{slant width=600 height=30 color=#f00}', @view).must_equal('<!--[if lt mso 16]><div style="font-size:0;line-height:0"><v:shapetype id="stl" path="m0,21600l21600,0,0,0xe" xmlns:v="urn:schemas-microsoft-com:vml"/><v:shapetype id="str" path="m0,0l21600,0,21600,21600xe" xmlns:v="urn:schemas-microsoft-com:vml"/><v:shapetype id="sbl" path="m0,0l21600,21600,0,21600xe" xmlns:v="urn:schemas-microsoft-com:vml"/><v:shapetype id="sbr" path="m0,21600l21600,21600,21600,0xe" xmlns:v="urn:schemas-microsoft-com:vml"/></div><![endif]--><table border=0 cellpadding=0 cellspacing=0 class="fill" style="width:600px" width=600><tr><td><div class="slant15" style="-webkit-transform:rotate(0.0005deg);border-color:#ff0000 #ff0000 transparent transparent;border-style:solid;border-width:15px 300px;mso-hide:all"></div><!--[if lt mso 16]><div style="font-size:0;line-height:0"><v:shape fillcolor=#ff0000 stroked=f style="height:30px;mso-position-horizontal:center;width:600px" type="str"><o:lock selection="t"/></v:shape></div><![endif]--></td></tr></table>')
29
+ end
30
+
31
+ it 'supports a custom background color' do
32
+ Inkcite::Renderer.render('{slant width=600 height=30 bgcolor=#f00}', @view).must_equal('<!--[if lt mso 16]><div style="font-size:0;line-height:0"><v:shapetype id="stl" path="m0,21600l21600,0,0,0xe" xmlns:v="urn:schemas-microsoft-com:vml"/><v:shapetype id="str" path="m0,0l21600,0,21600,21600xe" xmlns:v="urn:schemas-microsoft-com:vml"/><v:shapetype id="sbl" path="m0,0l21600,21600,0,21600xe" xmlns:v="urn:schemas-microsoft-com:vml"/><v:shapetype id="sbr" path="m0,21600l21600,21600,21600,0xe" xmlns:v="urn:schemas-microsoft-com:vml"/></div><![endif]--><table bgcolor=#ff0000 border=0 cellpadding=0 cellspacing=0 class="fill" style="width:600px" width=600><tr><td><div class="slant15" style="-webkit-transform:rotate(0.0005deg);border-color:#223344 #223344 transparent transparent;border-style:solid;border-width:15px 300px;mso-hide:all"></div><!--[if lt mso 16]><div style="font-size:0;line-height:0"><v:shape fillcolor=#223344 stroked=f style="height:30px;mso-position-horizontal:center;width:600px" type="str"><o:lock selection="t"/></v:shape></div><![endif]--></td></tr></table>')
33
+ end
34
+
35
+ it 'supports custom dimensions' do
36
+ Inkcite::Renderer.render('{slant width=400 height=60}', @view).must_equal('<!--[if lt mso 16]><div style="font-size:0;line-height:0"><v:shapetype id="stl" path="m0,21600l21600,0,0,0xe" xmlns:v="urn:schemas-microsoft-com:vml"/><v:shapetype id="str" path="m0,0l21600,0,21600,21600xe" xmlns:v="urn:schemas-microsoft-com:vml"/><v:shapetype id="sbl" path="m0,0l21600,21600,0,21600xe" xmlns:v="urn:schemas-microsoft-com:vml"/><v:shapetype id="sbr" path="m0,21600l21600,21600,21600,0xe" xmlns:v="urn:schemas-microsoft-com:vml"/></div><![endif]--><table border=0 cellpadding=0 cellspacing=0 class="fill" style="width:400px" width=400><tr><td><div class="slant30" style="-webkit-transform:rotate(0.0005deg);border-color:#223344 #223344 transparent transparent;border-style:solid;border-width:30px 200px;mso-hide:all"></div><!--[if lt mso 16]><div style="font-size:0;line-height:0"><v:shape fillcolor=#223344 stroked=f style="height:60px;mso-position-horizontal:center;width:400px" type="str"><o:lock selection="t"/></v:shape></div><![endif]--></td></tr></table>')
37
+ end
38
+
39
+ it 'supports disabling the VML fallback' do
40
+ Inkcite::Renderer.render('{slant width=600 height=30 no-fallback}', @view).must_equal('<table border=0 cellpadding=0 cellspacing=0 class="fill" style="width:600px" width=600><tr><td><div class="slant15" style="-webkit-transform:rotate(0.0005deg);border-color:#223344 #223344 transparent transparent;border-style:solid;border-width:15px 300px;mso-hide:all"></div></td></tr></table>')
41
+ end
42
+
43
+ it 'supports disabling the width wrap' do
44
+ Inkcite::Renderer.render('{slant width=600 height=30 no-wrap}', @view).must_equal('<!--[if lt mso 16]><div style="font-size:0;line-height:0"><v:shapetype id="stl" path="m0,21600l21600,0,0,0xe" xmlns:v="urn:schemas-microsoft-com:vml"/><v:shapetype id="str" path="m0,0l21600,0,21600,21600xe" xmlns:v="urn:schemas-microsoft-com:vml"/><v:shapetype id="sbl" path="m0,0l21600,21600,0,21600xe" xmlns:v="urn:schemas-microsoft-com:vml"/><v:shapetype id="sbr" path="m0,21600l21600,21600,21600,0xe" xmlns:v="urn:schemas-microsoft-com:vml"/></div><![endif]--><div class="slant15" style="-webkit-transform:rotate(0.0005deg);border-color:#223344 #223344 transparent transparent;border-style:solid;border-width:15px 300px;mso-hide:all"></div><!--[if lt mso 16]><div style="font-size:0;line-height:0"><v:shape fillcolor=#223344 stroked=f style="height:30px;mso-position-horizontal:center;width:600px" type="str"><o:lock selection="t"/></v:shape></div><![endif]-->')
45
+ end
46
+
47
+ end
@@ -87,7 +87,18 @@ describe Inkcite::Renderer::Span do
87
87
  end
88
88
 
89
89
  it 'supports padding' do
90
- Inkcite::Renderer.render('{span padding=15}{/span}', @view).must_equal('<span style="padding:15px"></span>')
90
+ Inkcite::Renderer.render('{span padding=15}{/span}', @view).must_equal('<span style="mso-padding-alt:15px 15px 15px 15px;padding:15px"></span>')
91
91
  end
92
92
 
93
+ it 'supports mobile nowrap' do
94
+ Inkcite::Renderer.render('{span mobile-nowrap}{/span}', @view).must_equal('<span class="m1"></span>')
95
+ @view.media_query.find_by_klass('m1').declarations.must_match('white-space:nowrap')
96
+ end
97
+
98
+ it 'supports mobile wrap' do
99
+ Inkcite::Renderer.render('{span nowrap mobile-wrap}{/span}', @view).must_equal('<span class="m1" style="white-space:nowrap"></span>')
100
+ @view.media_query.find_by_klass('m1').declarations.must_match('white-space:normal')
101
+ end
102
+
103
+
93
104
  end
@@ -83,7 +83,7 @@ describe Inkcite::Renderer::Table do
83
83
  end
84
84
 
85
85
  it 'supports background gradients' do
86
- Inkcite::Renderer.render('{table bgcolor=#f00 bggradient=#00f}', @view).must_equal('<table bgcolor=#ff0000 border=0 cellpadding=0 cellspacing=0 style="background-image:radial-gradient(circle at center, #ff0000, #0000ff)"><tr>')
86
+ Inkcite::Renderer.render('{table bgcolor=#f00 background-gradient=#00f background-gradient-shape=circle}', @view).must_equal('<table bgcolor=#ff0000 border=0 cellpadding=0 cellspacing=0 style="background-image:radial-gradient(circle at center, #ff0000, #0000ff)"><tr>')
87
87
  end
88
88
 
89
89
  end
@@ -9,7 +9,7 @@ describe Inkcite::Renderer::Td do
9
9
  end
10
10
 
11
11
  it 'will inherit padding from its parent table' do
12
- Inkcite::Renderer.render('{table padding=15}{td}', @view).must_equal('<table border=0 cellpadding=15 cellspacing=0><tr><td style="padding:15px">')
12
+ Inkcite::Renderer.render('{table padding=15}{td}', @view).must_equal('<table border=0 cellpadding=15 cellspacing=0 style="mso-padding-alt:15px 15px 15px 15px"><tr><td style="padding:15px">')
13
13
  end
14
14
 
15
15
  it 'supports mobile padding from the parent table' do
@@ -34,7 +34,7 @@ describe Inkcite::Renderer::Td do
34
34
  end
35
35
 
36
36
  it 'supports override mobile padding from the parent table' do
37
- Inkcite::Renderer.render('{table padding=30 mobile-padding=15}{td}', @view).must_equal('<table border=0 cellpadding=30 cellspacing=0><tr><td class="m1" style="padding:30px">')
37
+ Inkcite::Renderer.render('{table padding=30 mobile-padding=15}{td}', @view).must_equal('<table border=0 cellpadding=30 cellspacing=0 style="mso-padding-alt:30px 30px 30px 30px"><tr><td class="m1" style="padding:30px">')
38
38
  @view.media_query.find_by_klass('m1').to_css.must_equal('td.m1 { padding:15px !important }')
39
39
  end
40
40
 
@@ -159,18 +159,34 @@ describe Inkcite::Renderer::Td do
159
159
  end
160
160
 
161
161
  it 'supports mobile width override' do
162
- Inkcite::Renderer.render('{td width=30 mobile-width=15}', @view).must_equal('<td class="m1" width=30>')
163
- @view.media_query.find_by_klass('m1').to_css.must_equal('td.m1 { width:15px }')
162
+ Inkcite::Renderer.render('{td width=30 mobile-width=15}', @view).must_equal('<td class="m1" style="width:30px" width=30>')
163
+ @view.media_query.find_by_klass('m1').to_css.must_equal('td.m1 { width:15px !important }')
164
164
  end
165
165
 
166
166
  it 'supports mobile height override' do
167
- Inkcite::Renderer.render('{td height=30 mobile-height=15}', @view).must_equal('<td class="m1" height=30>')
168
- @view.media_query.find_by_klass('m1').to_css.must_equal('td.m1 { height:15px }')
167
+ Inkcite::Renderer.render('{td height=30 mobile-height=15}', @view).must_equal('<td class="m1" height=30 style="height:30px">')
168
+ @view.media_query.find_by_klass('m1').to_css.must_equal('td.m1 { height:15px !important }')
169
169
  end
170
170
 
171
171
  it 'supports multiple mobile override attributes' do
172
- Inkcite::Renderer.render('{td width=15 border-left="1px dotted #cccccc" mobile-display="block" mobile-width="100%" mobile-border-left="none" mobile-border-top="1px dotted #ccc"}', @view).must_equal('<td class="m1" style="border-left:1px dotted #cccccc" width=15>')
173
- @view.media_query.find_by_klass('m1').to_css.must_equal('td.m1 { border-left:none !important;border-top:1px dotted #ccc;display:block;width:100% }')
172
+ Inkcite::Renderer.render('{td width=15 border-left="1px dotted #cccccc" mobile-display="block" mobile-width="100%" mobile-border-left="none" mobile-border-top="1px dotted #ccc"}', @view).must_equal('<td class="m1" style="border-left:1px dotted #cccccc;width:15px" width=15>')
173
+ @view.media_query.find_by_klass('m1').to_css.must_equal('td.m1 { border-left:none !important;border-top:1px dotted #ccc;display:block;width:100% !important }')
174
+ end
175
+
176
+ it 'supports justified text alignment' do
177
+ Inkcite::Renderer.render('{td align=justify}', @view).must_equal('<td align=left style="text-align:justify">')
178
+ end
179
+
180
+ it 'supports the text-justify property when justified alignment is enabled' do
181
+ Inkcite::Renderer.render('{td align=justify text-justify="inter-word"}', @view).must_equal('<td align=left style="text-align:justify;text-justify:inter-word">')
182
+ end
183
+
184
+ it 'supports ignores text-justify property when justified alignment is not enabled' do
185
+ Inkcite::Renderer.render('{td text-justify="inter-word"}', @view).must_equal('<td>')
186
+ end
187
+
188
+ it 'does not copy percent widths to styles' do
189
+ Inkcite::Renderer.render('{td width=75%}', @view).must_equal('<td width=75%>')
174
190
  end
175
191
 
176
192
  end
@@ -10,23 +10,23 @@ describe Inkcite::Renderer::Trademark do
10
10
  end
11
11
 
12
12
  it 'renders a ™ symbol' do
13
- Inkcite::Renderer.render('{tm}', @view).must_equal('<sup style="font-size:10px;line-height:10px;vertical-align:top">&trade;</sup>')
13
+ Inkcite::Renderer.render('{tm}', @view).must_equal('<sup style="font-size:70%;line-height:1;mso-text-raise:60%;vertical-align:top">&trade;</sup>')
14
14
  end
15
15
 
16
16
  it 'renders a ™ symbol once' do
17
- Inkcite::Renderer.render('{tm id="pandora"}{tm id="pandora"}', @view).must_equal('<sup style="font-size:10px;line-height:10px;vertical-align:top">&trade;</sup>')
17
+ Inkcite::Renderer.render('{tm id="pandora"}{tm id="pandora"}', @view).must_equal('<sup style="font-size:70%;line-height:1;mso-text-raise:60%;vertical-align:top">&trade;</sup>')
18
18
  end
19
19
 
20
20
  it 'renders a ® symbol' do
21
- Inkcite::Renderer.render('{r}', @view).must_equal('<sup style="font-size:10px;line-height:10px;vertical-align:top">&reg;</sup>')
21
+ Inkcite::Renderer.render('{r}', @view).must_equal('<sup style="font-size:70%;line-height:1;mso-text-raise:60%;vertical-align:top">&reg;</sup>')
22
22
  end
23
23
 
24
24
  it 'renders a ® symbol once' do
25
- Inkcite::Renderer.render('{r id="aha"}{r id="aha"}', @view).must_equal('<sup style="font-size:10px;line-height:10px;vertical-align:top">&reg;</sup>')
25
+ Inkcite::Renderer.render('{r id="aha"}{r id="aha"}', @view).must_equal('<sup style="font-size:70%;line-height:1;mso-text-raise:60%;vertical-align:top">&reg;</sup>')
26
26
  end
27
27
 
28
28
  it 'renders different ® symbols at the same time' do
29
- Inkcite::Renderer.render('{r id="aha"}{tm id="pandora"}', @view).must_equal('<sup style="font-size:10px;line-height:10px;vertical-align:top">&reg;</sup><sup style="font-size:10px;line-height:10px;vertical-align:top">&trade;</sup>')
29
+ Inkcite::Renderer.render('{r id="aha"}{tm id="pandora"}', @view).must_equal('<sup style="font-size:70%;line-height:1;mso-text-raise:60%;vertical-align:top">&reg;</sup><sup style="font-size:70%;line-height:1;mso-text-raise:60%;vertical-align:top">&trade;</sup>')
30
30
  end
31
31
 
32
32
  it 'allows superscripting to be disabled with the no-sup attribute' do
@@ -34,7 +34,7 @@ describe Inkcite::Renderer::Trademark do
34
34
  end
35
35
 
36
36
  it 'supports an associated footnote' do
37
- Inkcite::Renderer.render('{r id="leatherman" footnote="Leatherman is a trademark of Leatherman Tool Group, inc."}', @view).must_equal('<sup style="font-size:10px;line-height:10px;vertical-align:top">&reg;1</sup>')
37
+ Inkcite::Renderer.render('{r id="leatherman" footnote="Leatherman is a trademark of Leatherman Tool Group, inc."}', @view).must_equal('<sup style="font-size:70%;line-height:1;mso-text-raise:60%;vertical-align:top">&reg;1</sup>')
38
38
  end
39
39
 
40
40
  end