spec/components_spec.rb in inky-rb-1.3.6.1 vs spec/components_spec.rb in inky-rb-1.3.6.2
- old
+ new
@@ -1,17 +1,17 @@
require 'spec_helper'
RSpec.describe "Center" do
it "applies a text-center class and center alignment attribute to the first child" do
- input = '<center><div></div></center>';
+ input = '<center><div></div></center>'
expected = <<-HTML
<center>
<div align="center" class="float-center"></div>
</center>
HTML
- compare(input, expected);
+ compare(input, expected)
end
it "doesn't choke if center tags are nested" do
input = '<center><center>a</center></center>'
@@ -21,11 +21,11 @@
a
</center>
</center>
HTML
- compare(input, expected);
+ compare(input, expected)
end
it "applies the class float-center to <item> elements" do
input = '<center><menu><item href="#"></item></menu></center>'
@@ -45,17 +45,17 @@
</tr>
</table>
</center>
HTML
- compare(input, expected);
+ compare(input, expected)
end
end
RSpec.describe "Button" do
it "creates a simple button" do
- input = '<button href="http://zurb.com">Button</button>';
+ input = '<button href="http://zurb.com">Button</button>'
expected = <<-HTML
<table class="button">
<tr>
<td>
<table>
@@ -65,11 +65,11 @@
</table>
</td>
</tr>
</table>
HTML
- compare(input, expected);
+ compare(input, expected)
end
it 'creates a button with target="_blank" attribute' do
input = '<button href="http://zurb.com" target="_blank">Button</button>'
expected = <<-HTML
@@ -222,21 +222,21 @@
end
end
RSpec.describe "Callout" do
it "creates a callout with correct syntax" do
- input = '<callout>Callout</callout>';
+ input = '<callout>Callout</callout>'
expected = <<-HTML
<table class="callout">
<tr>
<th class="callout-inner">Callout</th>
<th class="expander"></th>
</tr>
</table>
HTML
- compare(input, expected);
+ compare(input, expected)
end
it "copies classes to the final HTML" do
input = '<callout class="primary">Callout</callout>'
expected = <<-HTML
@@ -246,28 +246,28 @@
<th class="expander"></th>
</tr>
</table>
HTML
- compare(input, expected);
+ compare(input, expected)
end
end
-
+
RSpec.describe "Spacer" do
it 'creates a spacer element with correct size' do
- input = '<spacer size="10"></spacer>';
+ input = '<spacer size="10"></spacer>'
expected = <<-HTML
<table class="spacer">
<tbody>
<tr>
<td height="10px" style="font-size:10px;line-height:10px;"> </td>
</tr>
</tbody>
</table>
HTML
- compare(input, expected);
+ compare(input, expected)
end
it 'creates a spacer element for small screens with correct size' do
input = '<spacer size-sm="10"></spacer>'
expected = <<-HTML
@@ -332,11 +332,11 @@
</tr>
</tbody>
</table>
HTML
- compare(input, expected);
+ compare(input, expected)
end
end
RSpec.describe "Wrapper" do
it 'creates a wrapper that you can attach classes to' do
@@ -347,17 +347,17 @@
<td class="wrapper-inner"></td>
</tr>
</table>
HTML
- compare(input, expected);
+ compare(input, expected)
end
end
RSpec.describe "raw" do
it 'creates a wrapper that ignores anything inside' do
- input = "<raw><<LCG Program\TG LCG Coupon Code Default='246996'>></raw>"
- expected = "<<LCG Program\TG LCG Coupon Code Default='246996'>>"
+ input = "<body><raw><<LCG Program\TG LCG Coupon Code Default='246996'>></raw></body>"
+ expected = "<?xml version=\"1.0\"?>\n<body><<LCG ProgramTG LCG Coupon Code Default='246996'>></body>\n"
# Can't do vanilla compare because the second will fail to parse
inky = Inky::Core.new
output = inky.release_the_kraken(input)
expect(output).to eql(expected)