twitter_bootstrap_markup 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +5 -0
- data/Gemfile +4 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/lib/twitter_bootstrap_markup.rb +45 -0
- data/lib/twitter_bootstrap_markup/add_on.rb +9 -0
- data/lib/twitter_bootstrap_markup/alert.rb +35 -0
- data/lib/twitter_bootstrap_markup/badge.rb +4 -0
- data/lib/twitter_bootstrap_markup/brand.rb +9 -0
- data/lib/twitter_bootstrap_markup/breadcrumb.rb +21 -0
- data/lib/twitter_bootstrap_markup/button.rb +16 -0
- data/lib/twitter_bootstrap_markup/button_base.rb +41 -0
- data/lib/twitter_bootstrap_markup/control_group.rb +26 -0
- data/lib/twitter_bootstrap_markup/divider.rb +30 -0
- data/lib/twitter_bootstrap_markup/dropdown_button.rb +59 -0
- data/lib/twitter_bootstrap_markup/extended_input.rb +11 -0
- data/lib/twitter_bootstrap_markup/extension/hash.rb +11 -0
- data/lib/twitter_bootstrap_markup/fieldset.rb +18 -0
- data/lib/twitter_bootstrap_markup/form.rb +27 -0
- data/lib/twitter_bootstrap_markup/grid_column.rb +14 -0
- data/lib/twitter_bootstrap_markup/grid_row.rb +9 -0
- data/lib/twitter_bootstrap_markup/help.rb +24 -0
- data/lib/twitter_bootstrap_markup/icon.rb +18 -0
- data/lib/twitter_bootstrap_markup/input.rb +31 -0
- data/lib/twitter_bootstrap_markup/label.rb +4 -0
- data/lib/twitter_bootstrap_markup/label_base.rb +29 -0
- data/lib/twitter_bootstrap_markup/link.rb +17 -0
- data/lib/twitter_bootstrap_markup/link_button.rb +17 -0
- data/lib/twitter_bootstrap_markup/nav_bar.rb +32 -0
- data/lib/twitter_bootstrap_markup/nav_container.rb +10 -0
- data/lib/twitter_bootstrap_markup/nav_header.rb +9 -0
- data/lib/twitter_bootstrap_markup/nav_list.rb +11 -0
- data/lib/twitter_bootstrap_markup/nav_list_container.rb +10 -0
- data/lib/twitter_bootstrap_markup/nav_tab.rb +10 -0
- data/lib/twitter_bootstrap_markup/nav_tab_container.rb +13 -0
- data/lib/twitter_bootstrap_markup/page_header.rb +17 -0
- data/lib/twitter_bootstrap_markup/pagination.rb +29 -0
- data/lib/twitter_bootstrap_markup/popover.rb +20 -0
- data/lib/twitter_bootstrap_markup/progress_bar.rb +43 -0
- data/lib/twitter_bootstrap_markup/select.rb +67 -0
- data/lib/twitter_bootstrap_markup/side_position.rb +15 -0
- data/lib/twitter_bootstrap_markup/submit.rb +10 -0
- data/lib/twitter_bootstrap_markup/tab.rb +14 -0
- data/lib/twitter_bootstrap_markup/tab_content.rb +29 -0
- data/lib/twitter_bootstrap_markup/table.rb +28 -0
- data/lib/twitter_bootstrap_markup/tag.rb +51 -0
- data/lib/twitter_bootstrap_markup/tooltip.rb +19 -0
- data/lib/twitter_bootstrap_markup/ul_container.rb +21 -0
- data/lib/twitter_bootstrap_markup/version.rb +3 -0
- data/lib/twitter_bootstrap_markup/well.rb +27 -0
- data/markup/alerts.html +75 -0
- data/markup/badges.html +65 -0
- data/markup/breadcrumbs.html +59 -0
- data/markup/buttons.html +95 -0
- data/markup/control_groups.html +77 -0
- data/markup/css/bootstrap-responsive.css +815 -0
- data/markup/css/bootstrap-responsive.min.css +9 -0
- data/markup/css/bootstrap.css +4983 -0
- data/markup/css/bootstrap.min.css +9 -0
- data/markup/dropdown_buttons.html +248 -0
- data/markup/form_fields.html +88 -0
- data/markup/forms.html +81 -0
- data/markup/grid_system.html +87 -0
- data/markup/img/glyphicons-halflings-white.png +0 -0
- data/markup/img/glyphicons-halflings.png +0 -0
- data/markup/index.html +37 -0
- data/markup/js/bootstrap.js +1825 -0
- data/markup/js/bootstrap.min.js +6 -0
- data/markup/js/jquery-1.7.2.js +9402 -0
- data/markup/labels.html +65 -0
- data/markup/link_buttons.html +95 -0
- data/markup/nav_bars.html +104 -0
- data/markup/nav_lists.html +54 -0
- data/markup/paginations.html +68 -0
- data/markup/popovers.html +56 -0
- data/markup/progress_bars.html +93 -0
- data/markup/selects.html +124 -0
- data/markup/tabs.html +46 -0
- data/markup/textboxes.html +95 -0
- data/markup/tooltips.html +56 -0
- data/spec/add_on_spec.rb +10 -0
- data/spec/alert_spec.rb +77 -0
- data/spec/badge_spec.rb +29 -0
- data/spec/brand_spec.rb +10 -0
- data/spec/breadcrumb_spec.rb +32 -0
- data/spec/button_spec.rb +52 -0
- data/spec/control_group_spec.rb +29 -0
- data/spec/divider_spec.rb +17 -0
- data/spec/dropdown_button_spec.rb +101 -0
- data/spec/fieldset_spec.rb +22 -0
- data/spec/form_fields_spec.rb +71 -0
- data/spec/form_spec.rb +35 -0
- data/spec/grid_system_spec.rb +69 -0
- data/spec/help_spec.rb +13 -0
- data/spec/icon_spec.rb +18 -0
- data/spec/input_spec.rb +11 -0
- data/spec/label_spec.rb +29 -0
- data/spec/link_button_spec.rb +52 -0
- data/spec/link_spec.rb +29 -0
- data/spec/nav_bar_spec.rb +27 -0
- data/spec/nav_list_spec.rb +27 -0
- data/spec/page_header_spec.rb +13 -0
- data/spec/pagination_spec.rb +18 -0
- data/spec/popover_spec.rb +15 -0
- data/spec/progress_bar_spec.rb +53 -0
- data/spec/select_spec.rb +61 -0
- data/spec/spec_helper.rb +12 -0
- data/spec/support/helpers/html_helper.rb +11 -0
- data/spec/table_spec.rb +29 -0
- data/spec/tabs_spec.rb +22 -0
- data/spec/tag_spec.rb +40 -0
- data/spec/textbox_spec.rb +60 -0
- data/spec/tooltip_spec.rb +15 -0
- data/spec/well_spec.rb +17 -0
- data/twitter_bootstrap_markup.gemspec +23 -0
- metadata +182 -0
data/spec/badge_spec.rb
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Badge do
|
|
4
|
+
|
|
5
|
+
context 'Types' do
|
|
6
|
+
|
|
7
|
+
it 'default' do
|
|
8
|
+
Badge.new(1).to_s.should eq HtmlHelper.html_for('badges', "#default span")
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
LabelBase::TYPES.each do |type|
|
|
12
|
+
it type do
|
|
13
|
+
Badge.new(1).send(type).to_s.should eq HtmlHelper.html_for('badges', "##{type} span")
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
context 'Constructors' do
|
|
20
|
+
|
|
21
|
+
LabelBase::TYPES.each do |type|
|
|
22
|
+
it type do
|
|
23
|
+
Badge.send(type, 1).to_s.should eq Badge.new(1).send(type).to_s
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
end
|
data/spec/brand_spec.rb
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Brand do
|
|
4
|
+
|
|
5
|
+
it 'default' do
|
|
6
|
+
Brand.new('BrandName1', 'url1').to_s.should eq '<a class="brand" href="url1">BrandName1</a>'
|
|
7
|
+
Brand.new('BrandName2', 'url2').to_s.should eq '<a class="brand" href="url2">BrandName2</a>'
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Breadcrumb do
|
|
4
|
+
|
|
5
|
+
it 'one level' do
|
|
6
|
+
tag = Breadcrumb.new do
|
|
7
|
+
append 'Home'
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
tag.to_s.should eq HtmlHelper.html_for('breadcrumbs', "#one ul")
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
it 'two levels' do
|
|
14
|
+
tag = Breadcrumb.new do
|
|
15
|
+
append Link.new 'Home', '#'
|
|
16
|
+
append 'Page'
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
tag.to_s.should eq HtmlHelper.html_for('breadcrumbs', "#two ul")
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it 'three levels' do
|
|
23
|
+
tag = Breadcrumb.new do
|
|
24
|
+
append Link.new 'Home', '#'
|
|
25
|
+
append Link.new 'Page', '#'
|
|
26
|
+
append 'Data'
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
tag.to_s.should eq HtmlHelper.html_for('breadcrumbs', "#three ul")
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
end
|
data/spec/button_spec.rb
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Button do
|
|
4
|
+
|
|
5
|
+
context 'Types' do
|
|
6
|
+
it 'default' do
|
|
7
|
+
Button.new('Click me').to_s.should eq HtmlHelper.html_for('buttons', "#default button")
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
Button::TYPES.each do |type|
|
|
11
|
+
it type do
|
|
12
|
+
Button.new('Click me').send(type).to_s.should eq HtmlHelper.html_for('buttons', "##{type} button")
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
context 'Sizes' do
|
|
18
|
+
Button::SIZES.each do |size|
|
|
19
|
+
it size do
|
|
20
|
+
Button.new('Click me').send(size).to_s.should eq HtmlHelper.html_for('buttons', "##{size} button")
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it 'Mixed' do
|
|
26
|
+
Button.new('Click me').primary.large.to_s.should eq HtmlHelper.html_for('buttons', "#mixed button")
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
context 'Constructors' do
|
|
30
|
+
|
|
31
|
+
Button::TYPES.each do |type|
|
|
32
|
+
it type do
|
|
33
|
+
Button.send(type, 'Click me').to_s.should eq Button.new('Click me').send(type).to_s
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
Button::SIZES.each do |size|
|
|
38
|
+
it size do
|
|
39
|
+
Button.send(size, 'Click me').to_s.should eq Button.new('Click me').send(size).to_s
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
Button::TYPES.each do |type|
|
|
44
|
+
Button::SIZES.each do |size|
|
|
45
|
+
it "#{type}_#{size}" do
|
|
46
|
+
Button.send("#{type}_#{size}", 'Click me').to_s.should eq Button.new('Click me').send(type).send(size).to_s
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe ControlGroup do
|
|
4
|
+
|
|
5
|
+
context 'Types' do
|
|
6
|
+
|
|
7
|
+
it 'default' do
|
|
8
|
+
ControlGroup.new('Label') { append Input.text }.to_s.should eq HtmlHelper.html_for('control_groups', "#default .control-group")
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
ControlGroup::TYPES.each do |type|
|
|
12
|
+
it type do
|
|
13
|
+
ControlGroup.new('Label') { append Input.text }.send(type).to_s.should eq HtmlHelper.html_for('control_groups', "##{type} .control-group")
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
context 'Constructors' do
|
|
20
|
+
|
|
21
|
+
ControlGroup::TYPES.each do |type|
|
|
22
|
+
it type do
|
|
23
|
+
ControlGroup.send(type, 'Label') { append Input.text }.to_s.should eq ControlGroup.new('Label') { append Input.text }.send(type).to_s
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Divider do
|
|
4
|
+
|
|
5
|
+
it 'horizontal' do
|
|
6
|
+
Divider.horizontal.to_s.should eq '<li class="divider"></li>'
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
it 'vertical' do
|
|
10
|
+
Divider.vertical.to_s.should eq '<li class="divider-vertical"></li>'
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
it 'breadcrumb' do
|
|
14
|
+
Divider.breadcrumb.to_s.should eq '<span class="divider">/</span>'
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
end
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe DropdownButton do
|
|
4
|
+
|
|
5
|
+
context 'Types' do
|
|
6
|
+
it 'default' do
|
|
7
|
+
tag = DropdownButton.new('Select option') do
|
|
8
|
+
append Link.new('Option 1', '#1')
|
|
9
|
+
append Link.new('Option 2', '#2')
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
tag.to_s.should eq HtmlHelper.html_for('dropdown_buttons', "#default div")
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
Button::TYPES.each do |type|
|
|
16
|
+
it type do
|
|
17
|
+
tag = DropdownButton.new('Select option') do
|
|
18
|
+
append Link.new('Option 1', '#1')
|
|
19
|
+
append Link.new('Option 2', '#2')
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
tag.send(type).to_s.should eq HtmlHelper.html_for('dropdown_buttons', "##{type} div")
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
context 'Sizes' do
|
|
28
|
+
Button::SIZES.each do |size|
|
|
29
|
+
it size do
|
|
30
|
+
tag = DropdownButton.new('Select option') do
|
|
31
|
+
append Link.new('Option 1', '#1')
|
|
32
|
+
append Link.new('Option 2', '#2')
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
tag.send(size).to_s.should eq HtmlHelper.html_for('dropdown_buttons', "##{size} div")
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
context 'Constructors' do
|
|
41
|
+
|
|
42
|
+
Button::TYPES.each do |type|
|
|
43
|
+
it type do
|
|
44
|
+
DropdownButton.send(type, 'Select option').to_s.should eq DropdownButton.new('Select option').send(type).to_s
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
Button::SIZES.each do |size|
|
|
49
|
+
it size do
|
|
50
|
+
DropdownButton.send(size, 'Select option').to_s.should eq DropdownButton.new('Select option').send(size).to_s
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
Button::TYPES.each do |type|
|
|
55
|
+
Button::SIZES.each do |size|
|
|
56
|
+
it "#{type}_#{size}" do
|
|
57
|
+
DropdownButton.send("#{type}_#{size}", 'Select option').to_s.should eq DropdownButton.new('Select option').send(type).send(size).to_s
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
context 'Complex' do
|
|
64
|
+
|
|
65
|
+
it 'mixed' do
|
|
66
|
+
tag = DropdownButton.new('Select option') do
|
|
67
|
+
append Link.new('Option 1', '#1')
|
|
68
|
+
append Link.new('Option 2', '#2')
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
tag.primary.large.to_s.should eq HtmlHelper.html_for('dropdown_buttons', "#mixed div")
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
it 'image' do
|
|
75
|
+
tag = DropdownButton.new('Select option') do
|
|
76
|
+
append(Link.new('#1') do
|
|
77
|
+
append Icon.new('search')
|
|
78
|
+
append 'Option 1'
|
|
79
|
+
end)
|
|
80
|
+
append(Link.new('#2') do
|
|
81
|
+
append Icon.new('star')
|
|
82
|
+
append 'Option 2'
|
|
83
|
+
end)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
tag.to_s.should eq HtmlHelper.html_for('dropdown_buttons', "#image div")
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
it 'divider' do
|
|
90
|
+
tag = DropdownButton.new('Select option') do
|
|
91
|
+
append Link.new('Option 1', '#1')
|
|
92
|
+
append Divider.horizontal
|
|
93
|
+
append Link.new('Option 2', '#2')
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
tag.to_s.should eq HtmlHelper.html_for('dropdown_buttons', "#divider div")
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
end
|
|
@@ -0,0 +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
|
+
|
|
22
|
+
end
|
|
@@ -0,0 +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
|
+
|
|
71
|
+
end
|
data/spec/form_spec.rb
ADDED
|
@@ -0,0 +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
|
+
|
|
35
|
+
end
|
|
@@ -0,0 +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
|
+
|
|
69
|
+
end
|