Skip to content
Snippets Groups Projects
Commit a76a757d authored by OZGCloud's avatar OZGCloud
Browse files

OZG-6300 Add function to get dataTestId

parent 8d066bc3
Branches main
No related tags found
No related merge requests found
......@@ -6,9 +6,9 @@ import {
notExistsAsHtmlElement,
} from '@alfa-client/test-utils';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ButtonComponent, CollaborationIconComponent, SaveIconComponent } from '@ods/system';
import { ButtonComponent, CollaborationIconComponent } from '@ods/system';
import { CollaborationService } from 'libs/collaboration-shared/src/lib/collaboration.service';
import { getDataTestIdOf } from 'libs/tech-shared/test/data-test';
import { getDataTestIdAttributeOf, getDataTestIdOf } from 'libs/tech-shared/test/data-test';
import { MockComponent } from 'ng-mocks';
import { of } from 'rxjs';
import { CollaborationInVorgangContainerComponent } from './collaboration-in-vorgang-container.component';
......@@ -18,7 +18,7 @@ describe('CollaborationInVorgangContainerComponent', () => {
let component: CollaborationInVorgangContainerComponent;
let fixture: ComponentFixture<CollaborationInVorgangContainerComponent>;
const anfrageErstellenButton: string = getDataTestIdOf('anfrage-erstellen-button');
const anfrageErstellenButton: string = getDataTestIdAttributeOf('anfrage-erstellen-button');
const collaborationRequestContainer: string = getDataTestIdOf('collaboration-request-container');
const service: Mock<CollaborationService> = {
......@@ -28,9 +28,9 @@ describe('CollaborationInVorgangContainerComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [ButtonComponent, SaveIconComponent],
declarations: [
CollaborationInVorgangContainerComponent,
MockComponent(ButtonComponent),
MockComponent(CollaborationRequestContainerComponent),
MockComponent(CollaborationIconComponent),
],
......@@ -74,7 +74,7 @@ describe('CollaborationInVorgangContainerComponent', () => {
it('should call service on click', () => {
fixture.detectChanges();
dispatchEventFromFixture(fixture, anfrageErstellenButton, 'click');
dispatchEventFromFixture(fixture, anfrageErstellenButton, 'clickEmitter');
expect(service.showRequestForm).toHaveBeenCalled();
});
......
......@@ -2,7 +2,7 @@ import { dispatchEventFromFixture } from '@alfa-client/test-utils';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ButtonComponent, CloseIconComponent } from '@ods/system';
import { SearchIconComponent } from 'libs/design-system/src/lib/icons/search-icon/search-icon.component';
import { getDataTestIdOf } from 'libs/tech-shared/test/data-test';
import { getDataTestIdAttributeOf } from 'libs/tech-shared/test/data-test';
import { MockComponent } from 'ng-mocks';
import { CollaborationRequestContainerComponent } from './collaboration-request-container.component';
import { CollaborationRequestFormComponent } from './collaboration-request-form/collaboration-request-form.component';
......@@ -11,13 +11,13 @@ describe('CollaborationRequestContainerComponent', () => {
let component: CollaborationRequestContainerComponent;
let fixture: ComponentFixture<CollaborationRequestContainerComponent>;
const cancelButton: string = getDataTestIdOf('collaboration-request-cancel-button');
const cancelButton: string = getDataTestIdAttributeOf('collaboration-request-cancel-button');
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [ButtonComponent],
declarations: [
CollaborationRequestContainerComponent,
MockComponent(ButtonComponent),
MockComponent(SearchIconComponent),
MockComponent(CloseIconComponent),
MockComponent(CollaborationRequestFormComponent),
......@@ -37,7 +37,7 @@ describe('CollaborationRequestContainerComponent', () => {
it('should emit hideRequestForm', () => {
const emitSpy = (component.hideRequestForm.emit = jest.fn());
dispatchEventFromFixture(fixture, cancelButton, 'click');
dispatchEventFromFixture(fixture, cancelButton, 'clickEmitter');
expect(emitSpy).toHaveBeenCalled();
});
......
......@@ -28,3 +28,7 @@ export function getDataTestClassOf(value: string): string {
export function getDataTestIdOf(value: string): string {
return `[data-test-id="${value}"]`;
}
export function getDataTestIdAttributeOf(value: string): string {
return `[dataTestId="${value}"]`;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment