mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
[Enterprise->Create] Show correct error message when user inputs url in instagram field
This commit is contained in:
committed by
Jean-Baptiste Bellet
parent
b9a7ff903f
commit
533f7048bf
@@ -55,6 +55,10 @@ angular.module('Darkswarm').factory "EnterpriseRegistrationService", ($http, Reg
|
||||
).catch((response) ->
|
||||
Loading.clear()
|
||||
alert(t('failed_to_update_enterprise_unknown'))
|
||||
if response.data.errors.instagram
|
||||
igErr = document.querySelector("#instagram-error")
|
||||
igErr.style.display = 'block'
|
||||
igErr.textContent = response.data.errors.instagram[0]
|
||||
)
|
||||
|
||||
prepare: =>
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
.field
|
||||
%label{ for: 'enterprise_instagram' }= t(".instagram")+":"
|
||||
%input.chunky{ id: 'enterprise_instagram', placeholder: "{{'registration.steps.social.instagram_placeholder' | t}}", ng: { model: 'enterprise.instagram' } }
|
||||
%span.error.small-12.columns#instagram-error{ style: "display: none" }
|
||||
|
||||
.row.buttons
|
||||
.small-12.columns
|
||||
|
||||
@@ -125,6 +125,13 @@ describe "Registration" do
|
||||
click_button "Continue"
|
||||
expect(page).to have_content 'How can people find My Awesome Enterprise online?'
|
||||
|
||||
# Filling in social with invalid value for instagram
|
||||
fill_in "enterprise_instagram", with: "www.instagram.com/coopcircuits/ "
|
||||
click_button "Continue"
|
||||
accept_alert "Failed to update your enterprise." do
|
||||
expect(page).to have_content "Must be user name only eg. the_prof"
|
||||
end
|
||||
|
||||
# Filling in social
|
||||
fill_in 'enterprise_website', with: 'www.shop.com'
|
||||
fill_in 'enterprise_facebook', with: 'FaCeBoOk'
|
||||
|
||||
Reference in New Issue
Block a user