docbrown/spec/system/user/user_edits_profile_spec.rb
Emma Goto f6ee0f20e2
[deploy] Make profile settings save button sticky when modified (#9378)
* Make profile settings save button sticky when modified

* Replace querySelector with class selector, add newlines to end of files

* Make profile settings save button sticky when modified

* Replace querySelector with class selector, add newlines to end of files

* Add rspec test for sticky footer

* Move visit method to before block
2020-07-22 17:45:43 +02:00

29 lines
831 B
Ruby

require "rails_helper"
RSpec.describe "User edits their profile", type: :system do
let(:user) { create(:user, saw_onboarding: true) }
before do
sign_in user
visit "/settings/profile"
end
describe "visiting /settings/profile" do
it "renders an error if the username contains spaces and thus is invalid" do
fill_in "user[username]", with: "a b c"
click_button "Save"
expect(page).to have_text("Username is invalid")
end
it "makes the 'Save Button' footer sticky once a field is filled in", js: true do
expect(page).not_to have_css(".sticky-save-footer")
fill_in "user[website_url]", with: "example.com"
find("#user_website_url").native.send_keys :tab # this un-focuses the filled-in field
expect(page).to have_css(".sticky-save-footer")
end
end
end