Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// internals
import FileAddAction from '../actions/FileAdd';
import FileUploadAction from '../actions/FileUpload';
import FileList from '../components/FileList';
import FileDetails from '../components/FileDetails';
import LeftNav from '../components/LeftNav';
import ModelList from '../components/ModelList';
import UnicornTheme from '../lib/MaterialUI/UnicornTheme';
/**
* React Main View Component
*/
@provideContext({
getConfigClient: React.PropTypes.func,
getLoggerClient: React.PropTypes.func,
getDatabaseClient: React.PropTypes.func,
getFileClient: React.PropTypes.func,
getModelClient: React.PropTypes.func
})
@ThemeDecorator(ThemeManager.getMuiTheme(UnicornTheme)) // eslint-disable-line new-cap
export default class Main extends React.Component {
static get contextTypes() {
return {
executeAction: React.PropTypes.func.isRequired
};
}
constructor(props, context) {
import FileValidateAction from '../actions/FileValidate';
import FileList from './FileList';
import FileDetails from './FileDetails';
import HTMStudioTheme from '../lib/MaterialUI/HTMStudioTheme';
import LeftNav from './LeftNav';
import ModelList from './ModelList';
const app = remote.app;
const dialog = remote.require('dialog');
/**
* React Main View Component
*/
@provideContext({
getConfigClient: React.PropTypes.func,
getLogger: React.PropTypes.func,
getDatabaseClient: React.PropTypes.func,
getFileClient: React.PropTypes.func,
getGATracker: React.PropTypes.func,
getModelClient: React.PropTypes.func,
getParamFinderClient: React.PropTypes.func
})
@ThemeDecorator(ThemeManager.getMuiTheme(HTMStudioTheme)) // eslint-disable-line new-cap
export default class Main extends React.Component {
static get contextTypes() {
return {
executeAction: React.PropTypes.func.isRequired,
getParamFinderClient: React.PropTypes.func,
getConfigClient: React.PropTypes.func,
beforeEach('render and locate element', function(done){
let testStores = [ContentModuleStore];
let context = createMockComponentContext({
stores : testStores
});
let testComponent = provideContext(connectToStores(component, testStores, function(){
return {};
}));
component = TestUtils.renderIntoDocument();
done();
});
beforeEach(function() {
context = createMockComponentContext({});
sinon.stub(context, 'executeAction');
var SearchInputClass = provideContext(SearchInput);
component = ReactTestUtils.renderIntoDocument(
);
node = ReactDOM.findDOMNode(component);
});
makeComponent = function(page) {
var currentRoute = Immutable.Map({
path: 'http:localhost:8000',
query: Immutable.Map({q: 'light', p: page || 1})
});
var context = createMockComponentContext({
stores: [RouteStore]
});
context.dispatcherContext.dispatcher.stores.RouteStore.prototype.getCurrentRoute = function() {
return currentRoute;
}
var PaginationClass = provideContext(Pagination);
component = ReactTestUtils.renderIntoDocument(
);
node = ReactDOM.findDOMNode(component);
}
});
beforeEach(function() {
clock = sinon.useFakeTimers();
context = createMockComponentContext({
stores: [AudioplayerStore, SurahsStore, AyahsStore]
});
context.getStore('SurahsStore').surahs = getSurahs;
context.getStore('AyahsStore').ayahs = getAyahs;
context.getStore('AudioplayerStore').currentAyah = getAyahs[0];
context.getStore('AudioplayerStore').currentAudio = new AudioStub(getAyahs[0].audio.mp3.url);
var AudioplayerClass = provideContext(Audioplayer);
component = ReactTestUtils.renderIntoDocument(
);
node = ReactDOM.findDOMNode(component);
foundComponent = ReactTestUtils.findAllInRenderedTree(component, function(t) {
return t.constructor.name === 'Audioplayer';
})[0];
sinon.stub(context, 'executeAction');
sinon.stub(foundComponent, 'changeAyah');
sinon.stub(foundComponent, 'loadRestOfAudio');
});