@fluid-topics/ft-wc-test-utils 1.3.14 → 1.3.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,6 +9,7 @@ export declare class FtLitElementTestHelper<T extends FtLitElement> {
9
9
  shouldBeHidden(selector?: string): Promise<void>;
10
10
  shouldBeVisible(selector?: string): Promise<void>;
11
11
  shouldNotBeEmpty(selector?: string): Promise<void>;
12
+ protected shouldHaveAttribute(selector: Optional<string>, attribute: string, value: string): Promise<void>;
12
13
  protected shouldHaveTextIgnoringWhiteSpaces(selector: Optional<string>, expectedText: string): Promise<void>;
13
14
  protected matches<E extends HTMLElement>(selector: Optional<string>, matcher: (e: E) => boolean): boolean;
14
15
  protected getTarget<E extends HTMLElement>(selector?: Optional<string>): Optional<E>;
@@ -16,13 +16,16 @@ export class FtLitElementTestHelper {
16
16
  return [...this.element.shadowRoot.querySelectorAll(selector)];
17
17
  }
18
18
  async shouldBeHidden(selector) {
19
- await waitUntil(() => this.matches(selector, target => getComputedStyle(target).display === "none"), "Element should be hidden");
19
+ await waitUntil(() => this.matches(selector, (target) => getComputedStyle(target).display === "none"), "Element should be hidden");
20
20
  }
21
21
  async shouldBeVisible(selector) {
22
- await waitUntil(() => this.matches(selector, target => getComputedStyle(target).display != "none"), "Element should be visible");
22
+ await waitUntil(() => this.matches(selector, (target) => getComputedStyle(target).display != "none"), "Element should be visible");
23
23
  }
24
24
  async shouldNotBeEmpty(selector) {
25
- await waitUntil(() => this.matches(selector, target => { var _a; return ((_a = target.textContent) !== null && _a !== void 0 ? _a : "").trim() !== ""; }), `Element <${selector !== null && selector !== void 0 ? selector : this.element.constructor.name}> should have had text`);
25
+ await waitUntil(() => this.matches(selector, (target) => { var _a; return ((_a = target.textContent) !== null && _a !== void 0 ? _a : "").trim() !== ""; }), `Element <${selector !== null && selector !== void 0 ? selector : this.element.constructor.name}> should have had text`);
26
+ }
27
+ async shouldHaveAttribute(selector, attribute, value) {
28
+ await waitUntil(() => this.matches(selector, (target) => target.getAttribute(attribute) === value), `Element <${selector !== null && selector !== void 0 ? selector : this.element.constructor.name}> should have had attribute "${attribute}" with value "${value}" but was "${this.getTarget(selector).getAttribute(attribute)}"`);
26
29
  }
27
30
  async shouldHaveTextIgnoringWhiteSpaces(selector, expectedText) {
28
31
  await waitUntil(() => this.matches(selector, (target) => { var _a; return this.removeWhiteSpaces((_a = target.textContent) !== null && _a !== void 0 ? _a : "") === this.removeWhiteSpaces(expectedText); }), `Element <${selector !== null && selector !== void 0 ? selector : this.element.constructor.name}> should have had text "${expectedText}" but was "${this.getTarget(selector).textContent}"`);