Skip to content
This repository has been archived by the owner on Jan 14, 2025. It is now read-only.

Commit

Permalink
feature: Update MDC Web dependencies to v0.35.1 (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Goo authored May 22, 2018
1 parent a45c75a commit 203cf34
Show file tree
Hide file tree
Showing 13 changed files with 47 additions and 10 deletions.
19 changes: 19 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"babel-plugin-istanbul": "^4.1.5",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-polyfill": "^6.26.0",
"babel-preset-airbnb": "^2.4.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/button/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"url": "https://github.com/material-components/material-components-web-react.git"
},
"dependencies": {
"@material/button": "^0.34.1",
"@material/button": "^0.35.0",
"@material/react-ripple": "^0.1.0",
"classnames": "^2.2.5",
"prop-types": "^15.6.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/card/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"url": "https://github.com/material-components/material-components-web-react.git"
},
"dependencies": {
"@material/card": "^0.34.1",
"@material/card": "^0.35.0",
"classnames": "^2.2.5",
"prop-types": "^15.6.1",
"react": "^16.3.2"
Expand Down
2 changes: 1 addition & 1 deletion packages/fab/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"url": "https://github.com/material-components/material-components-web-react.git"
},
"dependencies": {
"@material/fab": "^0.34.1",
"@material/fab": "^0.35.0",
"@material/react-ripple": "^0.1.0",
"classnames": "^2.2.5",
"prop-types": "^15.6.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/floating-label/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"url": "https://github.com/material-components/material-components-web-react.git"
},
"dependencies": {
"@material/floating-label": "^0.34.0",
"@material/floating-label": "^0.35.0",
"classnames": "^2.2.5",
"prop-types": "^15.6.1",
"react": "^16.3.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/line-ripple/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"url": "https://github.com/material-components/material-components-web-react.git"
},
"dependencies": {
"@material/line-ripple": "^0.34.0",
"@material/line-ripple": "^0.35.0",
"classnames": "^2.2.5",
"prop-types": "^15.6.1",
"react": "^16.3.2"
Expand Down
4 changes: 3 additions & 1 deletion packages/ripple/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ const withRipple = (WrappedComponent) => {
activateRipple = (e) => {
// https://reactjs.org/docs/events.html#event-pooling
e.persist();
this.foundation_.activate(e);
requestAnimationFrame(() => {
this.foundation_.activate(e);
});
}

updateCssVariable = (varName, value) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/ripple/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"url": "https://github.com/material-components/material-components-web-react.git"
},
"dependencies": {
"@material/ripple": "^0.34.1",
"@material/ripple": "^0.35.0",
"classnames": "^2.2.5",
"prop-types": "^15.6.1",
"react": "^16.3.2"
Expand Down
2 changes: 1 addition & 1 deletion packages/text-field/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@material/react-floating-label": "^0.1.0",
"@material/react-line-ripple": "^0.1.0",
"@material/react-notched-outline": "^0.1.0",
"@material/textfield": "^0.34.1",
"@material/textfield": "^0.35.0",
"classnames": "^2.2.5",
"prop-types": "^15.6.1",
"react": "^16.3.2"
Expand Down
2 changes: 1 addition & 1 deletion packages/top-app-bar/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"topappbar"
],
"dependencies": {
"@material/top-app-bar": "^0.34.1",
"@material/top-app-bar": "^0.35.0",
"classnames": "^2.2.5",
"prop-types": "^15.6.1",
"react": "^16.3.2"
Expand Down
2 changes: 1 addition & 1 deletion test/screenshot/webpack-bundles.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');

module.exports.bundle = function(testPath, outputPath) {
return {
entry: './test/screenshot/' + testPath,
entry: ['babel-polyfill', `./test/screenshot/${testPath}`],
output: {
filename: outputPath + '.js',
},
Expand Down
15 changes: 15 additions & 0 deletions test/unit/ripple/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,16 @@ test('classNames adds classes', () => {
});

test('mouseDown event triggers activateRipple', () => {
const mockRaf = createMockRaf();
const mouseDownHandler = td.func();
const wrapper = mount(<DivRipple onMouseDown={mouseDownHandler}/>);
const foundation = wrapper.instance().foundation_;
foundation.activate = td.func();
wrapper.simulate('mouseDown');
mockRaf.flush();
td.verify(foundation.activate(td.matchers.isA(Object)), {times: 1});
td.verify(mouseDownHandler(td.matchers.isA(Object)), {times: 1});
mockRaf.restore();
});

test('mouseUp event does not trigger activateRipple', () => {
Expand All @@ -59,39 +62,51 @@ test('mouseUp event does not trigger activateRipple', () => {
});

test('touchStart event triggers activateRipple', () => {
const mockRaf = createMockRaf();
const touchStartHandler = td.func();
const wrapper = mount(<DivRipple onTouchStart={touchStartHandler}/>);
const foundation = wrapper.instance().foundation_;
foundation.activate = td.func();
wrapper.simulate('touchStart');
mockRaf.flush();
td.verify(foundation.activate(td.matchers.isA(Object)), {times: 1});
td.verify(touchStartHandler(td.matchers.isA(Object)), {times: 1});
mockRaf.restore();
});

test('touchStart event triggers activateRipple with no onTouchStart handler', () => {
const mockRaf = createMockRaf();
const wrapper = mount(<DivRipple />);
const foundation = wrapper.instance().foundation_;
foundation.activate = td.func();
wrapper.simulate('touchStart');
mockRaf.flush();
td.verify(foundation.activate(td.matchers.isA(Object)), {times: 1});
mockRaf.restore();
});

test('keyDown event triggers activateRipple', () => {
const mockRaf = createMockRaf();
const keyDownHandler = td.func();
const wrapper = mount(<DivRipple onKeyDown={keyDownHandler}/>);
const foundation = wrapper.instance().foundation_;
foundation.activate = td.func();
wrapper.simulate('keyDown');
mockRaf.flush();
td.verify(foundation.activate(td.matchers.isA(Object)), {times: 1});
td.verify(keyDownHandler(td.matchers.isA(Object)), {times: 1});
mockRaf.restore();
});

test('keyDown event triggers activateRipple with no onKeyDown handler', () => {
const mockRaf = createMockRaf();
const wrapper = mount(<DivRipple />);
const foundation = wrapper.instance().foundation_;
foundation.activate = td.func();
wrapper.simulate('keyDown');
mockRaf.flush();
td.verify(foundation.activate(td.matchers.isA(Object)), {times: 1});
mockRaf.restore();
});

test('#adapter.isUnbounded returns true is prop is set', () => {
Expand Down

0 comments on commit 203cf34

Please sign in to comment.