|
73 | 73 | expect(response.body).to include(reply_message.body) |
74 | 74 | end |
75 | 75 |
|
76 | | - it "shows threaded view by default" do |
| 76 | + it "shows flat view (oldest first)" do |
77 | 77 | get topic_path(topic) |
78 | | - expect(response.body).to include('messages-container threaded') |
79 | | - end |
80 | | - |
81 | | - it "has active Threaded button" do |
82 | | - get topic_path(topic) |
83 | | - expect(response.body).to include('class="toggle-btn active"') |
84 | | - end |
85 | | - |
86 | | - it "has active Oldest First button" do |
87 | | - get topic_path(topic) |
88 | | - expect(response.body).to include('class="toggle-btn active"') |
89 | | - end |
90 | | - end |
91 | | - |
92 | | - context "with flat view mode" do |
93 | | - it "shows flat view" do |
94 | | - get topic_path(topic, view: 'flat') |
95 | | - expect(response).to have_http_status(:success) |
96 | 78 | expect(response.body).to include('messages-container flat') |
97 | | - end |
98 | | - |
99 | | - it "has active Flat button" do |
100 | | - get topic_path(topic, view: 'flat') |
101 | | - expect(response.body).to include('toggle-btn active') |
102 | | - end |
103 | | - end |
104 | | - |
105 | | - context "with descending sort" do |
106 | | - it "shows newest first" do |
107 | | - get topic_path(topic, view: 'flat', sort: 'desc') |
108 | | - expect(response).to have_http_status(:success) |
109 | | - # Check that reply message appears before root message in HTML |
110 | | - reply_position = response.body.index(reply_message.body) |
| 79 | + # root should appear before reply |
111 | 80 | root_position = response.body.index(root_message.body) |
112 | | - expect(reply_position).to be < root_position |
113 | | - end |
114 | | - end |
115 | | - |
116 | | - context "with invalid view mode" do |
117 | | - it "defaults to threaded" do |
118 | | - get topic_path(topic, view: 'invalid') |
119 | | - expect(response).to have_http_status(:success) |
120 | | - expect(response.body).to include('messages-container threaded') |
| 81 | + reply_position = response.body.index(reply_message.body) |
| 82 | + expect(root_position).to be < reply_position |
121 | 83 | end |
122 | 84 | end |
123 | 85 |
|
|
0 commit comments