mirror of https://github.com/ghostfolio/ghostfolio
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.5 KiB
48 lines
1.5 KiB
import { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';
|
|
|
|
class MatBadgeHarness extends ComponentHarness {
|
|
static hostSelector = '.mat-badge';
|
|
static with(options = {}) {
|
|
return new HarnessPredicate(MatBadgeHarness, options).addOption('text', options.text, (harness, text) => HarnessPredicate.stringMatches(harness.getText(), text));
|
|
}
|
|
_badgeElement = this.locatorFor('.mat-badge-content');
|
|
async getText() {
|
|
return (await this._badgeElement()).text();
|
|
}
|
|
async isOverlapping() {
|
|
return (await this.host()).hasClass('mat-badge-overlap');
|
|
}
|
|
async getPosition() {
|
|
const host = await this.host();
|
|
let result = '';
|
|
if (await host.hasClass('mat-badge-above')) {
|
|
result += 'above';
|
|
} else if (await host.hasClass('mat-badge-below')) {
|
|
result += 'below';
|
|
}
|
|
if (await host.hasClass('mat-badge-before')) {
|
|
result += ' before';
|
|
} else if (await host.hasClass('mat-badge-after')) {
|
|
result += ' after';
|
|
}
|
|
return result.trim();
|
|
}
|
|
async getSize() {
|
|
const host = await this.host();
|
|
if (await host.hasClass('mat-badge-small')) {
|
|
return 'small';
|
|
} else if (await host.hasClass('mat-badge-large')) {
|
|
return 'large';
|
|
}
|
|
return 'medium';
|
|
}
|
|
async isHidden() {
|
|
return (await this.host()).hasClass('mat-badge-hidden');
|
|
}
|
|
async isDisabled() {
|
|
return (await this.host()).hasClass('mat-badge-disabled');
|
|
}
|
|
}
|
|
|
|
export { MatBadgeHarness };
|
|
//# sourceMappingURL=badge-testing.mjs.map
|
|
|