Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Angular Select placeholder integration #1912

Merged
merged 84 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
30c8250
Iniital implementation
atmgrifter00 Feb 20, 2024
1af86a8
Minor change
atmgrifter00 Feb 20, 2024
9441431
Mark placeholderVisible API as internal
atmgrifter00 Feb 20, 2024
ca12dc4
Newline
atmgrifter00 Feb 20, 2024
ab7f2f6
Remove unneeded storybook change.
atmgrifter00 Feb 20, 2024
1be9868
Fix escape behavior with placeholder
atmgrifter00 Feb 20, 2024
1c62453
Revert some changes
atmgrifter00 Feb 20, 2024
52a4a7a
Add a comment
atmgrifter00 Feb 20, 2024
4598108
Prettier
atmgrifter00 Feb 20, 2024
af6fd1b
Select placeholder re-work with tests.
atmgrifter00 Feb 23, 2024
b858136
Change files
atmgrifter00 Feb 23, 2024
3ba52a6
Allow changing placeholder option.
atmgrifter00 Feb 26, 2024
69ffb06
Merge branch 'main' into select-placeholder
atmgrifter00 Feb 26, 2024
cfde826
Docs and minor updates.
atmgrifter00 Feb 26, 2024
fd12e2f
Merge branch 'select-placeholder' of https://github.com/ni/nimble int…
atmgrifter00 Feb 26, 2024
1d33027
Slight re-factor.
atmgrifter00 Feb 27, 2024
0681812
Add PageObject method and test.
atmgrifter00 Feb 27, 2024
d2d92ef
Slight code-reorg.
atmgrifter00 Feb 27, 2024
ee6ffd4
Fix matrix test.
atmgrifter00 Feb 27, 2024
c4e47b8
Revert a change.
atmgrifter00 Feb 27, 2024
501f6fe
Merge branch 'main' into select-placeholder
atmgrifter00 Feb 27, 2024
b764042
Angular update.
atmgrifter00 Feb 27, 2024
c110138
Export Select pageobject.
atmgrifter00 Feb 28, 2024
938ad6f
Update packages/nimble-components/src/select/tests/select.stories.ts
atmgrifter00 Feb 28, 2024
d8ee8cd
Update packages/nimble-components/src/select/tests/select.stories.ts
atmgrifter00 Feb 28, 2024
5ca54b1
Handle PR feedback.
atmgrifter00 Feb 28, 2024
b09b8a5
Merge branch 'select-placeholder' of https://github.com/ni/nimble int…
atmgrifter00 Feb 28, 2024
4640d41
Prettier
atmgrifter00 Feb 28, 2024
c6dfd60
Merge branch 'main' into select-placeholder
atmgrifter00 Feb 28, 2024
aedd65e
Add comments
atmgrifter00 Feb 28, 2024
cce5ae7
Merge branch 'main' into select-placeholder
atmgrifter00 Feb 28, 2024
1584fc5
Merge branch 'main' into select-placeholder
atmgrifter00 Feb 28, 2024
7a08e22
Merge branch 'select-placeholder' into select-placeholder-Angular-Blazor
atmgrifter00 Feb 28, 2024
7e5ec79
Fix test
atmgrifter00 Feb 28, 2024
0a89d27
Merge branch 'select-placeholder' of https://github.com/ni/nimble int…
atmgrifter00 Feb 28, 2024
a50f8c6
Add pageObject public method.
atmgrifter00 Feb 28, 2024
2f4fc4e
Merge branch 'select-placeholder' into select-placeholder-Angular-Blazor
atmgrifter00 Feb 28, 2024
3ae5ba0
Make pageObject API non-async
atmgrifter00 Feb 28, 2024
b3303ce
Merge branch 'select-placeholder' into select-placeholder-Angular-Blazor
atmgrifter00 Feb 28, 2024
b15b452
Make new API click-based.
atmgrifter00 Feb 28, 2024
a142be5
Merge branch 'select-placeholder' into select-placeholder-Angular-Blazor
atmgrifter00 Feb 28, 2024
e5063d5
Slight pageObject update.
atmgrifter00 Feb 29, 2024
38f1d83
Merge branch 'select-placeholder' into select-placeholder-Angular-Blazor
atmgrifter00 Feb 29, 2024
0d434b7
Merge branch 'main' into select-placeholder
atmgrifter00 Feb 29, 2024
0543d0b
Another pageObject change.
atmgrifter00 Feb 29, 2024
16f33a9
Merge branch 'select-placeholder' into select-placeholder-Angular-Blazor
atmgrifter00 Feb 29, 2024
cfd26ff
Remove fdescribe
atmgrifter00 Feb 29, 2024
088dafd
Allow pageObject.clickOption to work without being open.
atmgrifter00 Feb 29, 2024
3f606cd
Merge branch 'select-placeholder' into select-placeholder-Angular-Blazor
atmgrifter00 Feb 29, 2024
5d93db9
Update packages/nimble-components/src/select/testing/select.pageobjec…
atmgrifter00 Mar 4, 2024
3a41432
Update packages/nimble-components/src/select/index.ts
atmgrifter00 Mar 4, 2024
a9a33f5
Handle PR feedback.
atmgrifter00 Mar 4, 2024
b995b50
Merge branch 'select-placeholder' of https://github.com/ni/nimble int…
atmgrifter00 Mar 4, 2024
92fd495
Merge branch 'main' into select-placeholder
atmgrifter00 Mar 4, 2024
bd7ba33
Update packages/nimble-components/src/select/styles.ts
atmgrifter00 Mar 5, 2024
40d036f
Update packages/nimble-components/src/select/template.ts
atmgrifter00 Mar 5, 2024
b0b5b25
Merge branch 'select-placeholder' of https://github.com/ni/nimble int…
atmgrifter00 Mar 5, 2024
5054609
Revert an update.
atmgrifter00 Mar 5, 2024
13b9f94
Handle PR feedback.
atmgrifter00 Mar 5, 2024
582ee06
Fix build issue.
atmgrifter00 Mar 5, 2024
95348a7
Merge branch 'select-placeholder' into select-placeholder-Angular-Blazor
atmgrifter00 Mar 5, 2024
f16866f
Add DropdownOwner interface for Select option registration.
atmgrifter00 Mar 7, 2024
910f773
Change files
atmgrifter00 Mar 7, 2024
7162eb5
Merge branch 'main' into select-placeholder-Angular
atmgrifter00 Mar 7, 2024
db0c6fe
Update nimble-components change file.
atmgrifter00 Mar 7, 2024
ea93f9d
Merge branch 'main' into select-placeholder-Angular
atmgrifter00 Mar 7, 2024
c810ef4
Merge branch 'main' into select-placeholder-Angular
atmgrifter00 Mar 7, 2024
e3fdab0
Merge branch 'main' into select-placeholder-Angular
atmgrifter00 Mar 7, 2024
33ebee0
Changing tests a bit.
atmgrifter00 Mar 8, 2024
0f264d4
Merge branch 'select-placeholder-Angular' of https://github.com/ni/ni…
atmgrifter00 Mar 8, 2024
123e3b4
Handle PR feedback.
atmgrifter00 Mar 8, 2024
c3d01da
Remove fit.
atmgrifter00 Mar 8, 2024
285fb2c
Prettier.
atmgrifter00 Mar 8, 2024
a4c5069
Add select testing entry point, and use pageObject in test.
atmgrifter00 Mar 8, 2024
351d322
Add registerOption implementation to Combobox.
atmgrifter00 Mar 11, 2024
6804aac
Update packages/nimble-components/src/list-option/index.ts
atmgrifter00 Mar 11, 2024
b630db3
Fix typing issues.
atmgrifter00 Mar 11, 2024
e4746cb
Change docs.
atmgrifter00 Mar 11, 2024
09a4255
Prettier.
atmgrifter00 Mar 11, 2024
0c07ffb
Temporary change to see if it fixes lighthouse performance test.
atmgrifter00 Mar 12, 2024
1a567d0
Fix build
atmgrifter00 Mar 12, 2024
33813c9
Align Angular example with Blazor again.
atmgrifter00 Mar 12, 2024
52c0d31
Re-add test and update comment
rajsite Mar 12, 2024
fa49f20
Merge branch 'main' into select-placeholder-Angular
rajsite Mar 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -151,16 +151,19 @@
<div class="sub-container">
<div class="container-label">Select</div>
<nimble-select filter-mode="standard" appearance="underline">
<nimble-list-option hidden selected disabled>Select an option</nimble-list-option>
<nimble-list-option>Option 1</nimble-list-option>
<nimble-list-option>Option 2</nimble-list-option>
<nimble-list-option>Option 3</nimble-list-option>
</nimble-select>
<nimble-select appearance="outline">
<nimble-list-option hidden selected disabled>Select an option</nimble-list-option>
<nimble-list-option>Option 1</nimble-list-option>
<nimble-list-option>Option 2</nimble-list-option>
<nimble-list-option>Option 3</nimble-list-option>
</nimble-select>
<nimble-select appearance="block">
<nimble-list-option hidden selected disabled>Select an option</nimble-list-option>
<nimble-list-option>Option 1</nimble-list-option>
<nimble-list-option>Option 2</nimble-list-option>
<nimble-list-option>Option 3</nimble-list-option>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,6 @@ export class CustomAppComponent implements AfterViewInit {
public constructor(@Inject(ActivatedRoute) public readonly route: ActivatedRoute) {
this.tableData$ = this.tableDataSubject.asObservable();
this.addTableRows(10);

this.comboboxItems = [];
for (let i = 0; i < 300; i++) {
this.comboboxItems.push({
first: i.toString(),
last: i.toString()
});
}
}

public ngAfterViewInit(): void {
Expand Down
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"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './select.pageobject';
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 };
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,22 @@ export class NimbleListOptionDirective {
this.renderer.setProperty(this.elementRef.nativeElement, 'disabled', toBooleanProperty(value));
}

public get selected(): boolean {
return this.elementRef.nativeElement.selected;
}

@Input() public set selected(value: BooleanValueOrAttribute) {
this.renderer.setProperty(this.elementRef.nativeElement, 'selected', toBooleanProperty(value));
}

public get hidden(): boolean {
return this.elementRef.nativeElement.hidden;
}

@Input() public set hidden(value: BooleanValueOrAttribute) {
this.renderer.setProperty(this.elementRef.nativeElement, 'hidden', toBooleanProperty(value));
}

public constructor(
private readonly elementRef: ElementRef<ListOption>,
private readonly renderer: Renderer2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,25 @@ describe('Nimble listbox option', () => {
expect(directive.disabled).toBeUndefined();
expect(nativeElement.disabled).toBeUndefined();
});

it('has expected defaults for selected', () => {
expect(directive.selected).toBeFalse();
expect(nativeElement.selected).toBeFalse();
});

it('has expected defaults for hidden', () => {
expect(directive.hidden).toBeFalse();
expect(nativeElement.hidden).toBeFalse();
});
});

describe('with template string values', () => {
@Component({
template: `
<nimble-list-option #listOption
disabled
selected
hidden
></nimble-list-option>
`
})
Expand Down Expand Up @@ -82,13 +94,25 @@ describe('Nimble listbox option', () => {
expect(directive.disabled).toBeTrue();
expect(nativeElement.disabled).toBeTrue();
});

it('will use template string values for selected', () => {
expect(directive.selected).toBeTrue();
expect(nativeElement.selected).toBeTrue();
});

it('will use template string values for hidden', () => {
expect(directive.hidden).toBeTrue();
expect(nativeElement.hidden).toBeTrue();
});
});

describe('with property bound values', () => {
@Component({
template: `
<nimble-list-option #listOption
[disabled]="disabled"
[selected]="selected"
[hidden]="hidden"
></nimble-list-option>
`
})
Expand All @@ -97,6 +121,8 @@ describe('Nimble listbox option', () => {
@ViewChild('listOption', { read: ElementRef }) public elementRef: ElementRef<ListOption>;

public disabled = false;
public selected = false;
public hidden = false;
}

let fixture: ComponentFixture<TestHostComponent>;
Expand Down Expand Up @@ -124,13 +150,37 @@ describe('Nimble listbox option', () => {
expect(directive.disabled).toBeTrue();
expect(nativeElement.disabled).toBeTrue();
});

it('can be configured with property binding for selected', () => {
expect(directive.selected).toBeFalse();
expect(nativeElement.selected).toBeFalse();

fixture.componentInstance.selected = true;
fixture.detectChanges();

expect(directive.selected).toBeTrue();
expect(nativeElement.selected).toBeTrue();
});

it('can be configured with property binding for hidden', () => {
expect(directive.hidden).toBeFalse();
expect(nativeElement.hidden).toBeFalse();

fixture.componentInstance.hidden = true;
fixture.detectChanges();

expect(directive.hidden).toBeTrue();
expect(nativeElement.hidden).toBeTrue();
});
});

describe('with property attribute values', () => {
@Component({
template: `
<nimble-list-option #listOption
[attr.disabled]="disabled">
[attr.disabled]="disabled"
[attr.selected]="selected"
[attr.hidden]="hidden">
</nimble-list-option>
`
})
Expand All @@ -139,6 +189,8 @@ describe('Nimble listbox option', () => {
@ViewChild('listOption', { read: ElementRef }) public elementRef: ElementRef<ListOption>;

public disabled: BooleanValueOrAttribute = null;
public selected: BooleanValueOrAttribute = null;
public hidden: BooleanValueOrAttribute = null;
}

let fixture: ComponentFixture<TestHostComponent>;
Expand Down Expand Up @@ -166,5 +218,27 @@ describe('Nimble listbox option', () => {
expect(directive.disabled).toBeTrue();
expect(nativeElement.disabled).toBeTrue();
});

it('can be configured with attribute binding for selected', () => {
expect(directive.selected).toBeFalse();
expect(nativeElement.selected).toBeFalse();

fixture.componentInstance.selected = '';
fixture.detectChanges();

expect(directive.selected).toBeTrue();
expect(nativeElement.selected).toBeTrue();
});

it('can be configured with attribute binding for hidden', () => {
expect(directive.hidden).toBeFalse();
expect(nativeElement.hidden).toBeFalse();

fixture.componentInstance.hidden = '';
fixture.detectChanges();

expect(directive.hidden).toBeTrue();
expect(nativeElement.hidden).toBeTrue();
});
});
});
Loading
Loading