Skip to content

Commit

Permalink
Fixes TS issues
Browse files Browse the repository at this point in the history
Signed-off-by: Timo Sand <[email protected]>
  • Loading branch information
deiga committed Oct 12, 2020
1 parent d154d8b commit fad89da
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 17 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"@testing-library/react-hooks": "3.4.2",
"@types/chai": "^4.2.3",
"@types/chai-dom": "^0.0.10",
"@types/chai-style": "^1.0.0",
"@types/enzyme": "^3.10.3",
"@types/format-util": "^1.0.1",
"@types/fs-extra": "^9.0.0",
Expand All @@ -87,6 +88,7 @@
"babel-plugin-transform-react-remove-prop-types": "^0.4.21",
"chai": "^4.1.2",
"chai-dom": "^1.8.1",
"chai-style": "^1.0.3",
"chalk": "^4.0.0",
"compression-webpack-plugin": "^6.0.2",
"confusing-browser-globals": "^1.0.9",
Expand Down
26 changes: 9 additions & 17 deletions packages/material-ui/src/ButtonBase/ButtonBase.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// @ts-check
import * as React from 'react';
import { expect } from 'chai';
import { spy, stub } from 'sinon';
import {
getClasses,
Expand All @@ -17,6 +16,8 @@ import {
import * as PropTypes from 'prop-types';
import ButtonBase from './ButtonBase';

const { expect } = require('chai').use(require('chai-style'));

describe('<ButtonBase />', () => {
const render = createClientRender();
/**
Expand Down Expand Up @@ -435,6 +436,7 @@ describe('<ButtonBase />', () => {
Hello
</ButtonBase>,
);
// @ts-ignore
stub(container.querySelector('.touch-ripple'), 'getBoundingClientRect').callsFake(() => ({
width: 100,
height: 100,
Expand All @@ -443,14 +445,9 @@ describe('<ButtonBase />', () => {
top: 20,
}));
fireEvent.mouseDown(getByRole('button'), { clientX: 10, clientY: 10 });
expect(container.querySelector('.touch-ripple-ripple').style).to.have.property(
'height',
'101px',
);
expect(container.querySelector('.touch-ripple-ripple').style).to.have.property(
'width',
'101px',
);
const rippleRipple = container.querySelector('.touch-ripple-ripple');
expect(rippleRipple).to.have.style('height', '101px');
expect(rippleRipple).to.have.style('width', '101px');
});

it('is disabled by default', () => {
Expand All @@ -461,6 +458,7 @@ describe('<ButtonBase />', () => {
Hello
</ButtonBase>,
);
// @ts-ignore
stub(container.querySelector('.touch-ripple'), 'getBoundingClientRect').callsFake(() => ({
width: 100,
height: 100,
Expand All @@ -469,14 +467,8 @@ describe('<ButtonBase />', () => {
top: 20,
}));
fireEvent.mouseDown(getByRole('button'), { clientX: 10, clientY: 10 });
expect(container.querySelector('.touch-ripple-ripple').style).to.not.have.property(
'height',
'101px',
);
expect(container.querySelector('.touch-ripple-ripple').style).to.not.have.property(
'width',
'101px',
);
expect(container.querySelector('.touch-ripple-ripple')).to.not.have.style('height', '101px');
expect(container.querySelector('.touch-ripple-ripple')).to.not.have.style('width', '101px');
});
});

Expand Down
12 changes: 12 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2595,6 +2595,13 @@
dependencies:
"@types/chai" "*"

"@types/chai-style@^1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@types/chai-style/-/chai-style-1.0.0.tgz#4b3b6a6b670e4fa023b8799c1fedac8f6011b039"
integrity sha512-9GBw5IJUwoT29vfpY18fg5eqtsDMT/IFzTNKYq34MWPsOHQOm9nTCBw7BjqDcoRuSWCtwx+Xh+WYCgWjMEbuew==
dependencies:
"@types/chai" "*"

"@types/chai@*", "@types/chai@^4.2.3":
version "4.2.12"
resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.2.12.tgz#6160ae454cd89dae05adc3bb97997f488b608201"
Expand Down Expand Up @@ -4766,6 +4773,11 @@ chai-dom@^1.8.1:
resolved "https://registry.yarnpkg.com/chai-dom/-/chai-dom-1.8.2.tgz#e06353baeafa8fddaaabda96a67f859c111a3c7c"
integrity sha512-kk2SnCuJliouO5M58OjA7M8VXN338WAxHOm+LbpjeL09pJgRpXugSC5aj8uwFm/6Lmpcdtq7hf+DldTdBm5/Sw==

chai-style@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/chai-style/-/chai-style-1.0.3.tgz#abc18e4c4df487ecc5de74d050496538999aa7c9"
integrity sha512-FrOHQ9lxr5SwssElVXeKnHdbesDxeSRrY4yUux4qRHKzjelHMpveuAb61ScwPgQojwhdH7ZpKpQAcFaejkcP2w==

chai@^4.1.2:
version "4.2.0"
resolved "https://registry.yarnpkg.com/chai/-/chai-4.2.0.tgz#760aa72cf20e3795e84b12877ce0e83737aa29e5"
Expand Down

0 comments on commit fad89da

Please sign in to comment.