Skip to content
Snippets Groups Projects
Select Git revision
  • fe9b057f1135ba949a738a40a236d141396edc7c
  • master default protected
  • add-frequency-to-form
  • dev protected
  • ckan-2.11.0
  • add-package-custom-fields
  • fix-adding-datasets-for-users-and-editors
  • add-auth-subroute
  • 71-migrate-custom-fields-to-ckanext-scheming
  • add-author-maintainer-information
  • fix-inline-flex-btns
  • fix-known-spatial-uri-validation
  • py3
  • 47-aktuelle-resource-einer-collection-wird-nicht-mehr-gefunden
  • 10-eingabe-der-dct-accrualperiodicity-in-weboberflache
  • v1.3
  • 2.5.3
  • 2.5.2
  • 2.5.1
  • 2.5.0
  • 2.4.7
  • 2.4.6
  • 2.4.5
  • 2.4.4
  • 2.4.3
  • 2.4.2
  • 2.4.1
  • 2.4.0
  • 2.3.1
  • 2.3.0
  • 2.2.0
  • 2.1.0
  • 2.0.0
  • 1.4.3
  • 1.4.2
  • 1.4.1
36 results

harvest_sever_mock.py

Blame
  • nav-item.component.spec.ts 1.99 KiB
    import { getElementFromFixture, Mock, mock } from '@alfa-client/test-utils';
    import { importProvidersFrom } from '@angular/core';
    import { ComponentFixture, TestBed } from '@angular/core/testing';
    import { Router, RouterModule } from '@angular/router';
    import { getDataTestIdOf } from 'libs/tech-shared/test/data-test';
    import { NavItemComponent } from './nav-item.component';
    
    describe('NavItemComponent', () => {
      let component: NavItemComponent;
      let fixture: ComponentFixture<NavItemComponent>;
    
      const router: Mock<Router> = mock(Router);
    
      beforeEach(async () => {
        await TestBed.configureTestingModule({
          imports: [NavItemComponent],
          providers: [
            {
              provide: Router,
              useValue: router,
            },
            importProvidersFrom(RouterModule.forRoot([])),
          ],
        }).compileComponents();
    
        fixture = TestBed.createComponent(NavItemComponent);
        component = fixture.componentInstance;
        fixture.detectChanges();
      });
    
      it('should create', () => {
        expect(component).toBeTruthy();
      });
    
      describe('input', () => {
        describe('caption', () => {
          it('should set link text', () => {
            component.caption = 'Test caption';
            fixture.detectChanges();
    
            const captionElement: HTMLParagraphElement = getElementFromFixture(
              fixture,
              getDataTestIdOf('link-caption'),
            );
    
            expect(captionElement.innerHTML).toBe('Test caption');
          });
        });
    
        describe('to', () => {
          it('should set href', () => {
            component.to = '/';
            fixture.detectChanges();
    
            const linkElement: HTMLAnchorElement = getElementFromFixture(
              fixture,
              getDataTestIdOf('link-to-/'),
            );
    
            expect(linkElement).toHaveProperty('href');
          });
        });
      });
    
      describe('template', () => {
        describe('host element role attribute', () => {
          it('should be "menuitem"', () => {
            expect(fixture.nativeElement.getAttribute('role')).toBe('menuitem');
          });
        });
      });
    });