Skip to content
Merged
Show file tree
Hide file tree
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
54 changes: 0 additions & 54 deletions app/views/js/templates/_story.js.erb

This file was deleted.

18 changes: 18 additions & 0 deletions spec/system/keyboard_shortcuts_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,24 @@ def create_stories_and_visit
expect(page).to have_css("li.story.open", count: 1)
end

it "wraps the cursor to the first story when pressing j at the end" do
login_as(default_user)
create_stories_and_visit

send_keys("j", "j", "j")

expect(find("li.story.open")).to have_text("First Story")
end

it "wraps the cursor to the last story when pressing k at the top" do
login_as(default_user)
create_stories_and_visit

send_keys("j", "k")

expect(find("li.story.open")).to have_text("Second Story")
end

it "moves cursor without opening with n" do
login_as(default_user)
create_stories_and_visit
Expand Down
36 changes: 36 additions & 0 deletions spec/system/stories_index_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,30 @@ def open_story_and_find_unread_icon(story_title)
expect(page).to have_css(".story.read")
end

it "persists read state across page reload", :aggregate_failures do
create(:story, title: "My Story")
login_as(default_user)
visit news_path

find(".story-preview", text: "My Story").click
expect(page).to have_css(".story.read")

visit news_path
expect(page).to have_no_text("My Story")
end

it "marks a story as read when opened in a background tab with ctrl-click",
:aggregate_failures do
create(:story, title: "My Story")
login_as(default_user)
visit news_path

find(".story-preview", text: "My Story").click(:control)

expect(page.windows.size).to eq(2)
expect(page).to have_css(".story.read")
end

it "displays stories in newest-first order by default" do
create(:story, title: "Older Story", published: 2.days.ago)
create(:story, title: "Newer Story", published: 1.day.ago)
Expand Down Expand Up @@ -207,6 +231,18 @@ def open_story_and_find_unread_icon(story_title)
expect(page).to have_title("(1)")
end

it "clears the unread count in the title when the last story is read",
:aggregate_failures do
create(:story, title: "My Story")
login_as(default_user)
visit news_path
expect(page).to have_title("(1)")

find(".story-preview", text: "My Story").click

expect(page).to have_no_title("(1)")
end

it "allows viewing a story with hot keys" do
create(:story, title: "My Story", body: "My Body")
login_as(default_user)
Expand Down
Loading