Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

angular-component-test-object

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-component-test-object

A class for generating page objects for Angular components.

  • 1.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

angular-component-test-object

A test module that offers page objects for Angular components.

Example unit test (app.spec.ts)

import { async } from '@angular/core/testing';
import { AppComponent } from './app.component';
import { ComponentObject } from 'angular-component-test-object';
import { SomeService } from './some.service';

class AppComponentObject extends ComponentObject {
  constructor() {
    let testComponentClass = AppComponent;
    let declarations = [
      AppComponent,
    ];
    let services = [
      SomeService,
    ];
    super(testComponentClass, declarations, services);
  }

  getAppTitle() {
    return this.getElementText('h1');
  }
}

describe('AppComponent', () => {

  let co: AppComponentObject;

  beforeEach(async( () => {
    co = new AppComponentObject();
  }

));

  it('should create the app', async(() => {
    expect(co.controller).toBeTruthy();
  }));

  it(`should have as title 'insert title here'`, async(() => {
    expect(co.controller.title).toEqual('insert title here');
  }));

  it('should render title in a h1 tag', async(() => {
    expect(co.getAppTitle()).toContain('insert title here');
  }));

});

Keywords

FAQs

Package last updated on 24 Apr 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc