Skip to content

Commit

Permalink
Merge branch 'main' into users/aagash/intermittent-mention-test
Browse files Browse the repository at this point in the history
  • Loading branch information
vivinkrishna-ni committed Oct 10, 2024
2 parents 9db5e67 + 29b790b commit e84f344
Show file tree
Hide file tree
Showing 42 changed files with 934 additions and 189 deletions.
22 changes: 11 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions packages/angular-workspace/nimble-angular/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,36 @@
{
"name": "@ni/nimble-angular",
"entries": [
{
"date": "Wed, 09 Oct 2024 22:13:53 GMT",
"version": "28.2.10",
"tag": "@ni/nimble-angular_v28.2.10",
"comments": {
"none": [
{
"author": "jattasNI@users.noreply.github.com",
"package": "@ni/nimble-angular",
"commit": "943ce38c3a94ac7e58c7d7c35e43a579be80547a",
"comment": "Angular router link test improvements"
}
]
}
},
{
"date": "Wed, 09 Oct 2024 19:24:18 GMT",
"version": "28.2.10",
"tag": "@ni/nimble-angular_v28.2.10",
"comments": {
"patch": [
{
"author": "beachball",
"package": "@ni/nimble-angular",
"comment": "Bump @ni/nimble-components to v32.3.0",
"commit": "not available"
}
]
}
},
{
"date": "Thu, 26 Sep 2024 18:24:50 GMT",
"version": "28.2.9",
Expand Down
10 changes: 9 additions & 1 deletion packages/angular-workspace/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, 26 Sep 2024 18:24:50 GMT and should not be manually modified. -->
<!-- This log was last generated on Wed, 09 Oct 2024 19:24:18 GMT and should not be manually modified. -->

<!-- Start content -->

## 28.2.10

Wed, 09 Oct 2024 19:24:18 GMT

### Patches

- Bump @ni/nimble-components to v32.3.0

## 28.2.9

Thu, 26 Sep 2024 18:24:50 GMT
Expand Down
4 changes: 2 additions & 2 deletions packages/angular-workspace/nimble-angular/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ni/nimble-angular",
"version": "28.2.9",
"version": "28.2.10",
"description": "Angular components for the NI Nimble Design System",
"scripts": {
"invoke-publish": "npm run invoke-publish:setup && cd ../dist/nimble-angular && npm publish",
Expand Down Expand Up @@ -32,7 +32,7 @@
"@angular/forms": "^17.3.12",
"@angular/localize": "^17.3.12",
"@angular/router": "^17.3.12",
"@ni/nimble-components": "^32.2.10"
"@ni/nimble-components": "^32.3.0"
},
"dependencies": {
"tslib": "^2.2.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { Component, ElementRef, Sanitizer, SecurityContext, ViewChild } from '@angular/core';
import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
import { Router } from '@angular/router';
import { fakeAsync, TestBed, tick } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { provideRouter, Router } from '@angular/router';
import { CommonModule, Location } from '@angular/common';
import { RouterTestingModule } from '@angular/router/testing';
import { RouterTestingHarness } from '@angular/router/testing';
import { parameterizeSpec } from '@ni/jasmine-parameterized';
import { processUpdates } from '../../../testing/async-helpers';
import { NimbleAnchorButtonModule } from '../nimble-anchor-button.module';
Expand All @@ -14,7 +15,6 @@ describe('Nimble anchor button RouterLinkWithHrefDirective', () => {
<nimble-anchor-button #anchor nimbleRouterLink="page1" [queryParams]="{param1: true}" [state]="{stateProperty: 123}">
Anchor text
</nimble-anchor-button>
<router-outlet></router-outlet>
`
})
class TestHostComponent {
Expand All @@ -25,49 +25,47 @@ describe('Nimble anchor button RouterLinkWithHrefDirective', () => {
class BlankComponent { }

let anchorButton: AnchorButton;
let fixture: ComponentFixture<TestHostComponent>;
let testHostComponent: TestHostComponent;
let router: Router;
let location: Location;
let innerAnchor: HTMLAnchorElement;
let routerNavigateByUrlSpy: jasmine.Spy;
let anchorClickHandlerSpy: jasmine.Spy;
let sanitizer: jasmine.SpyObj<Sanitizer>;
let harness: RouterTestingHarness;

beforeEach(() => {
beforeEach(async () => {
sanitizer = jasmine.createSpyObj<Sanitizer>('Sanitizer', ['sanitize']);
sanitizer.sanitize.and.callFake((_, value: string) => value);

TestBed.configureTestingModule({
declarations: [TestHostComponent, BlankComponent],
imports: [NimbleAnchorButtonModule,
imports: [
NimbleAnchorButtonModule,
CommonModule,
RouterTestingModule.withRoutes([
{ path: '', redirectTo: '/start', pathMatch: 'full' },
{ path: 'page1', component: BlankComponent },
{ path: 'start', component: TestHostComponent }
], { useHash: true })
],
providers: [
{ provide: Sanitizer, useValue: sanitizer }
{ provide: Sanitizer, useValue: sanitizer },
provideRouter([
{ path: 'page1', component: BlankComponent },
{ path: '', component: TestHostComponent }
]),
]
});
harness = await RouterTestingHarness.create('');
});

beforeEach(fakeAsync(() => {
beforeEach(() => {
router = TestBed.inject(Router);
location = TestBed.inject(Location);
fixture = TestBed.createComponent(TestHostComponent);
testHostComponent = fixture.componentInstance;
testHostComponent = harness.fixture.debugElement.query(By.directive(TestHostComponent)).componentInstance as TestHostComponent;
anchorButton = testHostComponent.anchor.nativeElement;
fixture.detectChanges();
tick();
processUpdates();
innerAnchor = anchorButton!.shadowRoot!.querySelector('a')!;
routerNavigateByUrlSpy = spyOn(router, 'navigateByUrl').and.callThrough();
anchorClickHandlerSpy = jasmine.createSpy('click');
anchorClickHandlerSpy = jasmine.createSpy('click').and.callFake((event: Event) => event.preventDefault());
innerAnchor!.addEventListener('click', anchorClickHandlerSpy);
}));
});

afterEach(() => {
processUpdates();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Component } from '@angular/core';
import { TestBed } from '@angular/core/testing';
import { CommonModule } from '@angular/common';
import { RouterTestingModule } from '@angular/router/testing';
import { processUpdates } from '../../../testing/async-helpers';
import { NimbleAnchorButtonModule } from '../nimble-anchor-button.module';

Expand All @@ -23,8 +22,7 @@ describe('Nimble anchor button RouterLinkDirective', () => {
imports: [
NimbleAnchorButtonModule,
CommonModule,
RouterTestingModule.withRoutes([{ path: '', component: TestHostComponent, pathMatch: 'full' }], { useHash: true })
]
],
});
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { Component, ElementRef, Sanitizer, SecurityContext, ViewChild } from '@angular/core';
import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
import { Router } from '@angular/router';
import { fakeAsync, TestBed, tick } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { provideRouter, Router } from '@angular/router';
import { CommonModule, Location } from '@angular/common';
import { RouterTestingModule } from '@angular/router/testing';
import { RouterTestingHarness } from '@angular/router/testing';
import { parameterizeSpec } from '@ni/jasmine-parameterized';
import { processUpdates } from '../../../testing/async-helpers';
import { NimbleAnchorMenuItemModule } from '../nimble-anchor-menu-item.module';
Expand All @@ -14,7 +15,6 @@ describe('Nimble anchor menu item RouterLinkWithHrefDirective', () => {
<nimble-anchor-menu-item #menuItem nimbleRouterLink="page1" [queryParams]="{param1: true}" [state]="{stateProperty: 123}">
Anchor text
</nimble-anchor-menu-item>
<router-outlet></router-outlet>
`
})
class TestHostComponent {
Expand All @@ -25,49 +25,47 @@ describe('Nimble anchor menu item RouterLinkWithHrefDirective', () => {
class BlankComponent { }

let menuItem: AnchorMenuItem;
let fixture: ComponentFixture<TestHostComponent>;
let testHostComponent: TestHostComponent;
let router: Router;
let location: Location;
let innerAnchor: HTMLAnchorElement;
let routerNavigateByUrlSpy: jasmine.Spy;
let anchorClickHandlerSpy: jasmine.Spy;
let sanitizer: jasmine.SpyObj<Sanitizer>;
let harness: RouterTestingHarness;

beforeEach(() => {
beforeEach(async () => {
sanitizer = jasmine.createSpyObj<Sanitizer>('Sanitizer', ['sanitize']);
sanitizer.sanitize.and.callFake((_, value: string) => value);

TestBed.configureTestingModule({
declarations: [TestHostComponent, BlankComponent],
imports: [NimbleAnchorMenuItemModule,
imports: [
NimbleAnchorMenuItemModule,
CommonModule,
RouterTestingModule.withRoutes([
{ path: '', redirectTo: '/start', pathMatch: 'full' },
{ path: 'page1', component: BlankComponent },
{ path: 'start', component: TestHostComponent }
], { useHash: true })
],
providers: [
{ provide: Sanitizer, useValue: sanitizer }
{ provide: Sanitizer, useValue: sanitizer },
provideRouter([
{ path: 'page1', component: BlankComponent },
{ path: '', component: TestHostComponent }
]),
]
});
harness = await RouterTestingHarness.create('');
});

beforeEach(fakeAsync(() => {
beforeEach(() => {
router = TestBed.inject(Router);
location = TestBed.inject(Location);
fixture = TestBed.createComponent(TestHostComponent);
testHostComponent = fixture.componentInstance;
testHostComponent = harness.fixture.debugElement.query(By.directive(TestHostComponent)).componentInstance as TestHostComponent;
menuItem = testHostComponent.menuItem.nativeElement;
fixture.detectChanges();
tick();
processUpdates();
innerAnchor = menuItem!.shadowRoot!.querySelector('a')!;
routerNavigateByUrlSpy = spyOn(router, 'navigateByUrl').and.callThrough();
anchorClickHandlerSpy = jasmine.createSpy('click');
anchorClickHandlerSpy = jasmine.createSpy('click').and.callFake((event: Event) => event.preventDefault());
innerAnchor!.addEventListener('click', anchorClickHandlerSpy);
}));
});

afterEach(() => {
processUpdates();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Component } from '@angular/core';
import { TestBed } from '@angular/core/testing';
import { CommonModule } from '@angular/common';
import { RouterTestingModule } from '@angular/router/testing';
import { processUpdates } from '../../../testing/async-helpers';
import { NimbleAnchorMenuItemModule } from '../nimble-anchor-menu-item.module';

Expand All @@ -20,11 +19,10 @@ describe('Nimble anchor menu item RouterLinkDirective', () => {
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [TestHostComponent],
imports: [NimbleAnchorMenuItemModule,
CommonModule,
RouterTestingModule.withRoutes([{ path: '', component: TestHostComponent, pathMatch: 'full' }
], { useHash: true })
]
imports: [
NimbleAnchorMenuItemModule,
CommonModule
],
});
});

Expand Down
Loading

0 comments on commit e84f344

Please sign in to comment.