-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Angular Select placeholder integration (#1912)
# Pull Request ## π€¨ Rationale - #350 ## π©βπ» Implementation 1. Expose the necessary Angular attributes for the `NimbleListOptionDirection` to support the placeholder use-case 2. Changes to nimble-components to address a problem discovered during early integration attempts for a particular SLE usage. - It was discovered that there are scenarios that will add `nimble-list-options` dynamically to the Angular template contents, followed immediately with setting a form value (that the `Select` was bound to) to the dynamically added option's value. This results in situation where the `SelectControlValueAccessor` processes the set value (which for the `Select` _requires_ that option to be present on the web component side) prior to the `Select` adding the option to its set, which would result in the `Select` view ignoring that value and setting it to empty string instead. - The solution to this is to leverage the `connectedCallback` override of the `NimbleListOption` to allow it to have its parent, through an available interface if implemented, process it. All the `Select` does, is if the option isn't already part of its `options`, it simply pushes it on to it. There is no concern with this interfering with the normal process of the option being added as part of the `slottedOptionsChanged` callback, that will simply result in overwriting the options (which is fine). - Applied this solution to the combobox too 3. Exported the `SelectPageObject` from Angular, so that we can also leverage it in SLE as needed. Removed a lot of unnecessary `async` aspects of the `SelectPageObject` public methods. 4. Updated example app to use the feature and removed extra items from select to align with Blazor app and avoid Lighthouse performance degradation. ## π§ͺ Testing Added unit tests in nimble-components for the new internal interface the `Select` is using. Added the boilerplate unit tests in Angular for the new attributes. Also added a couple of Angular tests one of which is representative of the original failing scenario from the integration effort (and the other is more for completion). ## β Checklist <!--- Review the list and put an x in the boxes that apply or ~~strike through~~ around items that don't (along with an explanation). --> - [ ] I have updated the project documentation to reflect my changes or determined no changes are needed. --------- Co-authored-by: Jesse Attas <[email protected]> Co-authored-by: Milan Raj <[email protected]>
- Loading branch information
1 parent
54d2b61
commit 880dfa1
Showing
17 changed files
with
440 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
angular-workspace/projects/ni/nimble-angular/select/testing/ng-package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"$schema": "../../../../../../node_modules/ng-packagr/ng-package.schema.json", | ||
"lib": { | ||
"entryFile": "public-api.ts" | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
angular-workspace/projects/ni/nimble-angular/select/testing/public-api.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './select.pageobject'; |
3 changes: 3 additions & 0 deletions
3
angular-workspace/projects/ni/nimble-angular/select/testing/select.pageobject.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { SelectPageObject } from '@ni/nimble-components/dist/esm/select/testing/select.pageobject'; | ||
|
||
export { SelectPageObject }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.