twitter_bootstrap_markup 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -4
- data/Gemfile +4 -4
- data/README.md +28 -28
- data/Rakefile +1 -1
- data/lib/twitter_bootstrap_markup.rb +52 -52
- data/lib/twitter_bootstrap_markup/add_on.rb +8 -8
- data/lib/twitter_bootstrap_markup/alert.rb +35 -35
- data/lib/twitter_bootstrap_markup/badge.rb +4 -4
- data/lib/twitter_bootstrap_markup/brand.rb +8 -8
- data/lib/twitter_bootstrap_markup/breadcrumb.rb +21 -21
- data/lib/twitter_bootstrap_markup/button.rb +16 -16
- data/lib/twitter_bootstrap_markup/button_base.rb +44 -44
- data/lib/twitter_bootstrap_markup/control_group.rb +25 -25
- data/lib/twitter_bootstrap_markup/divider.rb +29 -29
- data/lib/twitter_bootstrap_markup/dropdown_button.rb +58 -58
- data/lib/twitter_bootstrap_markup/dropdown_link.rb +29 -29
- data/lib/twitter_bootstrap_markup/extended_input.rb +10 -10
- data/lib/twitter_bootstrap_markup/extension/hash.rb +10 -10
- data/lib/twitter_bootstrap_markup/fieldset.rb +17 -17
- data/lib/twitter_bootstrap_markup/form.rb +26 -26
- data/lib/twitter_bootstrap_markup/grid_column.rb +13 -13
- data/lib/twitter_bootstrap_markup/grid_row.rb +8 -8
- data/lib/twitter_bootstrap_markup/help.rb +23 -23
- data/lib/twitter_bootstrap_markup/icon.rb +17 -17
- data/lib/twitter_bootstrap_markup/input.rb +24 -24
- data/lib/twitter_bootstrap_markup/input_size.rb +21 -21
- data/lib/twitter_bootstrap_markup/label.rb +4 -4
- data/lib/twitter_bootstrap_markup/label_base.rb +32 -32
- data/lib/twitter_bootstrap_markup/link.rb +16 -16
- data/lib/twitter_bootstrap_markup/link_button.rb +17 -17
- data/lib/twitter_bootstrap_markup/nav_bar.rb +33 -33
- data/lib/twitter_bootstrap_markup/nav_container.rb +9 -9
- data/lib/twitter_bootstrap_markup/nav_header.rb +8 -8
- data/lib/twitter_bootstrap_markup/nav_list.rb +15 -15
- data/lib/twitter_bootstrap_markup/nav_list_container.rb +9 -9
- data/lib/twitter_bootstrap_markup/nav_tab.rb +9 -9
- data/lib/twitter_bootstrap_markup/nav_tab_container.rb +12 -12
- data/lib/twitter_bootstrap_markup/page_header.rb +16 -16
- data/lib/twitter_bootstrap_markup/pagination.rb +28 -28
- data/lib/twitter_bootstrap_markup/popover.rb +19 -19
- data/lib/twitter_bootstrap_markup/progress_bar.rb +42 -42
- data/lib/twitter_bootstrap_markup/select.rb +54 -54
- data/lib/twitter_bootstrap_markup/side_position.rb +14 -14
- data/lib/twitter_bootstrap_markup/submit.rb +9 -9
- data/lib/twitter_bootstrap_markup/tab.rb +13 -13
- data/lib/twitter_bootstrap_markup/tab_content.rb +28 -28
- data/lib/twitter_bootstrap_markup/table.rb +28 -28
- data/lib/twitter_bootstrap_markup/tag.rb +62 -62
- data/lib/twitter_bootstrap_markup/tag_builder.rb +21 -21
- data/lib/twitter_bootstrap_markup/textarea.rb +14 -14
- data/lib/twitter_bootstrap_markup/tooltip.rb +18 -18
- data/lib/twitter_bootstrap_markup/ul_container.rb +27 -27
- data/lib/twitter_bootstrap_markup/version.rb +3 -3
- data/lib/twitter_bootstrap_markup/well.rb +27 -27
- data/markup/alerts.html +74 -74
- data/markup/badges.html +64 -64
- data/markup/breadcrumbs.html +58 -58
- data/markup/buttons.html +94 -94
- data/markup/control_groups.html +76 -76
- data/markup/css/bootstrap-responsive.css +815 -815
- data/markup/css/bootstrap-responsive.min.css +9 -9
- data/markup/css/bootstrap.css +4914 -4914
- data/markup/css/bootstrap.min.css +727 -727
- data/markup/dropdown_buttons.html +247 -247
- data/markup/dropdown_links.html +111 -111
- data/markup/form_fields.html +87 -87
- data/markup/forms.html +80 -80
- data/markup/grid_system.html +86 -86
- data/markup/index.html +38 -38
- data/markup/js/bootstrap.js +1835 -1835
- data/markup/js/bootstrap.min.js +6 -6
- data/markup/js/jquery-1.7.2.js +9402 -9402
- data/markup/labels.html +64 -64
- data/markup/link_buttons.html +94 -94
- data/markup/nav_bars.html +103 -103
- data/markup/nav_lists.html +53 -53
- data/markup/paginations.html +67 -67
- data/markup/popovers.html +55 -55
- data/markup/progress_bars.html +92 -92
- data/markup/selects.html +123 -123
- data/markup/tabs.html +45 -45
- data/markup/textareas.html +89 -89
- data/markup/textboxes.html +94 -94
- data/markup/tooltips.html +55 -55
- data/spec/add_on_spec.rb +9 -9
- data/spec/alert_spec.rb +77 -77
- data/spec/badge_spec.rb +40 -28
- data/spec/brand_spec.rb +9 -9
- data/spec/breadcrumb_spec.rb +32 -32
- data/spec/button_spec.rb +51 -51
- data/spec/control_group_spec.rb +28 -28
- data/spec/divider_spec.rb +16 -16
- data/spec/dropdown_button_spec.rb +100 -100
- data/spec/dropdown_link_spec.rb +47 -47
- data/spec/fieldset_spec.rb +21 -21
- data/spec/form_fields_spec.rb +70 -70
- data/spec/form_spec.rb +34 -34
- data/spec/grid_system_spec.rb +68 -68
- data/spec/help_spec.rb +12 -12
- data/spec/icon_spec.rb +17 -17
- data/spec/input_spec.rb +10 -10
- data/spec/label_spec.rb +40 -28
- data/spec/link_button_spec.rb +51 -51
- data/spec/link_spec.rb +28 -28
- data/spec/nav_bar_spec.rb +37 -37
- data/spec/nav_list_spec.rb +39 -39
- data/spec/page_header_spec.rb +12 -12
- data/spec/pagination_spec.rb +17 -17
- data/spec/popover_spec.rb +14 -14
- data/spec/progress_bar_spec.rb +52 -52
- data/spec/select_spec.rb +59 -59
- data/spec/spec_helper.rb +11 -11
- data/spec/support/helpers/html_helper.rb +10 -10
- data/spec/table_spec.rb +32 -32
- data/spec/tabs_spec.rb +21 -21
- data/spec/tag_builder_spec.rb +37 -37
- data/spec/tag_spec.rb +51 -51
- data/spec/text_area_spec.rb +42 -42
- data/spec/textbox_spec.rb +59 -59
- data/spec/tooltip_spec.rb +14 -14
- data/spec/well_spec.rb +16 -16
- data/twitter_bootstrap_markup.gemspec +25 -25
- metadata +25 -9
data/spec/dropdown_link_spec.rb
CHANGED
@@ -1,48 +1,48 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe DropdownLink do
|
4
|
-
|
5
|
-
it 'default' do
|
6
|
-
tag = DropdownLink.new('Select option') do
|
7
|
-
append Link.new('Option 1', '#1')
|
8
|
-
append Link.new('Option 2', '#2')
|
9
|
-
end
|
10
|
-
|
11
|
-
tag.to_s.should eq HtmlHelper.html_for('dropdown_links', "#default div")
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'image' do
|
15
|
-
tag = DropdownLink.new('Select option') do
|
16
|
-
append(Link.new('#1') do
|
17
|
-
append Icon.new('search')
|
18
|
-
append 'Option 1'
|
19
|
-
end)
|
20
|
-
append(Link.new('#2') do
|
21
|
-
append Icon.new('star')
|
22
|
-
append 'Option 2'
|
23
|
-
end)
|
24
|
-
end
|
25
|
-
|
26
|
-
tag.to_s.should eq HtmlHelper.html_for('dropdown_links', "#image div")
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'divider' do
|
30
|
-
tag = DropdownLink.new('Select option') do
|
31
|
-
append Link.new('Option 1', '#1')
|
32
|
-
append Divider.horizontal
|
33
|
-
append Link.new('Option 2', '#2')
|
34
|
-
end
|
35
|
-
|
36
|
-
tag.to_s.should eq HtmlHelper.html_for('dropdown_links', "#divider div")
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'nav item' do
|
40
|
-
tag = DropdownLink.new('Select option') do
|
41
|
-
append Link.new('Option 1', '#1')
|
42
|
-
append Link.new('Option 2', '#2')
|
43
|
-
end
|
44
|
-
|
45
|
-
tag.as_nav_item.to_s.should eq HtmlHelper.html_for('dropdown_links', "#nav_item .dropdown")
|
46
|
-
end
|
47
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe DropdownLink do
|
4
|
+
|
5
|
+
it 'default' do
|
6
|
+
tag = DropdownLink.new('Select option') do
|
7
|
+
append Link.new('Option 1', '#1')
|
8
|
+
append Link.new('Option 2', '#2')
|
9
|
+
end
|
10
|
+
|
11
|
+
tag.to_s.should eq HtmlHelper.html_for('dropdown_links', "#default div")
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'image' do
|
15
|
+
tag = DropdownLink.new('Select option') do
|
16
|
+
append(Link.new('#1') do
|
17
|
+
append Icon.new('search')
|
18
|
+
append 'Option 1'
|
19
|
+
end)
|
20
|
+
append(Link.new('#2') do
|
21
|
+
append Icon.new('star')
|
22
|
+
append 'Option 2'
|
23
|
+
end)
|
24
|
+
end
|
25
|
+
|
26
|
+
tag.to_s.should eq HtmlHelper.html_for('dropdown_links', "#image div")
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'divider' do
|
30
|
+
tag = DropdownLink.new('Select option') do
|
31
|
+
append Link.new('Option 1', '#1')
|
32
|
+
append Divider.horizontal
|
33
|
+
append Link.new('Option 2', '#2')
|
34
|
+
end
|
35
|
+
|
36
|
+
tag.to_s.should eq HtmlHelper.html_for('dropdown_links', "#divider div")
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'nav item' do
|
40
|
+
tag = DropdownLink.new('Select option') do
|
41
|
+
append Link.new('Option 1', '#1')
|
42
|
+
append Link.new('Option 2', '#2')
|
43
|
+
end
|
44
|
+
|
45
|
+
tag.as_nav_item.to_s.should eq HtmlHelper.html_for('dropdown_links', "#nav_item .dropdown")
|
46
|
+
end
|
47
|
+
|
48
48
|
end
|
data/spec/fieldset_spec.rb
CHANGED
@@ -1,22 +1,22 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Fieldset do
|
4
|
-
|
5
|
-
it 'empty' do
|
6
|
-
Fieldset.new.to_s.should eq '<fieldset></fieldset>'
|
7
|
-
end
|
8
|
-
|
9
|
-
it 'with legend' do
|
10
|
-
Fieldset.new('Form title').to_s.should eq '<fieldset><legend>Form title</legend></fieldset>'
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'container' do
|
14
|
-
tag = Fieldset.new('Form title') do
|
15
|
-
append Input.text
|
16
|
-
append Input.button(:value => 'Click me')
|
17
|
-
end
|
18
|
-
|
19
|
-
tag.to_s.should eq '<fieldset><legend>Form title</legend><input type="text"><input type="button" value="Click me"></fieldset>'
|
20
|
-
end
|
21
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Fieldset do
|
4
|
+
|
5
|
+
it 'empty' do
|
6
|
+
Fieldset.new.to_s.should eq '<fieldset></fieldset>'
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'with legend' do
|
10
|
+
Fieldset.new('Form title').to_s.should eq '<fieldset><legend>Form title</legend></fieldset>'
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'container' do
|
14
|
+
tag = Fieldset.new('Form title') do
|
15
|
+
append Input.text
|
16
|
+
append Input.button(:value => 'Click me')
|
17
|
+
end
|
18
|
+
|
19
|
+
tag.to_s.should eq '<fieldset><legend>Form title</legend><input type="text"><input type="button" value="Click me"></fieldset>'
|
20
|
+
end
|
21
|
+
|
22
22
|
end
|
data/spec/form_fields_spec.rb
CHANGED
@@ -1,71 +1,71 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Form, '-> Fields' do
|
4
|
-
|
5
|
-
it 'fields with actions' do
|
6
|
-
tag = Form.horizontal do
|
7
|
-
append do
|
8
|
-
Fieldset.new do
|
9
|
-
append do
|
10
|
-
ControlGroup.new('Focused input', :for => 'focusedInput') do
|
11
|
-
append Input.text :class => 'input-xlarge focused', :id => 'focusedInput', :value => 'This is focused...'
|
12
|
-
end
|
13
|
-
end
|
14
|
-
append do
|
15
|
-
ControlGroup.new('Uneditable input') do
|
16
|
-
append Tag.block(:span, :class => 'input-xlarge uneditable-input') { append 'Some value here' }
|
17
|
-
end
|
18
|
-
end
|
19
|
-
append do
|
20
|
-
ControlGroup.new('Disabled input', :for => 'disabledInput') do
|
21
|
-
append Input.text :class => 'input-xlarge disabled', :id => 'disabledInput', :placeholder => 'Disabled input here...', :disabled => nil
|
22
|
-
end
|
23
|
-
end
|
24
|
-
append do
|
25
|
-
ControlGroup.new('Disabled checkbox', :for => 'optionsCheckbox2') do
|
26
|
-
append do
|
27
|
-
Tag.block(:label, :class => 'checkbox') do
|
28
|
-
append Input.checkbox :id => 'optionsCheckbox2', :value => 'option1', :disabled => nil
|
29
|
-
append 'This is a disabled checkbox'
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
append do
|
35
|
-
ControlGroup.warning('Input with warning', :for => 'inputWarning') do
|
36
|
-
append Input.text :id => 'inputWarning'
|
37
|
-
append Help.inline 'Something may have gone wrong'
|
38
|
-
end
|
39
|
-
end
|
40
|
-
append do
|
41
|
-
ControlGroup.error('Input with error', :for => 'inputError') do
|
42
|
-
append Input.text :id => 'inputError'
|
43
|
-
append Help.inline 'Please correct the error'
|
44
|
-
end
|
45
|
-
end
|
46
|
-
append do
|
47
|
-
ControlGroup.success('Input with success', :for => 'inputSuccess') do
|
48
|
-
append Input.text :id => 'inputSuccess'
|
49
|
-
append Help.inline 'Woohoo!'
|
50
|
-
end
|
51
|
-
end
|
52
|
-
append do
|
53
|
-
ControlGroup.success('Select with success', :for => 'selectSuccess') do
|
54
|
-
append Select.new [1, 2, 3, 4, 5], :id => 'selectSuccess'
|
55
|
-
append Help.inline 'Woohoo!'
|
56
|
-
end
|
57
|
-
end
|
58
|
-
append do
|
59
|
-
Tag.block(:div, :class => 'form-actions') do
|
60
|
-
append Submit.primary('Save changes')
|
61
|
-
append Button.new('Cancel')
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
tag.to_s.should eq HtmlHelper.html_for('form_fields', "form")
|
69
|
-
end
|
70
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Form, '-> Fields' do
|
4
|
+
|
5
|
+
it 'fields with actions' do
|
6
|
+
tag = Form.horizontal do
|
7
|
+
append do
|
8
|
+
Fieldset.new do
|
9
|
+
append do
|
10
|
+
ControlGroup.new('Focused input', :for => 'focusedInput') do
|
11
|
+
append Input.text :class => 'input-xlarge focused', :id => 'focusedInput', :value => 'This is focused...'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
append do
|
15
|
+
ControlGroup.new('Uneditable input') do
|
16
|
+
append Tag.block(:span, :class => 'input-xlarge uneditable-input') { append 'Some value here' }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
append do
|
20
|
+
ControlGroup.new('Disabled input', :for => 'disabledInput') do
|
21
|
+
append Input.text :class => 'input-xlarge disabled', :id => 'disabledInput', :placeholder => 'Disabled input here...', :disabled => nil
|
22
|
+
end
|
23
|
+
end
|
24
|
+
append do
|
25
|
+
ControlGroup.new('Disabled checkbox', :for => 'optionsCheckbox2') do
|
26
|
+
append do
|
27
|
+
Tag.block(:label, :class => 'checkbox') do
|
28
|
+
append Input.checkbox :id => 'optionsCheckbox2', :value => 'option1', :disabled => nil
|
29
|
+
append 'This is a disabled checkbox'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
append do
|
35
|
+
ControlGroup.warning('Input with warning', :for => 'inputWarning') do
|
36
|
+
append Input.text :id => 'inputWarning'
|
37
|
+
append Help.inline 'Something may have gone wrong'
|
38
|
+
end
|
39
|
+
end
|
40
|
+
append do
|
41
|
+
ControlGroup.error('Input with error', :for => 'inputError') do
|
42
|
+
append Input.text :id => 'inputError'
|
43
|
+
append Help.inline 'Please correct the error'
|
44
|
+
end
|
45
|
+
end
|
46
|
+
append do
|
47
|
+
ControlGroup.success('Input with success', :for => 'inputSuccess') do
|
48
|
+
append Input.text :id => 'inputSuccess'
|
49
|
+
append Help.inline 'Woohoo!'
|
50
|
+
end
|
51
|
+
end
|
52
|
+
append do
|
53
|
+
ControlGroup.success('Select with success', :for => 'selectSuccess') do
|
54
|
+
append Select.new [1, 2, 3, 4, 5], :id => 'selectSuccess'
|
55
|
+
append Help.inline 'Woohoo!'
|
56
|
+
end
|
57
|
+
end
|
58
|
+
append do
|
59
|
+
Tag.block(:div, :class => 'form-actions') do
|
60
|
+
append Submit.primary('Save changes')
|
61
|
+
append Button.new('Cancel')
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
tag.to_s.should eq HtmlHelper.html_for('form_fields', "form")
|
69
|
+
end
|
70
|
+
|
71
71
|
end
|
data/spec/form_spec.rb
CHANGED
@@ -1,35 +1,35 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Form do
|
4
|
-
|
5
|
-
context 'Types' do
|
6
|
-
|
7
|
-
Form::TYPES.each do |type|
|
8
|
-
it type do
|
9
|
-
tag = Form.new do
|
10
|
-
append Input.text(:class => 'input-small', :placeholder => 'Email')
|
11
|
-
append Input.password(:class => 'input-small', :placeholder => 'Password')
|
12
|
-
append(Tag.new(:label, :class => 'checkbox') do
|
13
|
-
append Input.checkbox
|
14
|
-
append 'Remember me'
|
15
|
-
end)
|
16
|
-
append Button.new('Sign in')
|
17
|
-
end
|
18
|
-
|
19
|
-
tag.send(type).to_s.should eq HtmlHelper.html_for('forms', "##{type} form")
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|
24
|
-
|
25
|
-
context 'Constructors' do
|
26
|
-
|
27
|
-
Form::TYPES.each do |type|
|
28
|
-
it type do
|
29
|
-
Form.send(type).to_s.should eq Form.new.send(type).to_s
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
34
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Form do
|
4
|
+
|
5
|
+
context 'Types' do
|
6
|
+
|
7
|
+
Form::TYPES.each do |type|
|
8
|
+
it type do
|
9
|
+
tag = Form.new do
|
10
|
+
append Input.text(:class => 'input-small', :placeholder => 'Email')
|
11
|
+
append Input.password(:class => 'input-small', :placeholder => 'Password')
|
12
|
+
append(Tag.new(:label, :class => 'checkbox') do
|
13
|
+
append Input.checkbox
|
14
|
+
append 'Remember me'
|
15
|
+
end)
|
16
|
+
append Button.new('Sign in')
|
17
|
+
end
|
18
|
+
|
19
|
+
tag.send(type).to_s.should eq HtmlHelper.html_for('forms', "##{type} form")
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
context 'Constructors' do
|
26
|
+
|
27
|
+
Form::TYPES.each do |type|
|
28
|
+
it type do
|
29
|
+
Form.send(type).to_s.should eq Form.new.send(type).to_s
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
35
|
end
|
data/spec/grid_system_spec.rb
CHANGED
@@ -1,69 +1,69 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'Grid System' do
|
4
|
-
|
5
|
-
it 'span1' do
|
6
|
-
tag = GridRow.new do
|
7
|
-
12.times do |i|
|
8
|
-
append GridColumn.new(1) { append '1' }
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
tag.to_s.should eq HtmlHelper.html_for('grid_system', "#span1 .row")
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'span4' do
|
16
|
-
tag = GridRow.new do
|
17
|
-
3.times do |i|
|
18
|
-
append GridColumn.new(4) { append '4' }
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
tag.to_s.should eq HtmlHelper.html_for('grid_system', "#span4 .row")
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'span6' do
|
26
|
-
tag = GridRow.new do
|
27
|
-
2.times do |i|
|
28
|
-
append GridColumn.new(6) { append '6' }
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
tag.to_s.should eq HtmlHelper.html_for('grid_system', "#span6 .row")
|
33
|
-
end
|
34
|
-
|
35
|
-
it 'span12' do
|
36
|
-
tag = GridRow.new do
|
37
|
-
append GridColumn.new(12) { append '12' }
|
38
|
-
end
|
39
|
-
|
40
|
-
tag.to_s.should eq HtmlHelper.html_for('grid_system', "#span12 .row")
|
41
|
-
end
|
42
|
-
|
43
|
-
it 'offset_middle' do
|
44
|
-
tag = GridRow.new do
|
45
|
-
append GridColumn.new(4) { append '4' }
|
46
|
-
append GridColumn.new(4, 4) { append '4 offset 4' }
|
47
|
-
end
|
48
|
-
|
49
|
-
tag.to_s.should eq HtmlHelper.html_for('grid_system', "#offset_middle .row")
|
50
|
-
end
|
51
|
-
|
52
|
-
it 'offset_odd' do
|
53
|
-
tag = GridRow.new do
|
54
|
-
append GridColumn.new(3, 3) { append '3 offset 3' }
|
55
|
-
append GridColumn.new(3, 3) { append '3 offset 3' }
|
56
|
-
end
|
57
|
-
|
58
|
-
tag.to_s.should eq HtmlHelper.html_for('grid_system', "#offset_odd .row")
|
59
|
-
end
|
60
|
-
|
61
|
-
it 'offset_left' do
|
62
|
-
tag = GridRow.new do
|
63
|
-
append GridColumn.new(8, 4) { append '8 offset 4' }
|
64
|
-
end
|
65
|
-
|
66
|
-
tag.to_s.should eq HtmlHelper.html_for('grid_system', "#offset_left .row")
|
67
|
-
end
|
68
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Grid System' do
|
4
|
+
|
5
|
+
it 'span1' do
|
6
|
+
tag = GridRow.new do
|
7
|
+
12.times do |i|
|
8
|
+
append GridColumn.new(1) { append '1' }
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
tag.to_s.should eq HtmlHelper.html_for('grid_system', "#span1 .row")
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'span4' do
|
16
|
+
tag = GridRow.new do
|
17
|
+
3.times do |i|
|
18
|
+
append GridColumn.new(4) { append '4' }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
tag.to_s.should eq HtmlHelper.html_for('grid_system', "#span4 .row")
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'span6' do
|
26
|
+
tag = GridRow.new do
|
27
|
+
2.times do |i|
|
28
|
+
append GridColumn.new(6) { append '6' }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
tag.to_s.should eq HtmlHelper.html_for('grid_system', "#span6 .row")
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'span12' do
|
36
|
+
tag = GridRow.new do
|
37
|
+
append GridColumn.new(12) { append '12' }
|
38
|
+
end
|
39
|
+
|
40
|
+
tag.to_s.should eq HtmlHelper.html_for('grid_system', "#span12 .row")
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'offset_middle' do
|
44
|
+
tag = GridRow.new do
|
45
|
+
append GridColumn.new(4) { append '4' }
|
46
|
+
append GridColumn.new(4, 4) { append '4 offset 4' }
|
47
|
+
end
|
48
|
+
|
49
|
+
tag.to_s.should eq HtmlHelper.html_for('grid_system', "#offset_middle .row")
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'offset_odd' do
|
53
|
+
tag = GridRow.new do
|
54
|
+
append GridColumn.new(3, 3) { append '3 offset 3' }
|
55
|
+
append GridColumn.new(3, 3) { append '3 offset 3' }
|
56
|
+
end
|
57
|
+
|
58
|
+
tag.to_s.should eq HtmlHelper.html_for('grid_system', "#offset_odd .row")
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'offset_left' do
|
62
|
+
tag = GridRow.new do
|
63
|
+
append GridColumn.new(8, 4) { append '8 offset 4' }
|
64
|
+
end
|
65
|
+
|
66
|
+
tag.to_s.should eq HtmlHelper.html_for('grid_system', "#offset_left .row")
|
67
|
+
end
|
68
|
+
|
69
69
|
end
|