Skip to content

Commit

Permalink
feat(ripple): Add layout() method to component
Browse files Browse the repository at this point in the history
  • Loading branch information
traviskaufman committed Jun 15, 2017
1 parent 4985b4b commit ef99024
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/mdc-ripple/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@ such as a `mousedown` or a `pointerdown` event). It expands from the center.
Triggers a deactivation of the ripple (the second stage, which happens when the ripple surface is engaged via
interaction, such as a `mouseup` or a `pointerup` event). It expands from the center.

#### MDCRipple.layout()

Recomputes all dimensions and positions for the ripple element. Useful if a ripple surface's
position or dimension is changed programmatically.

### Unbounded Ripples

Expand Down
4 changes: 4 additions & 0 deletions packages/mdc-ripple/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ export class MDCRipple extends MDCComponent {
this.foundation_.deactivate();
}

layout() {
this.foundation_.layout();
}

getDefaultFoundation() {
return new MDCRippleFoundation(MDCRipple.createAdapter(this));
}
Expand Down
7 changes: 7 additions & 0 deletions test/unit/mdc-ripple/mdc-ripple.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@ test('deactivate() delegates to the foundation', () => {
td.verify(component.foundation_.deactivate());
});

test('layout() delegates to the foundation', () => {
const {component} = setupTest();
component.foundation_.layout = td.function();
component.layout();
td.verify(component.foundation_.layout());
});

test('adapter#browserSupportsCssVars delegates to util', () => {
const {component} = setupTest();
assert.equal(
Expand Down

0 comments on commit ef99024

Please sign in to comment.