|
13 | 13 | reports = menu["Reports"]
|
14 | 14 | reports.add "A Sub Reports", "/admin/a-sub-reports"
|
15 | 15 | reports.add "B Sub Reports", "/admin/b-sub-reports"
|
| 16 | + menu.add "Administration", "/admin/administration" |
| 17 | + administration = menu["Administration"] |
| 18 | + administration.add "User administration", '/admin/user-administration', 10, :if => proc { false } |
| 19 | + menu.add "Management", "#" |
| 20 | + management = menu["Management"] |
| 21 | + management.add "Order management", '/admin/order-management', 10, :if => proc { false } |
| 22 | + management.add "Bill management", '/admin/bill-management', 10, :if => :admin_logged_in? |
| 23 | + |
| 24 | + renderer.stub!(:admin_logged_in?).and_return(false) |
16 | 25 | end
|
17 | 26 |
|
18 | 27 | it "should generate a ul" do
|
|
39 | 48 | html.should have_tag("li", :parent => { :tag => "ul" }, :attributes => {:id => "a_sub_reports"})
|
40 | 49 | html.should have_tag("li", :parent => { :tag => "ul" }, :attributes => {:id => "b_sub_reports"})
|
41 | 50 | end
|
| 51 | + |
| 52 | + it "should not generate a link for user administration" do |
| 53 | + html.should_not have_tag("a", "User administration", :attributes => { :href => '/admin/user-administration' }) |
| 54 | + end |
| 55 | + |
| 56 | + it "should generate the administration parent menu" do |
| 57 | + html.should have_tag("a", "Administration", :attributes => { :href => '/admin/administration' }) |
| 58 | + end |
| 59 | + |
| 60 | + it "should not generate a link for order management" do |
| 61 | + html.should_not have_tag("a", "Order management", :attributes => { :href => '/admin/order-management' }) |
| 62 | + end |
| 63 | + |
| 64 | + it "should not generate a link for bill management" do |
| 65 | + html.should_not have_tag("a", "Bill management", :attributes => { :href => '/admin/bill-management' }) |
| 66 | + end |
| 67 | + |
| 68 | + it "should not generate the management parent menu" do |
| 69 | + html.should_not have_tag("a", "Management", :attributes => { :href => '#' }) |
| 70 | + end |
42 | 71 |
|
43 | 72 | describe "marking current item" do
|
44 | 73 | it "should add the 'current' class to the li" do
|
|
0 commit comments