-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/11.x.x' into action-hub-harness
* origin/11.x.x: chore: release 11.32.0 (#2988) feat(components/forms): add method to `SkyFormErrorHarness` to get error text (#2992) (#2994) ci: fix e2e concurrency groups (#2989)
- Loading branch information
Showing
7 changed files
with
109 additions
and
10 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
79 changes: 79 additions & 0 deletions
79
libs/components/forms/testing/src/modules/form-error/form-error-harness.spec.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,79 @@ | ||
import { HarnessLoader } from '@angular/cdk/testing'; | ||
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; | ||
import { Component } from '@angular/core'; | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { SKY_FORM_ERRORS_ENABLED, SkyFormErrorModule } from '@skyux/forms'; | ||
|
||
import { SkyFormErrorHarness } from './form-error-harness'; | ||
|
||
//#region Test component | ||
@Component({ | ||
selector: 'sky-form-error-test', | ||
providers: [ | ||
{ | ||
provide: SKY_FORM_ERRORS_ENABLED, | ||
useValue: true, | ||
}, | ||
], | ||
template: ` | ||
<sky-form-error [errorName]="errorName" [errorText]="errorText" /> | ||
<sky-form-error | ||
data-sky-id="other-error" | ||
[errorName]="errorNameSkyId" | ||
[errorText]="errorTextSkyId" | ||
/> | ||
`, | ||
standalone: false, | ||
}) | ||
class TestComponent { | ||
public errorName = 'error'; | ||
public errorText = 'some-error'; | ||
public errorNameSkyId = 'error-sky-id'; | ||
public errorTextSkyId = 'some-error-sky-id'; | ||
} | ||
//#endregion Test component | ||
|
||
describe('Form error harness', () => { | ||
async function setupTest(options: { dataSkyId?: string } = {}): Promise<{ | ||
formErrorHarness: SkyFormErrorHarness; | ||
fixture: ComponentFixture<TestComponent>; | ||
loader: HarnessLoader; | ||
pageLoader: HarnessLoader; | ||
}> { | ||
await TestBed.configureTestingModule({ | ||
declarations: [TestComponent], | ||
imports: [SkyFormErrorModule], | ||
}).compileComponents(); | ||
const fixture = TestBed.createComponent(TestComponent); | ||
const loader = TestbedHarnessEnvironment.loader(fixture); | ||
const pageLoader = TestbedHarnessEnvironment.documentRootLoader(fixture); | ||
const formErrorHarness: SkyFormErrorHarness = options.dataSkyId | ||
? await loader.getHarness( | ||
SkyFormErrorHarness.with({ dataSkyId: options.dataSkyId }), | ||
) | ||
: await loader.getHarness(SkyFormErrorHarness); | ||
return { formErrorHarness, fixture, loader, pageLoader }; | ||
} | ||
|
||
it('should get form error text', async () => { | ||
const { formErrorHarness, fixture } = await setupTest(); | ||
|
||
fixture.detectChanges(); | ||
|
||
await expectAsync(formErrorHarness.getErrorText()).toBeResolvedTo( | ||
fixture.componentInstance.errorText, | ||
); | ||
}); | ||
|
||
it('should get form error text by its data-sky-id', async () => { | ||
const { formErrorHarness, fixture } = await setupTest({ | ||
dataSkyId: 'other-error', | ||
}); | ||
|
||
fixture.detectChanges(); | ||
|
||
await expectAsync(formErrorHarness.getErrorText()).toBeResolvedTo( | ||
fixture.componentInstance.errorTextSkyId, | ||
); | ||
}); | ||
}); |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "skyux", | ||
"version": "11.31.0", | ||
"version": "11.32.0", | ||
"license": "MIT", | ||
"scripts": { | ||
"ng": "nx", | ||
|