spec/grid_spec.rb in inky-rb-1.3.6.1 vs spec/grid_spec.rb in inky-rb-1.3.6.2
- old
+ new
@@ -44,11 +44,11 @@
end
RSpec.describe 'Grid' do
it 'creates a row' do
input = '<row></row>'
- expected = <<-HTML
+ expected = <<-HTML
<table class="row">
<tbody>
<tr></tr>
</tbody>
</table>
@@ -153,11 +153,11 @@
HTML
compare(input, expected)
end
- #if it just has small, borrow from small for large
+ # if it just has small, borrow from small for large
it 'automatically assigns large columns if no large attribute is assigned' do
input = <<-HTML
<body>
<columns small="4">One</columns>
<columns small="8">Two</columns>
@@ -212,10 +212,39 @@
HTML
compare(input, expected)
end
+ it 'assigns small as full width and large as half width if neither is defined and there are two columns' do
+ input = <<-INKY
+ <body>
+ <columns>One</columns>
+ <columns>Two</columns>
+ </body>
+ INKY
+ expected = <<-HTML
+ <body>
+ <th class="small-12 large-6 columns first">
+ <table>
+ <tr>
+ <th>One</th>
+ </tr>
+ </table>
+ </th>
+ <th class="small-12 large-6 columns last">
+ <table>
+ <tr>
+ <th>Two</th>
+ </tr>
+ </table>
+ </th>
+ </body>
+ HTML
+
+ compare(input, expected)
+ end
+
it 'supports nested grids' do
input = '<row><columns><row></row></columns></row>'
expected = <<-HTML
<table class="row">
<tbody>
@@ -238,10 +267,27 @@
</table>
HTML
compare(input, expected)
end
+
+ it 'transfers attributes like valign' do
+ input = '<columns small="6" valign="middle" foo="bar">x</columns>'
+ expected = <<-HTML
+ <th class="small-6 large-6 columns first last" valign="middle" foo="bar">
+ <table>
+ <tr>
+ <th>
+ x
+ </th>
+ </tr>
+ </table>
+ </th>
+ HTML
+
+ compare(input, expected)
+ end
end
RSpec.describe 'Block Grid' do
it 'returns the correct block grid syntax' do
input = '<block-grid up="4"></block-grid>'
@@ -262,7 +308,6 @@
</table>
HTML
compare(input, expected)
end
-
end