Skip to content

Commit

Permalink
chore(dialog): Remove ripple layout & layoutFooterRipples adapter API (
Browse files Browse the repository at this point in the history
…#2570)

The layoutFooterRipples dialog adapter API is no longer used and can be removed.
  • Loading branch information
kfranqueiro authored Apr 16, 2018
1 parent c6076e1 commit 5ba7e27
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 40 deletions.
2 changes: 0 additions & 2 deletions packages/mdc-dialog/foundation.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ export default class MDCDialogFoundation extends MDCFoundation {
trapFocusOnSurface: () => {},
untrapFocusOnSurface: () => {},
isDialog: (/* el: Element */) => /* boolean */ false,
layoutFooterRipples: () => {},
};
}

Expand Down Expand Up @@ -138,7 +137,6 @@ export default class MDCDialogFoundation extends MDCFoundation {
this.adapter_.removeClass(MDCDialogFoundation.cssClasses.ANIMATING);
if (this.isOpen_) {
this.adapter_.trapFocusOnSurface();
this.adapter_.layoutFooterRipples();
} else {
this.enableScroll_();
};
Expand Down
1 change: 0 additions & 1 deletion packages/mdc-dialog/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ export class MDCDialog extends MDCComponent {
trapFocusOnSurface: () => this.focusTrap_.activate(),
untrapFocusOnSurface: () => this.focusTrap_.deactivate(),
isDialog: (el) => el === this.dialogSurface_,
layoutFooterRipples: () => this.footerBtnRipples_.forEach((ripple) => ripple.layout()),
});
}
}
11 changes: 0 additions & 11 deletions test/unit/mdc-dialog/foundation.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ test('default adapter returns a complete adapter implementation', () => {
'registerDocumentKeydownHandler', 'deregisterDocumentKeydownHandler',
'registerTransitionEndHandler', 'deregisterTransitionEndHandler',
'notifyAccept', 'notifyCancel', 'trapFocusOnSurface', 'untrapFocusOnSurface', 'isDialog',
'layoutFooterRipples',
]);
});

Expand Down Expand Up @@ -158,16 +157,6 @@ test('#close deactivates focus trapping on the dialog surface', () => {
td.verify(mockAdapter.untrapFocusOnSurface());
});

test('#open calls adapter method to re-layout footer ripples', () => {
const {foundation, mockAdapter} = setupTest();

td.when(mockAdapter.registerTransitionEndHandler(td.callback)).thenCallback({target: {}});
td.when(mockAdapter.isDialog(td.matchers.isA(Object))).thenReturn(true);
foundation.open();

td.verify(mockAdapter.layoutFooterRipples());
});

test('#accept closes the dialog', () => {
const {foundation} = setupTest();

Expand Down
26 changes: 0 additions & 26 deletions test/unit/mdc-dialog/mdc-dialog.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,13 @@
* limitations under the License.
*/

// This suite requires hooks to stub (and clean up) MDCRipple#layout.
/* eslint mocha/no-hooks: "off" */

import {assert} from 'chai';
import bel from 'bel';
import domEvents from 'dom-events';
import td from 'testdouble';
import {createMockRaf} from '../helpers/raf';
import {strings} from '../../../packages/mdc-dialog/constants';
import {MDCDialog, util} from '../../../packages/mdc-dialog';
import {MDCRipple} from '../../../packages/mdc-ripple';
import {supportsCssVariables} from '../../../packages/mdc-ripple/util';

function getFixture() {
Expand Down Expand Up @@ -73,22 +69,6 @@ function hasClassMatcher(className) {

suite('MDCDialog');

const originalLayout = MDCRipple.prototype.layout;
const stubbedLayout = td.func('MDCRipple#layout');

before(() => {
MDCRipple.prototype.layout = stubbedLayout;
});

afterEach(() => {
// Ensure that stubbedLayout's call count resets between tests
td.reset();
});

after(() => {
MDCRipple.prototype.layout = originalLayout;
});

test('attachTo returns a component instance', () => {
assert.isOk(MDCDialog.attachTo(getFixture().querySelector('.mdc-dialog')) instanceof MDCDialog);
});
Expand Down Expand Up @@ -332,9 +312,3 @@ test('adapter#isDialog returns false for a non-dialog surface element', () => {
const {root, component} = setupTest();
assert.isNotOk(component.getDefaultFoundation().adapter_.isDialog(root));
});

test('adapter#layoutFooterRipples calls layout on each footer button\'s ripple instance', () => {
const {component} = setupTest();
component.getDefaultFoundation().adapter_.layoutFooterRipples();
td.verify(stubbedLayout(), {times: 2});
});

0 comments on commit 5ba7e27

Please sign in to comment.