Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 373
- Log:
Initial import of Radiant 0.9.1, which is now packaged as a gem. This is an
import of the tagged 0.9.1 source checked out from GitHub, which isn't quite
the same as the gem distribution - but it doesn't seem to be available in an
archived form and the installed gem already has modifications, so this is
the closest I can get.
- Author:
- rool
- Date:
- Mon Mar 21 13:40:05 +0000 2011
- Size:
- 3614 Bytes
1 | require File.dirname(__FILE__) + "/../../spec_helper" |
2 | |
3 | describe Admin::NodeHelper do |
4 | |
5 | before :each do |
6 | @controller = mock("controller") |
7 | @cookies = {} |
8 | helper.stub!(:cookies).and_return(@cookies) |
9 | helper.stub!(:homepage).and_return(nil) |
10 | @page = mock_model(Page) |
11 | end |
12 | |
13 | it "should render a sitemap node" do |
14 | helper.should_receive(:render).with(:partial => "node", :locals => {:level => 0, :simple => false, :page => @page}).and_return(@current_node) |
15 | helper.render_node(@page) |
16 | helper.assigns[:current_node] == @page |
17 | end |
18 | |
19 | it "should show all nodes when on the remove action" do |
20 | assigns[:controller] = @controller |
21 | @controller.should_receive(:action_name).and_return("remove") |
22 | helper.show_all?.should be_true |
23 | end |
24 | |
25 | it "should not show all nodes automatically when not in the remove action" do |
26 | assigns[:controller] = @controller |
27 | @controller.should_receive(:action_name).and_return("index") |
28 | helper.show_all?.should be_false |
29 | end |
30 | |
31 | it "should determine which rows to expand" do |
32 | @cookies[:expanded_rows] = "1,2,3" |
33 | helper.expanded_rows.should == [1,2,3] |
34 | end |
35 | |
36 | it "should determine whether the current node should be expanded" do |
37 | helper.should_receive(:show_all?).and_return(true) |
38 | helper.expanded.should be_true |
39 | end |
40 | |
41 | it "should determine the left padding for the current level" do |
42 | helper.padding_left(0).should == 9 |
43 | helper.padding_left(1).should == 32 |
44 | helper.padding_left(2).should == 55 |
45 | end |
46 | |
47 | it "should determine the class of a parent node" do |
48 | assigns[:current_node] = @page |
49 | child = mock("child") |
50 | @page.should_receive(:children).and_return([child]) |
51 | helper.should_receive(:expanded).and_return(true) |
52 | helper.children_class.should == " children_visible" |
53 | end |
54 | |
55 | it "should display an icon for the current node" do |
56 | assigns[:current_node] = @page |
57 | @page.should_receive(:virtual?).and_return(false) |
58 | helper.should_receive(:image).with("page", :class => "icon", :alt => '', :title => '') |
59 | helper.icon |
60 | end |
61 | |
62 | it "should display the virtual icon if the current node is virtual" do |
63 | assigns[:current_node] = @page |
64 | @page.should_receive(:virtual?).and_return(true) |
65 | helper.should_receive(:image).with("virtual_page", :class => "icon", :alt => '', :title => '') |
66 | helper.icon |
67 | end |
68 | |
69 | it "should render the title of the current node" do |
70 | assigns[:current_node] = @page |
71 | @page.should_receive(:title).and_return("Title") |
72 | helper.node_title.should == %{<span class="title">Title</span>} |
73 | end |
74 | |
75 | it "should render the title of the current node with HTML entities escaped" do |
76 | assigns[:current_node] = @page |
77 | @page.should_receive(:title).and_return("Ham & Cheese") |
78 | helper.node_title.should == %{<span class="title">Ham & Cheese</span>} |
79 | end |
80 | |
81 | it "should render the page type if it's not Page" do |
82 | assigns[:current_node] = @page |
83 | @class = mock("Class") |
84 | @page.should_receive(:class).and_return(@class) |
85 | @class.should_receive(:display_name).and_return("Special") |
86 | helper.page_type.should == %{<span class="info">(Special)</span>} |
87 | end |
88 | |
89 | it "should not render the page type if it's Page" do |
90 | assigns[:current_node] = @page |
91 | @page.should_receive(:class).and_return(Page) |
92 | helper.page_type.should == %{} |
93 | end |
94 | |
95 | it "should render the busy spinner" do |
96 | assigns[:current_node] = @page |
97 | @page.should_receive(:id).and_return(1) |
98 | helper.should_receive(:image).with('spinner.gif', |
99 | :class => 'busy', :id => "busy_1", |
100 | :alt => "", :title => "", |
101 | :style => 'display: none;') |
102 | helper.spinner |
103 | end |
104 | |
105 | end |