Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 16 additions & 40 deletions spec/system/topic_thumbnails_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,56 +7,32 @@

before { sign_in user }

RSpec.shared_examples "topic thumbnails" do
{
"grid" => "grid",
"minimal-grid" => "minimal",
"list" => "list",
"blog-style" => "blog-style-grid",
}.each do |style, class_name|
it "renders topic thumbnails in #{style} style" do
theme.update_setting(:default_thumbnail_mode, style)
theme.save!

visit "/latest"

expect(page).to have_css(".topic-list.topic-thumbnails-#{class_name}")
expect(page).to have_css(".topic-list-thumbnail", count: 5)
end
end

it "renders topic thumbnails in masonry style" do
theme.update_setting(:default_thumbnail_mode, "masonry")
{
"grid" => "grid",
"minimal-grid" => "minimal",
"list" => "list",
"blog-style" => "blog-style-grid",
}.each do |style, class_name|
it "renders topic thumbnails in #{style} style" do
theme.update_setting(:default_thumbnail_mode, style)
theme.save!

visit "/latest"

expect(page).to have_css(".topic-list.topic-thumbnails-masonry")
expect(page).to have_css(".topic-list.topic-thumbnails-#{class_name}")
expect(page).to have_css(".topic-list-thumbnail", count: 5)

expect(page).to have_css(".topic-list-item.masonry-0")
end
end

context "with default raw-hbs topic list" do
before { SiteSetting.glimmer_topic_list_mode = "disabled" }

it "is using legacy topic list" do
visit "/latest"
expect(page).to have_css(".topic-list.ember-view")
end

it_behaves_like "topic thumbnails"
end
it "renders topic thumbnails in masonry style" do
theme.update_setting(:default_thumbnail_mode, "masonry")
theme.save!

context "with glimmer topic list" do
before { SiteSetting.glimmer_topic_list_mode = "auto" }
visit "/latest"

it "is using glimmer topic list" do
visit "/latest"
expect(page).to have_css(".topic-list:not(.ember-view)")
end
expect(page).to have_css(".topic-list.topic-thumbnails-masonry")
expect(page).to have_css(".topic-list-thumbnail", count: 5)

it_behaves_like "topic thumbnails"
expect(page).to have_css(".topic-list-item.masonry-0")
end
end
Loading