Skip to content

Commit

Permalink
Merge branch 'main' into user/fvisser/storybook-8-beta-test
Browse files Browse the repository at this point in the history
  • Loading branch information
fredvisser committed Mar 12, 2024
2 parents 2816c86 + 880dfa1 commit 87d0f50
Show file tree
Hide file tree
Showing 37 changed files with 609 additions and 107 deletions.
2 changes: 1 addition & 1 deletion angular-workspace/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,6 @@
"ng-packagr": "^15.2.2",
"playwright": "1.40.0",
"rollup": "^4.12.0",
"typescript": "~4.8.2"
"typescript": "~4.9.5"
}
}
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
15 changes: 15 additions & 0 deletions angular-workspace/projects/ni/nimble-angular/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
{
"name": "@ni/nimble-angular",
"entries": [
{
"date": "Tue, 12 Mar 2024 21:01:54 GMT",
"version": "20.2.21",
"tag": "@ni/nimble-angular_v20.2.21",
"comments": {
"patch": [
{
"author": "beachball",
"package": "@ni/nimble-angular",
"comment": "Bump @ni/nimble-components to v21.10.1",
"commit": "not available"
}
]
}
},
{
"date": "Thu, 07 Mar 2024 21:20:52 GMT",
"version": "20.2.20",
Expand Down
10 changes: 9 additions & 1 deletion angular-workspace/projects/ni/nimble-angular/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
# Change Log - @ni/nimble-angular

This log was last generated on Thu, 07 Mar 2024 21:20:52 GMT and should not be manually modified.
This log was last generated on Tue, 12 Mar 2024 21:01:54 GMT and should not be manually modified.

<!-- Start content -->

## 20.2.21

Tue, 12 Mar 2024 21:01:54 GMT

### Patches

- Bump @ni/nimble-components to v21.10.1

## 20.2.20

Thu, 07 Mar 2024 21:20:52 GMT
Expand Down
4 changes: 2 additions & 2 deletions angular-workspace/projects/ni/nimble-angular/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ni/nimble-angular",
"version": "20.2.20",
"version": "20.2.21",
"description": "Angular components for the NI Nimble Design System",
"scripts": {
"invoke-publish": "cd ../../../ && npm run build:library && cd dist/ni/nimble-angular && npm publish"
Expand Down Expand Up @@ -31,7 +31,7 @@
"@angular/forms": "^15.2.10",
"@angular/localize": "^15.2.10",
"@angular/router": "^15.2.10",
"@ni/nimble-components": "^21.10.0"
"@ni/nimble-components": "^21.10.1"
},
"dependencies": {
"tslib": "^2.2.0"
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

0 comments on commit 87d0f50

Please sign in to comment.