Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Added required input for single file attachment #78

Merged
merged 10 commits into from
Nov 18, 2019

Conversation

Blackbaud-AlexKingman
Copy link
Contributor

@Blackbaud-AlexKingman Blackbaud-AlexKingman commented Nov 15, 2019

Addresses #74

Also part of the solution for #21

New docs update for file attachment component:
@Input() required
Indicates if the input must have a file to be valid. This property accepts boolean values.

@codecov
Copy link

codecov bot commented Nov 15, 2019

Codecov Report

Merging #78 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #78   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          24     25    +1     
  Lines         895    893    -2     
  Branches      124    124           
=====================================
- Hits          895    893    -2
Impacted Files Coverage Δ
.../app/public/modules/checkbox/checkbox.component.ts 100% <100%> (ø) ⬆️
src/app/public/modules/shared/forms-utility.ts 100% <100%> (ø)
...dules/file-attachment/file-attachment.component.ts 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 70f8c4a...f81d851. Read the comment docs.

@@ -105,6 +92,10 @@ export class SkyFileAttachmentComponent implements ControlValueAccessor, AfterVi

public rejectedOver: boolean = false;

/**
* Indicates if the input must have a file to be valid. This property accepts boolean values.
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm a little confused by "to be valid." What is considered valid? The single file attachment? Or the form that it is included on? I mean, is the validation specific to the single file attachment? Or is it specific to a form, to indicate that users must attach a file before they can complete the form? The latter makes more sense to me, but the current wording seems like the validation is specific to the input. Also, in #77, we explain the impact of setting required to true. Is there any reason not to include that information in the description? Assuming my understanding of all of this is correct, what do you think of fleshing out this description to:

"Indicates whether the input is required for form validation. When you set this property to true, the component adds aria-required and required attributes to the input element, and both template-driven forms and reactive forms show an invalid state until the input element is complete. This property accepts a boolean value."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah that's all accurate, although I'm not sure we have to point out that both reactive and template-driven forms are supported. Isn't that just the assumption that we would support them both?

Copy link
Contributor

Choose a reason for hiding this comment

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

Good point. The description in #77 called out both reactive and template-driven forms, and I included it here without fully thinking it through. Since we don't really need to call that out, we can tighten up to:

"Indicates whether the input is required for form validation. When you set this property to true, the component adds aria-required and required attributes to the input element so that forms display an invalid state until the input element is complete. This property accepts a boolean value."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Copy link
Member

@Blackbaud-SteveBrush Blackbaud-SteveBrush left a comment

Choose a reason for hiding this comment

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

Works great! Just one simple question.

@@ -22,6 +23,7 @@
tabindex="-1"
type="file"
[attr.accept]="acceptedTypes || null"
[attr.required]="(required) ? '' : null"

Choose a reason for hiding this comment

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

In your previous pull request, you used required, but here you're using attr.required. Is there a specific difference between the two?
https://github.com/blackbaud/skyux-forms/pull/77/files#diff-38b1c0ce82272f881b231303a0ea9867R15

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for catching that - it needs to be consistent. I've changed it.

@Blackbaud-AlexKingman Blackbaud-AlexKingman merged commit 97cba26 into master Nov 18, 2019
@Blackbaud-AlexKingman Blackbaud-AlexKingman deleted the fix-file-attachment-required branch November 18, 2019 20:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants