Babel and jest support classes

This commit is contained in:
James Barnsley
2020-01-23 06:21:05 +13:00
parent d66f073bca
commit 7bbf9621ab
3 changed files with 12 additions and 5 deletions

View File

@ -1,3 +1,9 @@
module.exports = {
presets: ['@babel/preset-env', '@babel/preset-react'],
presets: [
'@babel/preset-env',
'@babel/preset-react',
],
plugins: [
'@babel/plugin-proposal-class-properties',
],
};

1
package.json Executable file → Normal file
View File

@ -17,6 +17,7 @@
"react-router": "^5"
},
"devDependencies": {
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/preset-env": "^7.7.1",
"@babel/preset-react": "^7.7.0",
"babel-core": "^6",

View File

@ -852,15 +852,15 @@ const MopidyMiddleware = (function () {
case 'MOPIDY_PLAY_URIS':
const { from_uri } = action;
let uris = Object.assign([], action.uris);
let urisToPlay = Object.assign([], action.uris);
if (!uris || !uris.length) {
if (!urisToPlay || !urisToPlay.length) {
this.props.uiActions.createNotification({ content: 'No URIs to play', type: 'warning' });
break;
}
if (action.shuffle) {
action.uris = helpers.shuffle(action.uris);
urisToPlay = helpers.shuffle(urisToPlay);
}
// Stop the radio
@ -875,7 +875,7 @@ const MopidyMiddleware = (function () {
// Shuffle/random mode
if (store.getState().mopidy.random) {
var first_uri_index = Math.floor(Math.random() * action.uris.length);
var first_uri_index = Math.floor(Math.random() * urisToPlay.length);
} else {
var first_uri_index = 0;
}