Skip to content

Commit

Permalink
Fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
negative0 committed Aug 24, 2020
1 parent 6dee82d commit 7c9883c
Show file tree
Hide file tree
Showing 13 changed files with 157 additions and 135 deletions.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,21 @@ exports[`Remote Explorer renders should match snapshot 1`] = `
"name": "Backend",
"url": "/rcloneBackend",
},
Object {
"icon": "fa fa-plug",
"name": "Plugins",
"url": "/pluginDashboard",
},
Object {
"icon": "fa fa-hdd-o",
"name": "Mounts",
"url": "/mountDashboard",
},
Object {
"icon": "fa fa-terminal",
"name": "Terminal",
"url": "/terminal",
},
Object {
"icon": "icon-logout",
"name": "Log Out",
Expand Down Expand Up @@ -204,6 +214,16 @@ exports[`Remote Explorer renders should match snapshot 1`] = `
"name": "Rclone Backend",
"path": "/rcloneBackend",
},
Object {
"component": Object {
"$$typeof": Symbol(react.lazy),
"_ctor": [Function],
"_result": null,
"_status": -1,
},
"name": "Plugins",
"path": "/pluginDashboard",
},
Object {
"component": Object {
"$$typeof": Symbol(react.lazy),
Expand All @@ -214,6 +234,26 @@ exports[`Remote Explorer renders should match snapshot 1`] = `
"name": "Mount Dashboard",
"path": "/mountDashboard",
},
Object {
"component": Object {
"$$typeof": Symbol(react.lazy),
"_ctor": [Function],
"_result": null,
"_status": -1,
},
"name": "Store Dashboard",
"path": "/storeDashboard",
},
Object {
"component": Object {
"$$typeof": Symbol(react.lazy),
"_ctor": [Function],
"_result": null,
"_status": -1,
},
"name": "Terminal",
"path": "/terminal",
},
]
}
className=""
Expand Down Expand Up @@ -286,10 +326,28 @@ exports[`Remote Explorer renders should match snapshot 1`] = `
/>
<Route
key="9"
name="Plugins"
path="/pluginDashboard"
render={[Function]}
/>
<Route
key="10"
name="Mount Dashboard"
path="/mountDashboard"
render={[Function]}
/>
<Route
key="11"
name="Store Dashboard"
path="/storeDashboard"
render={[Function]}
/>
<Route
key="12"
name="Terminal"
path="/terminal"
render={[Function]}
/>
<Redirect
from="/"
to="/dashboard"
Expand Down
50 changes: 19 additions & 31 deletions src/views/Base/Widgets/VideoPlayer/VideoPlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import * as ReactDOM from "react-dom";
import {MODAL_ROOT_ELEMENT} from "../../../../utils/Constants";
import * as PropTypes from "prop-types";
import ErrorBoundary from "../../../../ErrorHandling/ErrorBoundary";
import Iframe from 'react-iframe'

import ReactAwesomePlayer from 'react-awesome-player'
import {connect} from "react-redux";
Expand Down Expand Up @@ -79,21 +78,21 @@ function VideoPlayer({playbackURL, MimeType, loadedTestPlugins}) {
const subtitleURL = playbackURL.substring(0, playbackURL.lastIndexOf('.')) + ".vtt";
console.log(subtitleURL);

// const options = {
// options: {
// sources: [{
// type: MimeType,
// src: playbackURL
// }],
// subtitles: [
// {
// language: 'en',
// url: subtitleURL,
// label: "EN"
// }],
// }
// };
//
const options = {
options: {
sources: [{
type: MimeType,
src: playbackURL
}],
subtitles: [
{
language: 'en',
url: subtitleURL,
label: "EN"
}],
}
};


element =
ReactDOM.createPortal(
Expand All @@ -103,21 +102,10 @@ function VideoPlayer({playbackURL, MimeType, loadedTestPlugins}) {
{/*<video id="video" controls preload="metadata" width="600">*/}
{/* <source src={playbackURL} type={MimeType}/>*/}
{/*</video>*/}
{/*<PlayerComponent {...options}/>*/}
<Iframe url={`${pluginUrl}?loadUrl=${playbackURL}&mimeType=${MimeType}`}
allowTransparency="true"
allowFullScreen="true"
width="100%"
height="100%"
display="initial"
position="relative"/>
<Button color="link" onClick={hideFull} className="modal-button">
<i
className="fa fa-close fa-3x"
/>
</Button>
<PlayerComponent {...options}/>

</div>
<div className="modal-backdrop fade show"></div>
{/*<div className="modal-backdrop fade show"></div>*/}


</>, document.getElementById(MODAL_ROOT_ELEMENT));
Expand All @@ -127,7 +115,7 @@ function VideoPlayer({playbackURL, MimeType, loadedTestPlugins}) {
<ErrorBoundary>
{element}
</ErrorBoundary>
)
);


}
Expand Down
4 changes: 2 additions & 2 deletions src/views/Base/Widgets/VideoPlayer/VideoPlayer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import VideoPlayer from "./VideoPlayer";
const setUp = (intialState = {}, props = {}) => {
const store = testStore(intialState);
const component = shallow(<VideoPlayer {...props} store={store}/>);
return component;
return component.childAt(0).dive();
};


describe('Video Player Widget', function () {
describe('Video Player', function () {


describe('renders', function () {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Video Player Widget renders should match snapshot 1`] = `
<ContextProvider
value={null}
>
<VideoPlayer
MimeType=""
loadedTestPlugins={Object {}}
playbackURL=""
store={
Object {
"dispatch": [Function],
"getState": [Function],
"replaceReducer": [Function],
"subscribe": [Function],
Symbol(observable): [Function],
}
}
/>
</ContextProvider>
exports[`Video Player renders should match snapshot 1`] = `
<ErrorBoundary>
<div
className="img-thumbnail w-100 text-center"
data-test="videoPlayerWidget"
>
<Button
color="link"
onClick={[Function]}
tag="button"
>
<i
className="fa fa-play-circle fa-4x"
/>
</Button>
</div>
</ErrorBoundary>
`;
4 changes: 2 additions & 2 deletions src/views/DashboardPluginWidgets/DashboardPluginWidgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ function DashboardPluginWidgets({loadedPlugins, getPlugins}) {
let dashboardPlugins = getPluginsArray(loadedPlugins);
dashboardPlugins = filterPluginsByType(dashboardPlugins, pluginTypes.DASHBOARD)
setDashboardWidgets(dashboardPlugins);
}, [])
}, [getPlugins, loadedPlugins])


return (
<Row>
{dashboardWidgets.map(element => <Col lg={6}>
{dashboardWidgets.map(element => <Col lg={6} key={element.author + "/" + element.name}>
<DashboardPlugin pluginUrl={getPluginBaseUrl(getIPAddress(), element.name, element.author)}/>
</Col>)}
</Row>
Expand Down
1 change: 1 addition & 0 deletions src/views/Home/__snapshots__/Home.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ exports[`Home Component renders should match snapshot 1`] = `
<Connect(BandwidthStatusCard) />
</Col>
</Row>
<Connect(DashboardPluginWidgets) />
<h2>
Jobs
</h2>
Expand Down
2 changes: 1 addition & 1 deletion src/views/StoreDashboard/PluginPlaceHolderCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function PluginPlaceHolderCard({plugin}) {
<CardBody>
<Row>
<Col lg={3} className="d-none d-md-block">
<img style={{width: "100%"}}
<img style={{width: "100%"}} alt={icon ? name + " Icon" : 'rclone logo'}
src={icon ? icon : require("../../assets/img/brand/logo_symbol.png")}/>
</Col>
<Col lg={6} sm={12} md={6}>
Expand Down
75 changes: 40 additions & 35 deletions src/views/StoreDashboard/StoreDashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,44 +37,49 @@ class StoreDashboard extends React.Component {
render() {
const {pluginsList, searchQuery} = this.state;
const {getPlugins} = this.props;

let element = null;
if (pluginsList.length <= 0) {
return (<p>Loading</p>)
}
const filteredList = pluginsList ? pluginsList.filter(element => {
return (
element.name.toLowerCase().includes(searchQuery) ||
element.description.toLowerCase().includes(searchQuery) ||
element.longDescription.toLowerCase().includes(searchQuery) ||
element.author.toLowerCase().includes(searchQuery)
);
}) : [];
return (
<div data-test="storeDashboardComponent">
<Row>
<Col lg={12} className="mb-4 d-flex justify-content-between">
<Button color="secondary" onClick={() => this.props.history.goBack()}>Back</Button>
<Form inline onSubmit={(e) => e.preventDefault()}>
<InputGroup>
<Input placeholder="Type to start searching" type="text" value={searchQuery}
onChange={(e) => this.setState({searchQuery: e.target.value})}/>
<InputGroupAddon addonType="append"><Button color="primary"><span
className="fa fa-search"/></Button></InputGroupAddon>
</InputGroup>
element = (<p>Loading</p>);
} else {
const filteredList = pluginsList ? pluginsList.filter(element => {
return (
element.name.toLowerCase().includes(searchQuery) ||
element.description.toLowerCase().includes(searchQuery) ||
element.longDescription.toLowerCase().includes(searchQuery) ||
element.author.toLowerCase().includes(searchQuery)
);
}) : [];
element = (
<>
<Row>
<Col lg={12} className="mb-4 d-flex justify-content-between">
<Button color="secondary" onClick={() => this.props.history.goBack()}>Back</Button>
<Form inline onSubmit={(e) => e.preventDefault()}>
<InputGroup>
<Input placeholder="Type to start searching" type="text" value={searchQuery}
onChange={(e) => this.setState({searchQuery: e.target.value})}/>
<InputGroupAddon addonType="append"><Button color="primary"><span
className="fa fa-search"/></Button></InputGroupAddon>
</InputGroup>


</Form>
</Col>
</Row>
<Row>
{
filteredList.map((e) =>
<Col lg={6} key={e.name}>
<PluginPlaceHolderCard plugin={e} getPlugins={getPlugins}/>
</Col>
)
}
</Row>
</div>);
</Form>
</Col>
</Row>
<Row>
{
filteredList.map((e) =>
<Col lg={6} key={e.name}>
<PluginPlaceHolderCard plugin={e} getPlugins={getPlugins}/>
</Col>
)
}
</Row>
</>
);
}
return <div data-test="storeDashboardComponent">${element}</div>
}
}

Expand Down
Loading

0 comments on commit 7c9883c

Please sign in to comment.