Skip to content

Commit

Permalink
fix(ripple)!: rename focus methods to event handlers
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 510549646
  • Loading branch information
asyncLiz authored and copybara-github committed Feb 18, 2023
1 parent cde7ca0 commit 6e97717
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions ripple/lib/ripple.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ export class Ripple extends LitElement {
this.hovered = false;
}

beginFocus() {
handleFocusin() {
this.focused = true;
}

endFocus() {
handleFocusout() {
this.focused = false;
}

Expand Down Expand Up @@ -102,7 +102,7 @@ export class Ripple extends LitElement {
protected override update(changedProps: PropertyValues<this>) {
if (changedProps.has('disabled') && this.disabled) {
this.hovered = false;
this.endFocus();
this.focused = false;
this.endPress();
}
super.update(changedProps);
Expand Down
10 changes: 5 additions & 5 deletions ripple/lib/ripple_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,16 @@ describe('ripple', () => {
expect(surface).not.toHaveClass(RippleStateClasses.PRESSED);
});

it('sets focused class on beginFocus()', async () => {
element.beginFocus();
it('sets focused class on handleFocusin()', async () => {
element.handleFocusin();
await element.updateComplete;

expect(surface).toHaveClass(RippleStateClasses.FOCUSED);
});

it('removes focused class on endFocus()', async () => {
element.beginFocus();
element.endFocus();
it('removes focused class on handleFocusout()', async () => {
element.handleFocusin();
element.handleFocusout();

expect(surface).not.toHaveClass(RippleStateClasses.FOCUSED);
});
Expand Down

0 comments on commit 6e97717

Please sign in to comment.