Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1090 add default casa logo #1144

Merged
merged 5 commits into from
Oct 21, 2020
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
8 changes: 8 additions & 0 deletions spec/system/admin_views_volunteers_page_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@
expect(page).to have_text("Miles Driven")
expect(page).to have_text("Want reimbursement?")
end

it "displays default logo" do
sign_in admin

visit volunteers_path

expect(page).to have_xpath("//img[@src = '/packs-test/media/src/images/default-logo-c9048fc43854499e952e4b62a505bf35.png' and @alt='CASA Logo']")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that this hash will stay the same over time? But maybe it will?
'/packs-test/media/src/images/default-logo-c9048fc43854499e952e4b62a505bf35.png

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this hash will stay the same since we're on webpacker v 5.2, which uses contenthash instead of chunkhash to generate this -- it should be 100% based on the file contents.

webpack/webpack.js.org#2096

That said, I'm happy to update this to just look for 'default-logo' so the test is more resilient :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's leave it as is and if it breaks then we'll change it :)

end
end

it "can show/hide columns on volunteers table" do
Expand Down
12 changes: 12 additions & 0 deletions spec/views/layouts/sidebar.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@
assign :casa_org, user.casa_org
end

context "when no organization logo is set" do
let(:user) { build_stubbed :volunteer }

it "displays default logo" do
sign_in user

render partial: "layouts/sidebar"

expect(rendered).to have_xpath("//img[@src = '/packs-test/media/src/images/default-logo-c9048fc43854499e952e4b62a505bf35.png' and @alt='CASA Logo']")
end
end

context "when logged in as a supervisor" do
let(:user) { build_stubbed :supervisor }

Expand Down