Skip to content

Commit

Permalink
Merge pull request #1390 from code-corps/fix-bug-in-verification-docu…
Browse files Browse the repository at this point in the history
…ment

Fix bug in verification-document hbs that does not show if it's not errored
  • Loading branch information
joshsmith committed Oct 4, 2017
2 parents 026d9dc + e127750 commit a0a747f
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/styles/layout/_forms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ form {

.error {
color: $red;
margin: 5px;
margin: 5px 0;
}

.login-form, .signup-form, .reset-password-form, .forgot-password-form {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{{#if (eq status 'required')}}
{{#if (or (eq status 'required') (eq status 'errored'))}}
{{#if isBusy}}
<p>Processing...</p>
{{else if isUploading}}
{{progressMessage}}
{{else}}
<p>We need you to upload a copy of your personal ID to verify your identity.</p>
<p>Please upload either a PNG or JPG image. Your file should be less than 8MB.</p>
<div>
<p>
{{payments/funds-recipient/identity-document-file-upload
isBusy=isBusy
stripeConnectAccount=stripeConnectAccount
Expand All @@ -15,7 +15,10 @@
uploadDone=(action onUploadDone)
uploadError=(action onUploadError)
validationError=(action onValidationError)}}
</div>
</p>
{{#if (eq status 'errored')}}
<p class="error">Stripe was unable to verify your identity with the document you provided. Please try again.</p>
{{/if}}
{{#if error}}
<div class="error">{{error}}</div>
{{/if}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,17 @@ test('it shows errors if any', function(assert) {

renderPage();

assert.equal(page.errorText, 'Lorem ipsum', 'Error is rendered');
assert.equal(page.error.text, 'Lorem ipsum', 'Error is rendered');
});

test('it renders Stripe error correctly', function(assert) {
assert.expect(2);
this.set('stripeConnectAccount', { verificationDocumentStatus: 'errored' });

renderPage();

assert.ok(page.error.isVisible, 'Error is rendered');
assert.ok(page.rendersFileUpload, 'File upload subcomponent is rendered');
});

// TODO: Figure out how to write these
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
import Ember from 'ember';
import { clickable, isVisible, text } from 'ember-cli-page-object';
import { clickable, isVisible } from 'ember-cli-page-object';

const { $, run } = Ember;

export default {
scope: '.verification-document',
errorText: text('.error'),
rendersFileUpload: isVisible('input[type=file]'),

clickSubmit: clickable('button'),

error: {
scope: '.error'
},

rendersFileUpload: isVisible('input[type=file]'),

// since it's near impossible to simulate selecting a file with a filepicker
// this does the "next best" thing and triggers the "upload done" action on the component
triggerDocumentSubmitted(context, stripeFileId = 'fil_test') {
Expand All @@ -20,4 +25,3 @@ export default {
});
}
};

0 comments on commit a0a747f

Please sign in to comment.