'./sentiment-rating-harness-filters'; import { AsyncFactoryFn, ComponentHarness, HarnessPredicate, parallel, TestElement } from '@angular/cdk/testing'; 1 2 3 export class SentimentRatingHarness extends ComponentHarness { 4 static hostSelector = 'app-sentiment-rating'; 5 6 static with(options: SentimentRatingHarnessFilters): HarnessPredicate<SentimentRatingHarness> { 7 return new HarnessPredicate(SentimentRatingHarness, options) 8 .addOption('rate', options.rate, 9 async (harness, rate) => await harness.getRate() === rate 10 ); 11 } 12 13 private _rateButtons: AsyncFactoryFn<TestElement[]> = this.locatorForAll('button'); 14 15 public async getRate(): Promise<number> { 16 const btns = await this._rateButtons(); 17 return (await parallel(() => btns.map(b => b.text()))).reduce((acc, curr) => curr === 'favorite' ? ++acc: acc, 0); 18 } 19 20 public async setRate(rate: number): Promise<void> { 21 if (rate <= 0) throw Error('Rate is invalid'); 22 23 const btns = await this._rateButtons(); 24 static with(options: SentimentRatingHarnessFilters): HarnessPredicate<SentimentRatingHarness> { } import { AsyncFactoryFn, ComponentHarness, HarnessPredicate, parallel, TestElement } from '@angular/cdk/testing'; 1 import { SentimentRatingHarnessFilters } from './sentiment-rating-harness-filters'; 2 3 export class SentimentRatingHarness extends ComponentHarness { 4 static hostSelector = 'app-sentiment-rating'; 5 6 7 return new HarnessPredicate(SentimentRatingHarness, options) 8 .addOption('rate', options.rate, 9 async (harness, rate) => await harness.getRate() === rate 10 ); 11 12 13 private _rateButtons: AsyncFactoryFn<TestElement[]> = this.locatorForAll('button'); 14 15 public async getRate(): Promise<number> { 16 const btns = await this._rateButtons(); 17 return (await parallel(() => btns.map(b => b.text()))).reduce((acc, curr) => curr === 'favorite' ? ++acc: acc, 0); 18 } 19 20 public async setRate(rate: number): Promise<void> { 21 if (rate <= 0) throw Error('Rate is invalid'); 22 23 const btns = await this._rateButtons(); 24 return new HarnessPredicate(SentimentRatingHarness, options) .addOption('rate', options.rate, ); import { AsyncFactoryFn, ComponentHarness, HarnessPredicate, parallel, TestElement } from '@angular/cdk/testing'; 1 import { SentimentRatingHarnessFilters } from './sentiment-rating-harness-filters'; 2 3 export class SentimentRatingHarness extends ComponentHarness { 4 static hostSelector = 'app-sentiment-rating'; 5 6 static with(options: SentimentRatingHarnessFilters): HarnessPredicate<SentimentRatingHarness> { 7 8 9 async (harness, rate) => await harness.getRate() === rate 10 11 } 12 13 private _rateButtons: AsyncFactoryFn<TestElement[]> = this.locatorForAll('button'); 14 15 public async getRate(): Promise<number> { 16 const btns = await this._rateButtons(); 17 return (await parallel(() => btns.map(b => b.text()))).reduce((acc, curr) => curr === 'favorite' ? ++acc: acc, 0); 18 } 19 20 public async setRate(rate: number): Promise<void> { 21 if (rate <= 0) throw Error('Rate is invalid'); 22 23 const btns = await this._rateButtons(); 24 async (harness, rate) => await harness.getRate() === rate import { AsyncFactoryFn, ComponentHarness, HarnessPredicate, parallel, TestElement } from '@angular/cdk/testing'; 1 import { SentimentRatingHarnessFilters } from './sentiment-rating-harness-filters'; 2 3 export class SentimentRatingHarness extends ComponentHarness { 4 static hostSelector = 'app-sentiment-rating'; 5 6 static with(options: SentimentRatingHarnessFilters): HarnessPredicate<SentimentRatingHarness> { 7 return new HarnessPredicate(SentimentRatingHarness, options) 8 .addOption('rate', options.rate, 9 10 ); 11 } 12 13 private _rateButtons: AsyncFactoryFn<TestElement[]> = this.locatorForAll('button'); 14 15 public async getRate(): Promise<number> { 16 const btns = await this._rateButtons(); 17 return (await parallel(() => btns.map(b => b.text()))).reduce((acc, curr) => curr === 'favorite' ? ++acc: acc, 0); 18 } 19 20 public async setRate(rate: number): Promise<void> { 21 if (rate <= 0) throw Error('Rate is invalid'); 22 23 const btns = await this._rateButtons(); 24 import { AsyncFactoryFn, ComponentHarness, HarnessPredicate, parallel, TestElement } from '@angular/cdk/testing'; import { SentimentRatingHarnessFilters } from './sentiment-rating-harness-filters'; export class SentimentRatingHarness extends ComponentHarness { static hostSelector = 'app-sentiment-rating'; static with(options: SentimentRatingHarnessFilters): HarnessPredicate<SentimentRatingHarness> { return new HarnessPredicate(SentimentRatingHarness, options) .addOption('rate', options.rate, async (harness, rate) => await harness.getRate() === rate ); } private _rateButtons: AsyncFactoryFn<TestElement[]> = this.locatorForAll('button'); public async getRate(): Promise<number> { const btns = await this._rateButtons(); return (await parallel(() => btns.map(b => b.text()))).reduce((acc, curr) => curr === 'favorite' ? ++acc: acc, 0); } public async setRate(rate: number): Promise<void> { if (rate <= 0) throw Error('Rate is invalid'); const btns = await this._rateButtons(); 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24