File tree 3 files changed +35
-21
lines changed
3 files changed +35
-21
lines changed Original file line number Diff line number Diff line change @@ -99,9 +99,12 @@ def step name = nil, options = {}
99
99
end
100
100
end
101
101
102
- def link name
102
+
103
+ def link name , options = { }
104
+ options = { caption : LINK_CAPTION } . merge ( options )
103
105
p :class => "link" do
104
- text "Go on to "
106
+ text options [ :caption ]
107
+ text " "
105
108
simple_link ( name , class : :link )
106
109
end
107
110
end
@@ -242,6 +245,7 @@ def tip text = nil, &block
242
245
IRB_CAPTION = "Type this in irb:"
243
246
RESULT_CAPTION = "Expected result:"
244
247
FUZZY_RESULT_CAPTION = "Approximate expected result:"
248
+ LINK_CAPTION = "Go on to"
245
249
246
250
def console ( commands )
247
251
console_with_message ( TERMINAL_CAPTION , commands )
Original file line number Diff line number Diff line change 1
-
2
- link "learn_to_code"
3
- link "computers"
4
- link "objects"
5
- link "strings"
6
- link "numbers"
7
- link "variables"
8
- link "nil"
9
- link "the_command_line"
10
- link "input_and_output"
11
- link "logic"
12
- link "loops"
13
- link "arrays"
14
- link "argv"
15
- link "hashes"
16
- link "functions"
17
- link "sinatra"
18
- link "extra"
19
- link "next_steps"
1
+ ul do
2
+ li { link "learn_to_code", caption: "" }
3
+ li { link "computers", caption: "" }
4
+ li { link "objects", caption: "" }
5
+ li { link "strings", caption: "" }
6
+ li { link "numbers", caption: "" }
7
+ li { link "variables", caption: "" }
8
+ li { link "nil", caption: "" }
9
+ li { link "the_command_line", caption: "" }
10
+ li { link "input_and_output", caption: "" }
11
+ li { link "logic", caption: "" }
12
+ li { link "loops", caption: "" }
13
+ li { link "arrays", caption: "" }
14
+ li { link "argv", caption: "" }
15
+ li { link "hashes", caption: "" }
16
+ li { link "functions", caption: "" }
17
+ li { link "sinatra", caption: "" }
18
+ li { link "extra", caption: "" }
19
+ li { link "next_steps", caption: "" }
20
+ end
Original file line number Diff line number Diff line change @@ -94,6 +94,15 @@ def step_obj_for(path)
94
94
hash = URI . escape '#'
95
95
assert { a [ "href" ] == "choose_breakfast?back=hello#{ hash } step1" }
96
96
end
97
+
98
+ it "has an optional parameter for the caption" do
99
+ html_doc ( <<-RUBY )
100
+ step "breakfast" do
101
+ link "breakfast", caption: "Eat some"
102
+ end
103
+ RUBY
104
+ assert { html_doc . css ( "p.link" ) . text == "Eat some Breakfast" }
105
+ end
97
106
end
98
107
99
108
describe 'source_code' do
You can’t perform that action at this time.
0 commit comments