Skip to content

Commit

Permalink
fix(testing): harness not applying :active to parents
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 559585226
  • Loading branch information
asyncLiz authored and Copybara-Service committed Aug 24, 2023
1 parent dffff2d commit 327eeaf
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions testing/harness.ts
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,9 @@ export class Harness<E extends HTMLElement = HTMLElement> {
protected simulateMousePress(
element: HTMLElement, init: PointerEventInit = {}) {
this.addPseudoClass(element, ':active');
this.forEachNodeFrom(element, el => {
this.addPseudoClass(el, ':active');
});
const mouseInit = this.createMouseEventInit(element);
const pointerInit: PointerEventInit = {
...mouseInit,
Expand All @@ -574,6 +577,9 @@ export class Harness<E extends HTMLElement = HTMLElement> {
protected simulateMouseRelease(
element: HTMLElement, init: PointerEventInit = {}) {
this.removePseudoClass(element, ':active');
this.forEachNodeFrom(element, el => {
this.removePseudoClass(el, ':active');
});
const mouseInit = this.createMouseEventInit(element);
const pointerInit: PointerEventInit = {
...mouseInit,
Expand All @@ -596,6 +602,9 @@ export class Harness<E extends HTMLElement = HTMLElement> {
element: HTMLElement, init: PointerEventInit = {},
touchInit: TouchEventInit = {}) {
this.addPseudoClass(element, ':active');
this.forEachNodeFrom(element, el => {
this.addPseudoClass(el, ':active');
});
const mouseInit = this.createMouseEventInit(element);
const pointerInit: PointerEventInit = {
...mouseInit,
Expand Down Expand Up @@ -628,6 +637,9 @@ export class Harness<E extends HTMLElement = HTMLElement> {
element: HTMLElement, init: PointerEventInit = {},
touchInit: TouchEventInit = {}) {
this.removePseudoClass(element, ':active');
this.forEachNodeFrom(element, el => {
this.removePseudoClass(el, ':active');
});
const mouseInit = this.createMouseEventInit(element);
const pointerInit: PointerEventInit = {
...mouseInit,
Expand Down Expand Up @@ -655,6 +667,9 @@ export class Harness<E extends HTMLElement = HTMLElement> {
element: HTMLElement, init: PointerEventInit = {},
touchInit: TouchEventInit = {}) {
this.removePseudoClass(element, ':active');
this.forEachNodeFrom(element, el => {
this.removePseudoClass(el, ':active');
});
const mouseInit = this.createMouseEventInit(element);
const pointerInit: PointerEventInit = {
...mouseInit,
Expand Down

0 comments on commit 327eeaf

Please sign in to comment.