Skip to content

Commit 3bbead5

Browse files
committed
Remove title attributes from steps
1 parent 834dde2 commit 3bbead5

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed

lib/step.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def step name = nil, options = {}
8989
num = next_step_number
9090
a(:name => "step#{current_anchor_num}")
9191
a(:name => options[:anchor_name]) if options[:anchor_name]
92-
div :class => "step", :title => name do
92+
div :class => "step" do
9393
h1 do
9494
widget BigCheckbox
9595
prefix "Step #{num}" + (!name.nil? ? ': ' : '')

spec/step_page_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<h1 class="doc_title">Hello</h1>
3030
<div class="doc">
3131
<a name="step1"></a>
32-
<div class="step" title="hello">
32+
<div class="step">
3333
<h1>#{checkbox_html}<span class="prefix">Step 1: </span>hello</h1>
3434
</div>
3535
</div>

spec/step_spec.rb

+5-10
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,13 @@ def step_obj_for(path)
2828
html = to_html(steps.first)
2929
checkbox_html = %q{<input class="big_checkbox" id="big_checkbox_1" name="big_checkbox_1" type="checkbox" value="valuable"><label for="big_checkbox_1"></label>}
3030
expected = <<-HTML.strip_heredoc.gsub("\n", '')
31-
<div class="step" title="hello">
31+
<div class="step">
3232
<h1>#{checkbox_html}<span class="prefix">Step 1: </span>hello</h1>
3333
</div>
3434
HTML
3535
assert { html == expected }
3636
end
3737

38-
it "puts titles in based on step names" do
39-
steps = html_doc.css(".step")
40-
assert { steps.first["title"] == "hello" }
41-
assert { steps[1]["title"] == "goodbye" }
42-
end
43-
4438
it "puts anchors in based on step numbers" do
4539
steps = html_doc.css(".step")
4640
steps.each_with_index do |step, i|
@@ -71,8 +65,9 @@ def step_obj_for(path)
7165
end
7266
RUBY
7367

74-
titles = html_doc.css('.step').map{|div| div["title"]}
75-
assert { titles == ["breakfast", "cereal", "eggs", "lunch", "salad", "sandwich"] }
68+
titles = html_doc.css('.step h1').map{|title| title.text}
69+
titles.inspect
70+
assert { titles == ["Step 1: breakfast", "Step 1.1: cereal", "Step 1.2: eggs", "Step 2: lunch", "Step 2.1: salad", "Step 2.2: sandwich"] }
7671

7772
anchors = html_doc.css("a")
7873
names = anchors.map{|a| a["name"]}
@@ -90,7 +85,7 @@ def step_obj_for(path)
9085
step "sandwich"
9186
end
9287
RUBY
93-
a = html_doc.css(".step[title=breakfast] a.link").first
88+
a = html_doc.css(".step").first.css("a.link").first
9489
hash = URI.escape '#'
9590
assert { a["href"] == "choose_breakfast?back=hello#{hash}step1" }
9691
end

0 commit comments

Comments
 (0)